OR element in after the MUX because its an invariant
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 13 Feb 2020 15:27:17 +0000 (15:27 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 13 Feb 2020 15:27:17 +0000 (15:27 +0000)
src/ieee754/part_shift/part_shift_dynamic.py

index 1e76a188648ee0594a09b9c244ce87d4282b9a79..b82fc467e75fad2d6d3f9c13c5a2cb15145c219e 100644 (file)
@@ -110,7 +110,14 @@ class PartitionedDynamicShift(Elaboratable):
             print(keys[i-1])
             temp = Signal(e-s+1, name="intermed%d" % i)
             print(intermed[keys[0]:])
-            intermed = Mux(gates[i-1], element, element | intermed[keys[0]:])
+            # XXX bit of a mess here, but rather than select
+            # element or (element | intermed), select between 0 or intermed
+            # then unconditionally "|" element on top (once copied into
+            # a named Signal)
+            intermed = Mux(gates[i-1], 0, intermed[keys[0]:])
+            intermed2 = Signal(intermed.shape())
+            comb += intermed2.eq(intermed | element)
+            intermed = intermed2
             comb += temp.eq(intermed)
             out.append(temp[:e-s])