[Libre-soc-bugs] [Bug 1028] implement integer-versions of fft/dct "butterfly" instructions in ISACaller Simulator

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Thu Jul 20 23:52:00 BST 2023


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

--- Comment #11 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #10)
> (In reply to Jacob Lifshay from comment #9)
> > while writing unit tests for maddrs, I noticed that it's a 4-in 2-out
> > instruction (most likely too many) -- it reads RA, RB, RT, and RS and writes
> > RT and RS.
> 
> i already explained to markos on IRC why that is prohibited.
> the instruction has not been updated since that discussion.

ah, ok.


reading through the pseudo-code for maddsubrs/maddrs I noticed 2 things:
1. all the code to compute masks and merge in the sign bit is not actually
necessary, you extract the full XLEN-bit value you need with just:
prod1[XLEN - n:XLEN*2 - n - 1]

no further adjustment is needed (since casting to the result type is
essentially modular reduction, hence ignores the high bits).

2. for maddsubrs: if you sign extend the sum/difference by one bit before
multiplying, you avoid errors due to overflow:
e.g. use (RT)[0] || (RT) instead of (RT)

overflow errors do make it into the final result due to the right-shifting

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


More information about the libre-soc-bugs mailing list