[Libre-soc-isa] [Bug 685] Implement XLEN-ification for BCD instructions in base OpenPower ISA

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Tue Sep 7 08:05:34 BST 2021


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

Jacob Lifshay <programmerjake at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CONFIRMED                   |IN_PROGRESS
                 CC|                            |lkcl at lkcl.net

--- Comment #1 from Jacob Lifshay <programmerjake at gmail.com> ---
I've basically completed adding XLEN support to the bcd instructions, I also
added a new test suite that actually fully tests the bcd instructions, since
the old test suite didn't support checking if invalid BCD inputs converted
correctly. The new test suite uses pia as the reference implementation, since
that makes it easy to test against a working Power9 system.

I ended up rewriting the spec pseudo-code for addg6s since my attempted
XLEN-ification made the already complex code even more horrendous (something
like 15 lines!), the rewritten form is waay simpler and is nearly trivial to
XLEN-ify (5 lines).

New code:
    sum <- (0b0000 || (RA)) + (0b0000 || (RB))
    carries <- sum ^ (0b0000 || (RA)) ^ (0b0000 || (RB))
    ones <- [0b0001] * (XLEN / 4)
    nibbles_need_sixes <- ¬carries[0:XLEN-1] & ones
    RT <- nibbles_need_sixes * 0b0110

I'll mark this complete after someone else can replicate the tests working
(you'll need the latest pia), assuming no one complains about the new
pseudo-code algorithm.

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


More information about the Libre-SOC-ISA mailing list