cva6 icon indicating copy to clipboard operation
cva6 copied to clipboard

[BUG] Incorrect Accumulation of ‘OF’ Flag in fflags After Executing fsqrt.d on Infinity

Open youzi27 opened this issue 1 year ago • 1 comments

Is there an existing CVA6 bug for this?

  • [X] I have searched the existing bug issues

Bug Description

When executing the fsqrt.d instruction on a double-precision floating-point value representing positive infinity (0x7ff0000000000000), the Overflow (OF) flag in the fflags register is erroneously set. According to the IEEE 754 standard and the RISC-V specification, the fsqrt.d operation should not lead to an overflow situation when the input is infinity. This also results in inconsistency with Spike's output

Expected Behavior: The OF flag in the fflags register should remain clear (i.e., not set) after performing a square root operation on an infinite value, as the result is well-defined and should be positive infinity.

Actual Behavior: The OF flag is set in the fflags register, indicating an overflow, which contradicts the expected behavior defined by the IEEE 754 standard and RISC-V floating-point operation guidelines.

Steps to Reproduce:

  1. Load a double-precision floating-point register with the value 0x7ff0000000000000 (positive infinity).
  2. Execute the fsqrt.d instruction on this register.
  3. Check the fflags register; observe that the OF flag is incorrectly set.

youzi27 avatar Apr 18 '24 16:04 youzi27

This Github issue can also be reported on cvfpu side, thanks

JeanRochCoulon avatar Apr 22 '24 11:04 JeanRochCoulon