fix shifting of rsqrt mantissa input
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 24 Jul 2019 10:24:42 +0000 (11:24 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 24 Jul 2019 10:24:42 +0000 (11:24 +0100)
src/ieee754/div_rem_sqrt_rsqrt/core.py
src/ieee754/fpcommon/test/fpmux.py
src/ieee754/fpdiv/div0.py

index 2e5240383d7a65d5f01c248ec6851178d6368218..1c1e4c296b12ac2c0ac6a4b12b96bb09cd9f6b8e 100644 (file)
@@ -249,7 +249,7 @@ class DivPipeCoreSetupStage(Elaboratable):
                 self.i.divisor_radicand << (self.core_config.fract_width * 2))
         with m.Else():  # DivPipeCoreOperation.RSqrtRem
             m.d.comb += self.o.compare_lhs.eq(
-                1 << (self.core_config.fract_width * 2))
+                1 << (self.core_config.fract_width * 2)) # XXX reduced from 3
 
         m.d.comb += self.o.compare_rhs.eq(0)
         m.d.comb += self.o.operation.eq(self.i.operation)
index ef0a2f33097e18e675b026e22b638b062708ba94..f07ca658b363b8b6d408077f5f044586aadbde21 100644 (file)
@@ -171,6 +171,7 @@ def create_random(num_rows, width, single_op=False, n_vals=10):
                 #op1 = 0x4800
                 #op1 = 0x48f0
                 #op1 = 0x429
+                #op1 = 0x2631
 
                 vals.append((op1,))
             else:
@@ -183,7 +184,7 @@ def create_random(num_rows, width, single_op=False, n_vals=10):
                 #op2 = 0xb371
                 #op1 = 0x4400
                 #op1 = 0x656c
-                op1 = 0x738c
+                #op1 = 0x738c
 
                 vals.append((op1, op2,))
     return vals
index 0c9ed334adc6b8a913a8e3f2de08e74d69182399..c93ba723a0d303443a9ad0b78612945e283bc3f4 100644 (file)
@@ -121,8 +121,8 @@ class FPDivStage0Mod(Elaboratable):
                     m.d.comb += am0.eq(Cat(self.i.a.m, 0)<<(extra-3))
                     m.d.comb += self.o.z.e.eq(-((self.i.a.e+1) >> 1)+4)
                 with m.Else():
-                    m.d.comb += am0.eq(Cat(0, self.i.a.m)<<(extra-3))
-                    m.d.comb += self.o.z.e.eq((self.i.a.e >> 1)+2)
+                    m.d.comb += am0.eq(Cat(self.i.a.m)<<(extra-2))
+                    m.d.comb += self.o.z.e.eq(-(self.i.a.e >> 1)+4)
 
                 m.d.comb += [self.o.z.s.eq(self.i.a.s),
                              self.o.divisor_radicand.eq(am0),