public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* Re: Again: variable width instructions
@ 2003-02-10  0:56 Doug Evans
  2003-02-11 13:42 ` Manuel Kessler
  0 siblings, 1 reply; 4+ messages in thread
From: Doug Evans @ 2003-02-10  0:56 UTC (permalink / raw)
  To: Manuel Kessler; +Cc: cgen

Hi.

Regarding the fr30 example:

; test file for ldi32
        ldi:32 $0x80000000, r0
        nop
        ldi:32 $0x00000000, r1
        nop
        ldi:32 $0xffffffff, r2
        nop
        ldi:32 $0x7fffffff, r3
        nop
.end

Things might actually be working ok, depending upon whether or not
$0x80000000, etc. are valid symbols.  What's happening is that
gas is interpreting them as symbols ($ doesn't prefix constants in
fr30 assembler).  If you had included -r in the arguments to objdump
you would have seen the following.  Live and learn I guess. :-)

00000000 <foo>:
   0:	9f 80 00 00 	ldi:32 0x0,r0
   4:	00 00 
			0: R_FR30_48	$0x80000000
   6:	9f a0       	nop
   8:	9f 81 00 00 	ldi:32 0x0,r1
   c:	00 00 
			8: R_FR30_48	$0x00000000
   e:	9f a0       	nop
  10:	9f 82 00 00 	ldi:32 0x0,r2
  14:	00 00 
			10: R_FR30_48	$0xffffffff
  16:	9f a0       	nop
  18:	9f 83 00 00 	ldi:32 0x0,r3
  1c:	00 00 
			18: R_FR30_48	$0x7fffffff
  1e:	9f a0       	nop

Regarding problems specifying ciscy fields in m16c.cpu, Jan is right.
You (probably) want to use the full form of define-ifield for these.
It's unfortunate that I didn't create a shorthand version of the
full form of define-ifield, I think its absence has led to some confusion.
E.g. You don't need #lsb0 = #f, it just makes the abbreviated short forms
dnf and df [sic (*1)] work better.

I went to savannah.nongnu.org and checked out and built an m16c toolchain
(but using the m16c.cpu file you included in your message).

I can see some of the problems you're having.  For example,

	neg.b 4[a0]

disassembles to

   0:	a2 2f 04 42 	*unknown*

but it's only a 3 byte insn.

You really do want to use the proper values of 8 for base-insn-size, etc.

  (default-insn-bitsize 8)
  (base-insn-bitsize 8)
  (default-insn-word-bitsize ???)

Off the top of my head I dunno what's a good value for
default-insn-word-bitsize for the m16c.

Given that base-insn-bitsize is 8 you'll want to use the full form of
define-ifield, or the macros that are in your m16.cpu file: dif and dnif (*2).

There's one more problem though.  Cgen current doesn't support ifields
with constant values beyond base-insn-size.  There are hooks for this
in various places, but no one has finished the work.  It's straightforward,
more leg-work than brain-work.  I'll make a point of getting to it
this week (can't promise an ETA, but we shall see).

---

(*1): `df' should actually be the real full form, not an abbreviated form that
leaves out the ability to specify things necessary in ciscy ISAs.
`dfrf' [define-full-risc-field] or some-such would have been a better choice
for the current `df'.

(*2): Anyone want to come up with a usable macro who's name is "dunno"?
Now that would be funny. :-)

^ permalink raw reply	[flat|nested] 4+ messages in thread
* variable width instructions
@ 2002-12-20 14:59 David Carney
  2003-02-07 14:40 ` Again: " Manuel Kessler
  0 siblings, 1 reply; 4+ messages in thread
From: David Carney @ 2002-12-20 14:59 UTC (permalink / raw)
  To: cgen

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...

My question is: how I should go about defining the instruction fields for this 
architecture?  I.e. what value should I use for the "start" fields in 
"(define-ifield ...)" for the msb so that instruction fields are compatible 
for both 16-bit and (the effectively) 32-bit instructions (15 or 31) ?

My confusion stems from observing the line:

	(dnf f-i32       "32 bit immediate"      (SIGN-OPT) 16 32)

in fr30.cpu.  Doesn't the "16 32" denote that the start of the opcode is at 
bit 16, but the length is 32?  For my ISA I need something equivalent to 
"start" = -1, "length" = 16.  How do I go about this?

Dave Carney


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-02-11 13:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-10  0:56 Again: variable width instructions Doug Evans
2003-02-11 13:42 ` Manuel Kessler
  -- strict thread matches above, loose matches on Subject: below --
2002-12-20 14:59 David Carney
2003-02-07 14:40 ` Again: " Manuel Kessler
2003-02-07 21:06   ` Jan Zizka

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).