cvfpu
cvfpu copied to clipboard
`fsgnjx.s` instruction is misbehaving with operand-b as infinity
Found a bug in a floating point unit. fsgnjx.s instruction is misbehaving.
Ideally fsgnjx.s copy a signed value from one register to another register, while modifying the sign bit based on the sign from another value.
Examples:
FSGNJ.S f2,f5,f6 # f2 = sign(f6) * |f5|
FSGNJN.S f2,f5,f6 # f2 = -sign(f6) * |f5|
FSGNJX.S f2,f5,f6 # f2 = sign(f6) * f5
In case, the f6(rs2) register is infinity and the f5(rs1) register is any number, the result from spike(ISS) is the XOR of a sign of f6 (i.e. positive) with the sign bit of f5(rs1) register for FSGNJX.S instruction but the result from FPU is a NaN which is incorrect.
References
Screenshots of logs from the spike and FPU design are attached below for a reference

Hello, I can confirm that this issue no longer exists in the latest version of the FPU (0d3e8c4).