[BUG] Incorrect fflags Set When Using fdiv Instruction to Divide by Infinity
Bug Description
In the CVA6 implementation, when the fdiv.s instruction is used to divide by a single-precision floating-point number representing positive infinity (0x7F800000), the Overflow (OF) flag in fflags is erroneously set. The value of fflags becomes 0x4, indicating an overflow error. However, in the Spike simulator, the fflags value is 0x0. According to the IEEE 754 standard, an Overflow (OF) condition should not occur in this case.
Steps to Reproduce:
- Initializeft4to0x00000000andft6to0x7F800000 (infinity).
- Execute the instruction: fdiv.s ft1, ft4, ft6.
- Observe the value of fflags.
The log from CVA6 is as follows:
core   0: 0x0000000080002018 (0x186270d3) fdiv.s  ft1, ft4, ft6
3 0x0000000080002018 (0x186270d3) f 1 0xffffffff00000000
core   0: 0x000000008000201c (0x001023f3) csrrs   t2, fflags, zero
3 0x000000008000201c (0x001023f3) x 7 0x0000000000000004The log from Spike is as follows:
core   0: 0x0000000080002018 (0x186270d3) fdiv.s  ft1, ft4, ft6
core   0: 3 0x0000000080002018 (0x186270d3) f1  0xffffffff00000000
core   0: 0x000000008000201c (0x001023f3) csrrs   t2, fflags, zero
core   0: 3 0x000000008000201c (0x001023f3) x7  0x0000000000000000