Skip to content

CVFPU incorrectly sets inexact flag on `F2F` conversions of infinity

According to IEEE 754-2008, operations on infinite operands usually do not signal exceptions:

image

However, CVFPU sets the NX flag on F2F conversions of infinite values.

https://github.com/openhwgroup/cvfpu/blob/a6af691551ffbd76d5d9cf30774d3295a41615e4/src/fpnew_cast_multi.sv#L727-L728

The expression above suppresses the NX flag upon overflow if the operand is infinity, but not if any of the fp_round_sticky_bits are set. These sticky bits are extracted from the destination mantissa, which in turn is derived from preshift_mant:

https://github.com/openhwgroup/cvfpu/blob/a6af691551ffbd76d5d9cf30774d3295a41615e4/src/fpnew_cast_multi.sv#L486-L494

However, the bits of preshift_mant are all '1 if the operand is infinity:

https://github.com/openhwgroup/cvfpu/blob/a6af691551ffbd76d5d9cf30774d3295a41615e4/src/fpnew_cast_multi.sv#L462-L467

As a result, the bits in fp_round_sticky_bits are always set if the operand is infinity and consequently the NX flag is incorrectly set.