[Libre-soc-bugs] [Bug 755] add grev instruction (OP_GREV)

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Tue Jan 18 18:35:53 GMT 2022


https://bugs.libre-soc.org/show_bug.cgi?id=755

--- Comment #26 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #25)
> (In reply to Jacob Lifshay from comment #24)
> > Added grev to BitManipTestCase, also had to spend a bunch of time fixing
> > bugs in the pseudo-code and working around bugs in the simulator...
> 
> you've accidentally requested RC in the CSV file for this instruction,
> which inherently and automatically requests OE as well.  that's a bug
> in the CSV file, not the simulator.

no, it's a bug in the simulator that there isn't a way to request RC without OE
unless you add GREV to a magic list of exceptions -- those exceptions should be
translated to an OE field in the CSV (they only cover instructions without OE
where the XO-form OE bit is 1; instructions like nand without OE but with the
XO-form OE bit set to 0 aren't included in the list of exceptions because
mis-interpreting the XO-form OE bit works even though it's not an XO-form
instruction.

> > (I don't
> > want to spend the time right now to solve #765).
> 
> that should be closed as INVALID.

nope, it is a valid bug, as explained above.
> 
> > I added a log2 helper function .. I figured that's probably fine 
> 
> it isn't.  anything that's added requires a formal discussion and
> to go through an OpenPOWER ISA Working Group Request For Change (RFC)
> process.

well, because it's already in the spec pdf in v3.1 in dbcz's pseudo-code --
it's fine.

> > and OpenPower *loves* MSB0, making it extra annoying:
> > 
> > just look at this mess:
> > grevw's pseudo-code:
> >     result <- [0] * (XLEN / 2)
> >     a <- (RA)[XLEN/2:XLEN-1]
> >     b <- EXTZ64(RB)
> >     do i = 0 to XLEN / 2 - 1
> >       idx <- b[64-log2(XLEN/2):63] ^ i
> >       result[i] <- a[idx]
> >     RT <- ([0] * (XLEN / 2)) || result
> 
> yyep. looks fairly annoyingly normal. can i suggest instead
> 
>      a <- (RA)[XLEN/2:XLEN-1]
>      b <- (RB)[64-log2(XLEN/2):XLEN-1]

that doesn't work when XLEN != 64:
if XLEN = 8, then length((RB)) = 8, and the slice expands to: (RB)[62:7] which
is obviously out-of-range.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list