shiftcorrection cleanup

This commit is contained in:
David Harris 2024-06-12 03:59:55 -07:00
parent 29fe5983e2
commit b7e2f34966
2 changed files with 7 additions and 5 deletions

View File

@ -157,11 +157,11 @@ module postprocess import cvw::*; #(parameter cvw_t P) (
end
2'b00: begin // cvt
ShiftAmt = {{P.LOGNORMSHIFTSZ-$clog2(P.CVTLEN+1){1'b0}}, CvtShiftAmt};
ShiftIn = {CvtShiftIn, {P.NORMSHIFTSZ-P.CVTLEN-P.NF-1{1'b0}}};
ShiftIn = {CvtShiftIn, {P.NORMSHIFTSZ-(P.CVTLEN+P.NF+1){1'b0}}};
end
2'b01: begin //divsqrt
ShiftAmt = DivShiftAmt;
ShiftIn = {{P.NF{1'b0}}, DivUm, {P.NORMSHIFTSZ-P.DIVb-1-P.NF{1'b0}}};
ShiftIn = {{P.NF{1'b0}}, DivUm, {P.NORMSHIFTSZ-(P.DIVb+1+P.NF){1'b0}}};
end
default: begin
ShiftAmt = {P.LOGNORMSHIFTSZ{1'bx}};

View File

@ -69,12 +69,14 @@ module shiftcorrection import cvw::*; #(parameter cvw_t P) (
assign RightShift = FmaOp ? LZAPlus1 : LeftShiftQm;
// one bit right shift for FMA or division
mux2 #(P.NORMSHIFTSZ) corrmux({Shifted[P.NORMSHIFTSZ-3:0], 2'b00}, {Shifted[P.NORMSHIFTSZ-2:1], 2'b00}, RightShift, CorrShifted);
// mux2 #(P.NORMSHIFTSZ) corrmux({Shifted[P.NORMSHIFTSZ-3:0], 2'b00}, {Shifted[P.NORMSHIFTSZ-2:1], 2'b00}, RightShift, CorrShifted);
// if the result of the divider was calculated to be subnormal, then the result was correctly normalized, so select the top shifted bits
always_comb
if (FmaOp | (DivOp & ~DivResSubnorm)) Mf = CorrShifted;
else Mf = Shifted[P.NORMSHIFTSZ-1:0];
if (FmaOp | (DivOp & ~DivResSubnorm)) // one bit shift for FMA or division
if (RightShift) Mf = {Shifted[P.NORMSHIFTSZ-2:1], 2'b00};
else Mf = {Shifted[P.NORMSHIFTSZ-3:0], 2'b00};
else Mf = Shifted[P.NORMSHIFTSZ-1:0]; // convert and subnormal division result
// Determine sum's exponent
// main exponent issues: