[Libre-soc-dev] bug in libre-soc "modsd" and possibly in microwatt as well

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sat Aug 22 14:20:51 BST 2020

paul, mikey, ben: i am running a step-and-diff of the "1.bin" unit
test, and ran into a discrepancy where none of the values match up for
the following test:

        lst = [f"modsd 17, 27, 0"]
        initial_regs = [0] * 32
        initial_regs[0] = 0xff
        initial_regs[27] = 0x7fffffffffffffff

this is the following instruction which can be found in 1.bin:

   103dc:   12 06 3b 7e     modsd   r17,r27,r0

the full dump can be found with the following command:
lkcl at fizzy:~/src/libresoc/microwatt/tests$
powerpc64le-linux-gnu-objdump --disassemble-zeroes -m powerpc -D -b
binary -EL 1.bin > 1.dump

the results are as follows:

* our program instruction analyzer returns 0x7f
* microwatt seems to return 0x1 (although there is "delay" in
single-stepping which is causing problems)
* the libre-soc pipelined DIV unit returns 0x7f
* the libre-soc "simulator-only" version of the DIV unit returns 0x7f
* the libre-soc FSM DIV unit returns 0x0

also in favour of the answer being 127 (0x7f) is the following python

>>> 0x7fffffffffffffff % 255

which is correct? :)


More information about the Libre-soc-dev mailing list