From: Luke Kenneth Casson Leighton Date: Sun, 28 Jul 2019 16:53:18 +0000 (+0100) Subject: exponent too big to fit FP2int X-Git-Tag: ls180-24jan2020~697 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=994f41d2aa651401625a09a4190215481b42f5ee;p=ieee754fpu.git exponent too big to fit FP2int --- diff --git a/src/ieee754/fcvt/pipeline.py b/src/ieee754/fcvt/pipeline.py index 5a9eeddc..90c4c0b4 100644 --- a/src/ieee754/fcvt/pipeline.py +++ b/src/ieee754/fcvt/pipeline.py @@ -115,14 +115,14 @@ class FPCVTFloatToIntMod(Elaboratable): m.d.comb += self.o.z.eq(0) # signed, exp too big - with m.Elif(signed & (a1.e > Const(mz-1, espec))): + with m.Elif(signed & (a1.e >= Const(mz-1, espec))): with m.If(a1.s): # negative FP, so negative overrun m.d.comb += self.o.z.eq(-(1<<(mz-1))) with m.Else(): # positive FP, so positive overrun m.d.comb += self.o.z.eq((1<<(mz-1))-1) # unsigned, exp too big - with m.Elif((~signed) & (a1.e > Const(mz, espec))): + with m.Elif((~signed) & (a1.e >= Const(mz, espec))): with m.If(a1.s): # negative FP, so negative overrun (zero) m.d.comb += self.o.z.eq(0) with m.Else(): # positive FP, so positive overrun (max INT) diff --git a/src/ieee754/fcvt/test/test_fcvt_f2int_pipe.py b/src/ieee754/fcvt/test/test_fcvt_f2int_pipe.py index 24f3fd03..5e6e6627 100644 --- a/src/ieee754/fcvt/test/test_fcvt_f2int_pipe.py +++ b/src/ieee754/fcvt/test/test_fcvt_f2int_pipe.py @@ -107,8 +107,8 @@ def test_int_pipe_ui32_f16(): if __name__ == '__main__': for i in range(200): - test_int_pipe_f16_ui16() test_int_pipe_f32_ui32() + test_int_pipe_f16_ui16() continue test_int_pipe_i32_f32() test_int_pipe_i16_f32()