fpnew: Fix f2i cast edge cases
Created by: huettern
Fixes an edge-case where an overflow before rounding causes the integer output to overflow/wrap instead of clip.
The bug was found when converting the float 127.5
to an INT8
with RNE
rounding. 127.5 is converted to 128 before rounding which resulted in the output 0x80
instead of 0x7f
.
Original fix by @stmach.
Reviewed-by: Noah Huetter noah.huetter@axelera.ai