From 7ca66316ee5a720159fd97d1594c97ee5d1c67b4 Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Wed, 12 Feb 2020 11:22:18 -0500 Subject: [PATCH] Somewhat working dynamic shifter --- .../part_shift_scalar/part_shift_dynamic.py | 22 +++++++++++++------ .../test/test_shift_dynamic.py | 5 ++++- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/ieee754/part_shift_scalar/part_shift_dynamic.py b/src/ieee754/part_shift_scalar/part_shift_dynamic.py index d3bd0c08..a32e5bfd 100644 --- a/src/ieee754/part_shift_scalar/part_shift_dynamic.py +++ b/src/ieee754/part_shift_scalar/part_shift_dynamic.py @@ -31,7 +31,8 @@ class PartitionedDynamicShift(Elaboratable): m = Module() comb = m.d.comb width = self.width - gates = self.partition_points.as_sig() + gates = Signal(self.partition_points.get_max_partition_count(width)-1) + comb += gates.eq(self.partition_points.as_sig()) matrix = [] keys = list(self.partition_points.keys()) + [self.width] @@ -40,9 +41,10 @@ class PartitionedDynamicShift(Elaboratable): for i in range(len(keys)): row = [] start = 0 - for i in range(len(keys)): - end = keys[i] - row.append(Signal(width - start)) + for j in range(len(keys)): + end = keys[j] + row.append(Signal(width - start, + name="matrix[%d][%d]" % (i, j))) matrix.append(row) a_intervals = [] @@ -70,12 +72,18 @@ class PartitionedDynamicShift(Elaboratable): for i in range(1, len(out_intervals)): index = gates[:i] # selects the 'i' least significant bits # of gates - for index in range(1<<(i-1)): + element = Signal(width, name="element%d" % i) + for index in range(1<