exponent too big to fit FP2int
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 28 Jul 2019 16:53:18 +0000 (17:53 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 28 Jul 2019 16:53:18 +0000 (17:53 +0100)
src/ieee754/fcvt/pipeline.py
src/ieee754/fcvt/test/test_fcvt_f2int_pipe.py

index 5a9eeddc972e30a03665cea505d2bba41918e060..90c4c0b435c127f2f62a94601d6fcff5b0447178 100644 (file)
@@ -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)
index 24f3fd03589ef4260b37f08ce1aacd1cfdec85f6..5e6e6627f0fae2660d4a49fddf49d6548a0d041e 100644 (file)
@@ -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()