only pass in lhs bit_width * 2 for UDivRem
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 10 Jul 2020 10:34:19 +0000 (11:34 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 10 Jul 2020 10:34:19 +0000 (11:34 +0100)
src/ieee754/div_rem_sqrt_rsqrt/core.py

index 79f5f9fbba7f5807fc620e1ce5c8560c624622cf..a6a65cc8a35703cc1761172e6150fb5350eea88a 100644 (file)
@@ -224,6 +224,10 @@ class DivPipeCoreSetupStage(Elaboratable):
         self.core_config = core_config
         self.i = self.ispec()
         self.o = self.ospec()
+        if core_config.supported == [DP.UDivRem]:
+            self.compare_len = bw * 2
+        else:
+            self.compare_len = bw * 3
 
     def ispec(self):
         """ Get the input spec for this pipeline stage."""
@@ -251,7 +255,7 @@ class DivPipeCoreSetupStage(Elaboratable):
         comb += self.o.quotient_root.eq(0)
         comb += self.o.root_times_radicand.eq(0)
 
-        lhs = Signal(self.core_config.bit_width * 3, reset_less=True)
+        lhs = Signal(self.compare_len, reset_less=True)
         fw = self.core_config.fract_width
 
         with m.Switch(self.i.operation):