[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 12:36:04 GMT 2022


--- Comment #25 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(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.

> (I don't
> want to spend the time right now to solve #765).

that should be closed as INVALID.

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

> because I
> designed it to assert if the input isn't an integer power of 2, so its
> function is basically always totally obvious imho. 

"obvious" is not a criteria that will satisfy the OPF ISA WG. they have
a defined set of procedures and processes that have to be gone through,
including but not limited to providing the text that is to go into the
Power ISA Specification.

> It's needed so I can
> properly index into a field where I need the lsb log2(XLEN) or log2(XLEN/2)
> bits,

in this particular case, because it is log2 of a constant that is already
pre-defined, there is an alternative: define a constant XLENLOG2 and

this should go into the bugreport discussing and formally proposing
adding log2 as an alternative, so that if there is a decision on it
the reasons are fully available and can be placed directly into the RFC.

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

and then:

       idx <- b ^ i

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

More information about the libre-soc-bugs mailing list