[Libre-soc-bugs] [Bug 432] mulld pseudocode overflow calculation incorrect
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Wed Jul 15 16:29:01 BST 2020
https://bugs.libre-soc.org/show_bug.cgi?id=432
--- Comment #10 from Jacob Lifshay <programmerjake at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #7)
> (In reply to Jacob Lifshay from comment #5)
> > (In reply to Luke Kenneth Casson Leighton from comment #3)
> > > look reasonable?
> >
> > looks good to me!
>
> ok great. unit tests pass too. however they're simulator-HDL not
> simulator-qemu. if similar overflow unit tests had been added to run against
> qemu this would have been caught earlier.
qemu is known to not match POWER9, so some tests should fail. I added the
Python bindings to power-instruction-simulator specifically so we could write
unit tests against its instruction models, since they are likely to catch cases
where POWER9 and qemu disagree. So, to use it:
import power_instruction_analyzer as pia
fn unit_test_mulldo_(self, ra, rb, rt, so, ov, ov32, cr0):
# ra, rb, and rt are u64
# so, ov, and ov32 are bool
# includes rc for madd*, didn't yet set a default value
# so rc=<something> required for now:
inputs = pia.InstructionInputs(ra=ra, rb=rb, rc=0)
# all functions assumes SO flag starts as 0
outputs = pia.mulldo_(inputs) # the mulldo. instruction
self.assertEqual(outputs.rt, rt)
self.assertEqual(outputs.overflow.so, so)
self.assertEqual(outputs.overflow.ov, ov)
self.assertEqual(outputs.overflow.ov32, ov32)
self.assertEqual(outputs.cr0.lt, bool(cr0 & 8))
self.assertEqual(outputs.cr0.gt, bool(cr0 & 4))
self.assertEqual(outputs.cr0.eq, bool(cr0 & 2))
self.assertEqual(outputs.cr0.so, bool(cr0 & 1))
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list