comment the dynamic shifter
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 12 Feb 2020 17:28:22 +0000 (17:28 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 12 Feb 2020 17:28:22 +0000 (17:28 +0000)
src/ieee754/part_shift/part_shift_dynamic.py

index a32e5bfd5c5ac2eac4603708f89fb2ca4aa93f46..2eb6a4994ad23ae8010ad3769910a4b3be003459 100644 (file)
@@ -38,6 +38,12 @@ class PartitionedDynamicShift(Elaboratable):
         keys = list(self.partition_points.keys()) + [self.width]
         start = 0
 
+        # create a matrix of partial shift-results (similar to PartitionedMul
+        # matrices).  These however have to be of length suitable to contain
+        # the full shifted "contribution".  i.e. B from the LSB *could* contain
+        # a number great enough to shift the entirety of A LSB right up to
+        # the MSB of the output, however B from the *MSB* is *only* going
+        # to contribute to the *MSB* of the output.
         for i in range(len(keys)):
             row = []
             start = 0
@@ -60,6 +66,7 @@ class PartitionedDynamicShift(Elaboratable):
             intervals.append([start,end])
             start = end
 
+        # actually calculate the shift-partials here
         for i, b in enumerate(b_intervals):
             start = 0
             for j, a in enumerate(a_intervals):
@@ -67,6 +74,9 @@ class PartitionedDynamicShift(Elaboratable):
                 comb += matrix[i][j].eq(a << b)
                 start = end
 
+        # now create a switch statement which sums the relevant partial results
+        # in each output-partition
+
         intermed = matrix[0][0]
         comb += out_intervals[0].eq(intermed)
         for i in range(1, len(out_intervals)):