cut root_times_radicand if not doing Sqrt
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Jul 2020 03:32:30 +0000 (04:32 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 3 Jul 2020 03:32:30 +0000 (04:32 +0100)
src/ieee754/div_rem_sqrt_rsqrt/core.py

index 45a02fb7652fe23787550346d305d118b9e28710..603af40a3791d1a89c9d1d28325e198e7839fa1e 100644 (file)
@@ -377,6 +377,7 @@ class DivPipeCoreCalculateStage(Elaboratable):
         """ Elaborate into ``Module``. """
         m = Module()
         comb = m.d.comb
+        cc = self.core_config
 
         # copy invariant inputs to outputs (for next stage)
         comb += self.o.divisor_radicand.eq(self.i.divisor_radicand)
@@ -445,10 +446,11 @@ class DivPipeCoreCalculateStage(Elaboratable):
 
         # create outputs for next phase
         qr = self.i.quotient_root | (next_bits << current_shift)
-        rr = self.i.root_times_radicand + ((self.i.divisor_radicand * next_bits)
-                                                     << current_shift)
         comb += self.o.quotient_root.eq(qr)
-        comb += self.o.root_times_radicand.eq(rr)
+        if DP.RSqrtRem in cc.supported:
+            rr = self.i.root_times_radicand + ((self.i.divisor_radicand *
+                                               next_bits) << current_shift)
+            comb += self.o.root_times_radicand.eq(rr)
 
         return m