[Libre-soc-bugs] [Bug 684] XLEN-16 fails when XLEN=8
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Tue Sep 14 16:42:16 BST 2021
https://bugs.libre-soc.org/show_bug.cgi?id=684
--- Comment #7 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Luke Kenneth Casson Leighton from comment #6)
> for andi xori etc. these should all be something like:
>
> if XLEN=8 then
> RA <- (RS) ^ UI[8:15]
> else
> RA <- (RS) ^ ([0]*(XLEN-16) || UI)
i had a bit of a think about this, and feel that this is one
of those exceptional cases where we could justify a function,
to be added to section 1.3.2
the function proposed, in the usual obtuse shortness paradigm,
so loved by spec writers, would be XLT or XTRUNC, and would
be like this:
def XTRUNC(x):
return SelectableInt(x.value, min(x.bits, XLEN)
where SelectableInt takes care of the required truncation
of the input value.
all locations that risk an overflow when XLEN is less than
the immediate width after zero-extending would be simply:
RA <- (RS) ^ XTRUNC([0]*(XLEN-16) || UI)
nothing more sophisticated.
this minimises the intrusiveness into the pseudocode, which would
otherwise see significant disruption and lack of clarity.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list