From 7e46159e14f46b6c3c192ee2342b8c202f6268af Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Wed, 12 Feb 2020 14:12:26 -0500 Subject: [PATCH] Reduce width of b operand to minimum size needed --- src/ieee754/part_shift/part_shift_dynamic.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ieee754/part_shift/part_shift_dynamic.py b/src/ieee754/part_shift/part_shift_dynamic.py index 2eb6a499..97be1118 100644 --- a/src/ieee754/part_shift/part_shift_dynamic.py +++ b/src/ieee754/part_shift/part_shift_dynamic.py @@ -71,7 +71,9 @@ class PartitionedDynamicShift(Elaboratable): start = 0 for j, a in enumerate(a_intervals): end = keys[i] - comb += matrix[i][j].eq(a << b) + result_width = matrix[i][j].width + bwidth = math.ceil(math.log2(result_width + 1)) + comb += matrix[i][j].eq(a << b[:bwidth]) start = end # now create a switch statement which sums the relevant partial results -- 2.30.2