public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Doug Evans <dje@sebabeach.org>
To: dfcarney@net-itech.com
Cc: cgen@sources.redhat.com
Subject: Re: variable width instructions
Date: Sat, 21 Dec 2002 21:13:00 -0000	[thread overview]
Message-ID: <20021222051952.0C9EDB539@seba.sebabeach.org> (raw)
In-Reply-To: <200212201757.54789.dfcarney@net-itech.com>

Dave Carney writes:
 > I'm trying to write a .cpu file for a simple, non-pipelined (CISC) chip.  The 
 > instructions and data are all 16 bits (little endian).  Defining the 
 > instruction fields was relatively straight forward, until I realised that 
 > instructions involving 'immediate' datum are, in fact, 32 bits...

I cooked up a hypothetical example to try to help illustrate what to do.
Plus I've spiff'd up the docs in this area a teensy bit.
See the Porting guide, "Writing define-ifield".

Suppose an ISA has 16 bit insns, with optional 16 and 32 bit immediates,
plus for illustration's sake some insns may take a 32 bit immediate
followed by a 16 bit immediate, and vice-versa.

If lsb0? = #f:

(dnf f-op1       "op1"                 () 0 4)
(dnf f-op2       "op2"                 () 4 4)
(dnf f-op3       "op3"                 () 8 4)
(dnf f-op4       "op4"                 () 12 4)
(dnf f-r1        "r1"                  () 8 4)
(dnf f-r2        "r2"                  () 12 4)
(df  f-simm16     "simm16"             () 16 16 INT #f #f)
(df  f-simm16b    "16 bit signed immediate after simm32" () 48 16 INT #f #f)
(df  f-simm32     "simm32"             () 16 32 INT #f #f)
(df  f-simm32b    "32 bit signed immediate after simm16" () 32 32 INT #f #f)

If lsb0? = #t:

(dnf f-op1       "op1"                 () 15 4)
(dnf f-op2       "op2"                 () 11 4)
(dnf f-op3       "op3"                 () 7 4)
(dnf f-op4       "op4"                 () 3 4)
(dnf f-r1        "r1"                  () 7 4)
(dnf f-r2        "r2"                  () 3 4)
(df  f-simm16     "simm16"             () 31 16 INT #f #f)
(df  f-simm16b    "16 bit signed immediate after simm32" () 63 16 INT #f #f)
(df  f-simm32     "simm32"             () 47 32 INT #f #f)
(df  f-simm32b    "32 bit signed immediate after simm16" () 63 32 INT #f #f)

I haven't actually generated the tools from this.
If there are problems, let us know and we'll fix 'em.
The fr30 port, while obsoleted, worked at one point and as you've found
it has some insns that take an optional 32 bit immediate.

  parent reply	other threads:[~2002-12-22  5:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-20 14:59 David Carney
2002-12-20 18:23 ` Frank Ch. Eigler
2002-12-21 21:13 ` Doug Evans [this message]
2003-02-07 14:40 ` Again: " Manuel Kessler
2003-02-07 21:06   ` Jan Zizka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021222051952.0C9EDB539@seba.sebabeach.org \
    --to=dje@sebabeach.org \
    --cc=cgen@sources.redhat.com \
    --cc=dfcarney@net-itech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).