Fix shift amount width in fma and fma_multi - bug triggered by fp8alt
Created by: lucabertaccini
Fix bug in fpnew_fma
and fpnew_fma_multi
triggered by the FP8ALT
format. The SHIFT_AMOUNT_WIDTH
parameter was not large enough to represent the maximum shift.
SHIFT_AMOUNT_WIDTH
is used to define addend_shamt
as logic [SHIFT_AMOUNT_WIDTH-1:0] addend_shamt;
.
The maximum value we need to represent with addend_shamt
is 3 * PRECISION_BITS + 4
. Therefore, we need to define SHIFT_AMOUNT_WIDTH = $clog2 (3 * PRECISION_BITS +5)
. ($clog2 (3 * PRECISION_BITS +4
) would not be enough if 3 * PRECISION_BITS +4
is a power of two).