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

nmsub.s of all (positive) zeros #24

Open michael-roe opened 4 years ago

michael-roe commented 4 years ago

With Piccolo, nmsub.s with rounding mode=RNE and all the source registers containing IEEE positive zero returns an IEEE negative zero.

I believe that the correct IEEE 754:2008 result is negative zero if the rounding mode is RDN, and positive zero otherwise. Spike gives the result I expected.

Here's a test:

.global _start _start: lui ra, 2 csrs mstatus, ra fmv.w.x ft0, zero

_test: fnmsub.s ft0, ft0, ft0, ft0, rne fmv.x.w a0, ft0