From ab7b4cd371a788f6c96795f8de9e08fa8c7c2d0e Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 12 Feb 2020 17:28:22 +0000 Subject: [PATCH] comment the dynamic shifter --- src/ieee754/part_shift/part_shift_dynamic.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ieee754/part_shift/part_shift_dynamic.py b/src/ieee754/part_shift/part_shift_dynamic.py index a32e5bfd..2eb6a499 100644 --- a/src/ieee754/part_shift/part_shift_dynamic.py +++ b/src/ieee754/part_shift/part_shift_dynamic.py @@ -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)): -- 2.30.2