From: Luke Kenneth Casson Leighton Date: Sat, 15 Feb 2020 14:30:38 +0000 (+0000) Subject: clip shift amount X-Git-Tag: ls180-24jan2020~156 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=941156a34b3d02f8571b28fc6d54efb5bca6f666;p=ieee754fpu.git clip shift amount --- diff --git a/src/ieee754/part_shift/part_shift_dynamic.py b/src/ieee754/part_shift/part_shift_dynamic.py index d991e5f8..ccfc5d04 100644 --- a/src/ieee754/part_shift/part_shift_dynamic.py +++ b/src/ieee754/part_shift/part_shift_dynamic.py @@ -120,13 +120,16 @@ class PartitionedDynamicShift(Elaboratable): # the partition mask, this calculates that with a mux # chain - # This computes the partial results table + # This computes the partial results table. note that + # the shift amount is truncated because there's no point + # trying to shift data by 64 bits if the result width + # is only 8. shifter = Signal(shiftbits, name="shifter%d" % i, reset_less=True) - #with m.If(element > shiftbits): - # comb += shifter.eq(shiftbits) - #with m.Else(): - # comb += shifter.eq(element) + with m.If(element > shiftbits): + comb += shifter.eq(shiftbits) + with m.Else(): + comb += shifter.eq(element) comb += shifter.eq(element) partial = Signal(reswid, name="partial%d" % i, reset_less=True) comb += partial.eq(a_intervals[i] << shifter)