Closed neuschaefer closed 8 years ago
If I understand you correctly, you want to know whether jor1k is doing what the (incorrect?) documentation says, or the "correct" behavior that occurs in a real device.
According to the imul section, it's been implemented as per existing real devices, not what the documentation says.
I think a was a little tired when I wrote the above :)
I'm talking about fastcpu.js in the (experimental?) RISC-V code. And by documentation I mean the comment in the third line of these functions.
By reading some more of the code, I found out that the mulh
instruction (signedsigned) uses UMul
and the mulhu
instruction (unsignedunsigned) uses IMul
. So the comments are correct, but the names are wrong (IMHO, at least).
I think the labeling is wrong. But to check the multiplication functions was on my list anyhow. The official riscv test cases (https://github.com/riscv/riscv-tests) are fine with the implementation.
Problem solved. The multiplication instructions still need a thorough check https://github.com/s-macke/jor1k/commit/3ce20cb17a720e0cda56288e5d00ef5d159071c3
In
js/worker/riscv/fastcpu.js
, there are the two functionsUMul
andIMul
.UMul
is documented as a signedsigned multiplication andIMul
as unsignedunsigned multiplication. However, their names suggest that it's in fact the other way around (UMul
sounds like unsigned multiplication).Which function does what?