add intermediate values as signals
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 17 Aug 2019 07:31:24 +0000 (08:31 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sat, 17 Aug 2019 07:31:24 +0000 (08:31 +0100)
src/ieee754/part_mul_add/multiply.py

index 0fe18051eabadc2baeaa3b04537d79891ea82041..aa4fafb62617d74e36019f2e5e2d1f02355769af 100644 (file)
@@ -465,16 +465,24 @@ class Mul8_16_32_64(Elaboratable):
                          .eq(self._delayed_part_ops[j][i])
                          for j in range(len(self.register_levels))]
 
+        def add_intermediate_value(value):
+            intermediate_value = Signal(len(value), reset_less=True)
+            m.d.comb += intermediate_value.eq(value)
+            return intermediate_value
+
         for parts, delayed_parts in [(self._part_64, self._delayed_part_64),
                                      (self._part_32, self._delayed_part_32),
                                      (self._part_16, self._delayed_part_16),
                                      (self._part_8, self._delayed_part_8)]:
             byte_count = 8 // len(parts)
             for i in range(len(parts)):
-                value = self._part_byte(i * byte_count - 1)
+                pb = self._part_byte(i * byte_count - 1)
+                value = add_intermediate_value(pb)
                 for j in range(i * byte_count, (i + 1) * byte_count - 1):
-                    value &= ~self._part_byte(j)
-                value &= self._part_byte((i + 1) * byte_count - 1)
+                    pb = add_intermediate_value(~self._part_byte(j))
+                    value = add_intermediate_value(value & pb)
+                pb = self._part_byte((i + 1) * byte_count - 1)
+                value = add_intermediate_value(value & pb)
                 m.d.comb += parts[i].eq(value)
                 m.d.comb += delayed_parts[0][i].eq(parts[i])
                 m.d.sync += [delayed_parts[j + 1][i].eq(delayed_parts[j][i])