[Libre-soc-isa] [Bug 766] New: Justify log2 addition as helper for pseudo-code

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Tue Jan 18 07:59:24 GMT 2022


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

            Bug ID: 766
           Summary: Justify log2 addition as helper for pseudo-code
           Product: Libre-SOC's first SoC
           Version: unspecified
          Hardware: Other
                OS: Linux
            Status: CONFIRMED
          Severity: enhancement
          Priority: ---
         Component: Specification
          Assignee: lkcl at lkcl.net
          Reporter: programmerjake at gmail.com
                CC: libre-soc-isa at lists.libre-soc.org
   NLnet milestone: ---

log2 is needed by a large group of instructions: shifts, rotates, grev, all
others that address individual bits in an XLEN-sized word.

https://git.libre-soc.org/?p=openpower-isa.git;a=commitdiff;h=4386dd8bb2d41db227263a947bface79d5acaf0c

Example of expected semantics:
we need to extract a log2(XLEN)-bit wide uint from the LSB end of RB, and shift
by that uint (remember RA and RB are XLEN-bit wide and MSB0 bit numbering is
used):
8-bit shift: RA << RB[8-log2(8):8-1]
16-bit shift: RA << RB[16-log2(16):16-1]
32-bit shift: RA << RB[32-log2(32):32-1]
64-bit shift: RA << RB[64-log2(64):64-1]

similarly for grev, rotate, etc.


if we require log2 to only be used in pseudo-code where its results are always
integers (so the inputs are powers of 2), then it should be entirely
unambiguous when used. it greatly improves pseudo-code clarity over writing out
a log2 definition by hand each place we want to use log2.

imho that should be sufficient justification for its inclusion.

I don't think a separate RFC is necessary, we would just include log2 in
whatever RFC we're writing that uses log2, e.g. we'd just include log2 in the
XLEN-ification RFC.

Because I think we should just include it in some other RFC, rather than have a
whole RFC dedicated to log2, I think trying to rewrite our existing pseudo-code
to remove all references to log2 is counterproductive -- we'd just include log2
in whatever RFCs include its uses in our current pseudo-code in
openpower-isa.git.

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


More information about the Libre-SOC-ISA mailing list