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
|
end
|
||||||
2'b00: begin // cvt
|
2'b00: begin // cvt
|
||||||
ShiftAmt = {{P.LOGNORMSHIFTSZ-$clog2(P.CVTLEN+1){1'b0}}, CvtShiftAmt};
|
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
|
end
|
||||||
2'b01: begin //divsqrt
|
2'b01: begin //divsqrt
|
||||||
ShiftAmt = DivShiftAmt;
|
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
|
end
|
||||||
default: begin
|
default: begin
|
||||||
ShiftAmt = {P.LOGNORMSHIFTSZ{1'bx}};
|
ShiftAmt = {P.LOGNORMSHIFTSZ{1'bx}};
|
||||||
|
@ -69,12 +69,14 @@ module shiftcorrection import cvw::*; #(parameter cvw_t P) (
|
|||||||
assign RightShift = FmaOp ? LZAPlus1 : LeftShiftQm;
|
assign RightShift = FmaOp ? LZAPlus1 : LeftShiftQm;
|
||||||
|
|
||||||
// one bit right shift for FMA or division
|
// 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
|
// 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
|
always_comb
|
||||||
if (FmaOp | (DivOp & ~DivResSubnorm)) Mf = CorrShifted;
|
if (FmaOp | (DivOp & ~DivResSubnorm)) // one bit shift for FMA or division
|
||||||
else Mf = Shifted[P.NORMSHIFTSZ-1:0];
|
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
|
// Determine sum's exponent
|
||||||
// main exponent issues:
|
// main exponent issues:
|
||||||
|
Loading…
Reference in New Issue
Block a user