mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
shiftcorrection cleanup
This commit is contained in:
parent
29fe5983e2
commit
b7e2f34966
@ -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}};
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user