public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: "Frank Ch. Eigler" <fche@redhat.com>
To: Manuel Kessler <mlkessle@cip.physik.uni-wuerzburg.de>
Cc: cgen@sources.redhat.com
Subject: Re: make CGEN a less moving target?
Date: Wed, 11 Dec 2002 04:18:00 -0000	[thread overview]
Message-ID: <20021211121807.GA7339@redhat.com> (raw)
In-Reply-To: <Pine.GHP.4.21.0212110939180.23713-100000@wpax16.physik.uni-wuerzburg.de>

Hi -


On Wed, Dec 11, 2002 at 11:39:29AM +0100, Manuel Kessler wrote:
> [...]
> I am quite new to CGEN and started to write a new port of GNU binutils
> (and later on gdb, gcc, ???) for the Mitsubishi M16C family of
> microcontrollers (together with others, of course). [...]

Great!


> Is "better" the correct term here? Or is x86 supposed to be working (at
> least the partially implemented add instruction) at all, or to be seen as
> how to do a CISC example? All other cpus are more RISC like.

The x86.cpu file is, as far as I know, only meant as an example.
I believe actual generation of opcodes or simulators was never
attempted.


> [...]
> but it seems to me that non-contiguous ifields are currently
> not really supported. Is this correct, or how can I achieve the desired
> effect? 

Depending on whether these ifields contain operands or opcode
constants, different tricks may be necessary.  But CGEN can handle
several varieties of non-contiguous ifields.


> I am not quite sure how to correctly set the different *-bitsize values in
> define-isa. The architecture is 16 bits (little endian), but the smallest
> instruction is 8 bits long. [...]

The most important value is the base-insn-size.  This should be
large enough to include all opcode-like bits in the longest
instruction, so most likely 16 or even 32 for this chip.  Having
real instructions that are shorter than that is not a problem.


> [...]
> A more minor point: The architecture features some address registers,
> which may be 16 or 24 bits wide, depending on the model, otherwise being
> 16 bit. Therefore I tried to describe these in define-hardware as of mode
> AI (address integer) [... but that broke ...]

Right, some of these logical types are not usable everywhere,
sometimes for odd reasons.  Consider using HI or SI, depending on
architecture.  (It would sure be nice to generalize CGEN's type
system to represent N-bit types.)


> Finally: The architecture allows additional indirect addressing by using a
> special prefix byte, i.e. if you want to negate a register, you write
> neg.w r0
> but if you want to negate the memory value pointed to by the register
> neg.w [r0]
> the same opcode is used, prefixed by an additional byte marking the
> indirect addressing of the following instruction. [...]

One way to model this would be to consider the prefix byte part of the
opcode of the indirect-addressing variant of the instruction.  (You would
probably use a macro to generate the two variants.)  Other ways likely
include too much fiddling with C/C++ runtime flags and handmade parsers.


- FChE

  reply	other threads:[~2002-12-11 12:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-10  8:48 Johan Rydberg
2002-12-10  9:33 ` Doug Evans
2002-12-10 17:06   ` Johan Rydberg
2002-12-11  2:39   ` Manuel Kessler
2002-12-11  4:18     ` Frank Ch. Eigler [this message]
2002-12-11 13:36       ` Doug Evans
2002-12-11 13:42         ` Frank Ch. Eigler
2002-12-11 13:50           ` Doug Evans
2002-12-11 13:57             ` Frank Ch. Eigler
2002-12-11 14:25               ` Doug Evans
2002-12-11 10:08     ` Doug Evans

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=20021211121807.GA7339@redhat.com \
    --to=fche@redhat.com \
    --cc=cgen@sources.redhat.com \
    --cc=mlkessle@cip.physik.uni-wuerzburg.de \
    /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).