public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
* insn decoding with msb0
@ 2001-01-14 12:47 Johan Rydberg
  2001-01-15 10:57 ` Frank Ch. Eigler
  2001-02-20  9:58 ` Frank Ch. Eigler
  0 siblings, 2 replies; 4+ messages in thread
From: Johan Rydberg @ 2001-01-14 12:47 UTC (permalink / raw)
  To: cgen

Hi!

I have run into some problem with insn decoding when the CPU has
msb as bit 0 (i.e., the PowerPC CPU).

To make it a bit easier to debug, I switched back to using the
'decode-assist' statement when defining the ISA:

  (decode-assist (0 1 2 3 4 5))

Looking at the generated code you see that it shifts with 25 when
it really should shift with 26.  This seems to be the case with
all shifts (I have manualy changed the shift amount and verified
that it works).

   unsigned int val = (((insn >> 25) & (63 << 0)));
   switch (val)
   {
   ...

This seems to be the case when not using the decode-assist statement
aswell. 

The following small patch fixes the problem for me (both using the
decode-assist statement and not), but I guess that it's not correct 
for other ports (m32r, ...)

diff -u -r1.5 utils-sim.scm
--- utils-sim.scm       2000/12/04 18:34:45     1.5
+++ utils-sim.scm       2001/01/14 20:37:40
@@ -546,7 +546,7 @@
                            ; FIXME: Need to handle left (-ve) shift.
                            (shift (- (if lsb0?
                                          (- first bits -1)
-                                         (- (+ start size) (+ first bits)))
+                                         (- (+ start size 1) (+ first bits)))
                                      pos)))
                     (string-append
                      " | ((" val " >> " (number->string shift)

Regards,
Johan.

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

end of thread, other threads:[~2001-02-20  9:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-01-14 12:47 insn decoding with msb0 Johan Rydberg
2001-01-15 10:57 ` Frank Ch. Eigler
2001-01-16  1:18   ` Johan Rydberg
2001-02-20  9:58 ` Frank Ch. Eigler

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