From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19282 invoked by alias); 8 Aug 2011 14:49:23 -0000 Received: (qmail 19274 invoked by uid 22791); 8 Aug 2011 14:49:22 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-ew0-f47.google.com (HELO mail-ew0-f47.google.com) (209.85.215.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Aug 2011 14:49:06 +0000 Received: by ewy5 with SMTP id 5so830720ewy.20 for ; Mon, 08 Aug 2011 07:49:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.14.127.193 with SMTP id d41mr1508906eei.58.1312814945118; Mon, 08 Aug 2011 07:49:05 -0700 (PDT) Received: by 10.14.48.75 with HTTP; Mon, 8 Aug 2011 07:49:04 -0700 (PDT) Date: Mon, 08 Aug 2011 14:49:00 -0000 Message-ID: Subject: 2-word field extraction issue From: Aurelien Buhrig To: cgen@sources.redhat.com Content-Type: text/plain; charset=ISO-8859-1 Mailing-List: contact cgen-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sourceware.org X-SW-Source: 2011-q3/txt/msg00003.txt.bz2 Hi, I'm modifiying our existing sid port for our 16-bit MCU to add a branch instruction with a 22-bit pcrel offset. Here is the short description: (define-arch (name tam16) (default-alignment aligned) (insn-lsb0? #f) ...) (define-isa (name tam16) (default-insn-bitsize 16) (base-insn-bitsize 16) (default-insn-word-bitsize 16)) (define-cpu (name tam16bf) (endian big) (word-bitsize 16) (insn-chunk-bitsize 0)) The new 22-bit pcrel branch instruction is 2-word long and the pcrel corresponding field is continuous. I tried to define it like this: (define-ifield (name f-pcrel22) (attrs PCREL-ADDR) (word-offset 0) (word-length 32) (start 10) (length 22) (mode INT) (encode (...)) (decode (...)))) The generated code for extraction this field in tam16bf_extract_sfmt_bsr22l tam16bf_extract_sfmt_bsr22l (tam16-decode.cxx file) is EXTRACT_MSB0_SINT (insn, 16, 10, 22), which I think is wrong (base insn are 16-bit long). I worked around this problem by defining a multi-ifield with insert and extract expressions to make it doing the correct thing, but i'm wondering if it should be a bug ? Aurelien