From bdca760734af31679696d0529e78286e6eb55d04 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 13 Feb 2020 11:26:49 +0000 Subject: [PATCH] use different style of output concatenation, reduce temp bitwidth --- src/ieee754/part_shift/part_shift_dynamic.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ieee754/part_shift/part_shift_dynamic.py b/src/ieee754/part_shift/part_shift_dynamic.py index f67bdd6e..776030da 100644 --- a/src/ieee754/part_shift/part_shift_dynamic.py +++ b/src/ieee754/part_shift/part_shift_dynamic.py @@ -53,6 +53,7 @@ class PartitionedDynamicShift(Elaboratable): name="matrix[%d][%d]" % (i, j))) matrix.append(row) + # break out both the input and output into partition-stratified blocks a_intervals = [] b_intervals = [] out_intervals = [] @@ -80,9 +81,12 @@ class PartitionedDynamicShift(Elaboratable): # now create a switch statement which sums the relevant partial results # in each output-partition + out = [] intermed = matrix[0][0] - comb += out_intervals[0].eq(intermed) + s, e = intervals[0] + out.append(intermed[s:e]) for i in range(1, len(out_intervals)): + s, e = intervals[i] index = gates[:i] # selects the 'i' least significant bits # of gates element = Signal(width, name="element%d" % i) @@ -93,12 +97,13 @@ class PartitionedDynamicShift(Elaboratable): index = math.ceil(math.log2(index + 1)) comb += element.eq(matrix[index][i]) print(keys[i-1]) - temp = Signal(width, name="intermed%d" % i) + temp = Signal(e-s+1, name="intermed%d" % i) print(intermed[keys[0]:]) intermed = Mux(gates[i-1], element, element | intermed[keys[0]:]) comb += temp.eq(intermed) - comb += out_intervals[i].eq(intermed) + out.append(intermed[:e-s]) + comb += self.output.eq(Cat(*out)) return m -- 2.30.2