From: Michael Nolan Date: Wed, 12 Feb 2020 19:12:26 +0000 (-0500) Subject: Reduce width of b operand to minimum size needed X-Git-Tag: ls180-24jan2020~185 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7e46159e14f46b6c3c192ee2342b8c202f6268af;p=ieee754fpu.git Reduce width of b operand to minimum size needed --- 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