From 994f41d2aa651401625a09a4190215481b42f5ee Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 28 Jul 2019 17:53:18 +0100 Subject: [PATCH] exponent too big to fit FP2int --- src/ieee754/fcvt/pipeline.py | 4 ++-- src/ieee754/fcvt/test/test_fcvt_f2int_pipe.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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() -- 2.30.2