experiment looking for minimum shift width
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 13 Feb 2020 12:54:54 +0000 (12:54 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Thu, 13 Feb 2020 12:54:54 +0000 (12:54 +0000)
src/ieee754/part_shift/part_shift_dynamic.py

index 1b941d26023007e5fe4e16b11c623bdd35d2f955..7d5e7e475aee2939122ff472b89805eef9513a5c 100644 (file)
@@ -79,10 +79,13 @@ class PartitionedDynamicShift(Elaboratable):
                 # XXX!
                 bw = math.ceil(math.log2(self.output.width + 1))
                 tshift = Signal(bw, name="ts%d_%d" % (i, j), reset_less=True)
-                with m.If(b[:bw] < 1<<rw)):
+                ow = math.ceil(math.log2(width-start))
+                maxshift = (1<<(ow))
+                print ("part", i, b, j, a, rw, bw, ow, maxshift)
+                with m.If(b[:bw] < maxshift):
                     comb += tshift.eq(b[:bw])
                 with m.Else():
-                    comb += tshift.eq(1<<rw)
+                    comb += tshift.eq(maxshift)
                 comb += matrix[i][j].eq(a << tshift)
                 start = end