bluespec / Piccolo

RISC-V CPU, simple 3-stage pipeline, for low-end applications (e.g., embedded, IoT)
Apache License 2.0
301 stars 48 forks source link

fcvt.w.d rounds incorrectly in rmm mode #26

Open michael-roe opened 4 years ago

michael-roe commented 4 years ago

Here's a test case:

_start: lui ra, 2 csrs mstatus, ra _test: li t0, 0x40e6a09e66689b2e fmv.d.x f0, t0 fcvt.w.d a0, f0, rmm

Piccolo rounds down to 0xb504, while spike rounds up to 0xb505. I believe that spike is correct.

(If you're wondering where the strange constant came from, it's sqrt(MAXINT), but I think that isn't important for this bug).