cvfpu icon indicating copy to clipboard operation
cvfpu copied to clipboard

`fsgnjx.s` instruction is misbehaving with operand-b as infinity

Open AuringzaibSabir opened this issue 3 years ago • 1 comments

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

image

AuringzaibSabir avatar Oct 11 '22 12:10 AuringzaibSabir

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

gamzeisl avatar Sep 18 '25 09:09 gamzeisl