forked from Github_Repos/cvw
fdivsqrt post processing cleanup
This commit is contained in:
parent
99b244c8c4
commit
3ac62c74c2
@ -112,15 +112,8 @@ module fdivsqrtpostproc(
|
|||||||
mux2 #(`DIVb+4) normremsmux(NormRemDM, -NormRemDM, AsM, NormRemM);
|
mux2 #(`DIVb+4) normremsmux(NormRemDM, -NormRemDM, AsM, NormRemM);
|
||||||
mux2 #(`DIVb+4) quotresmux(UnsignedQuotM, -UnsignedQuotM, NegQuotM, NormQuotM);
|
mux2 #(`DIVb+4) quotresmux(UnsignedQuotM, -UnsignedQuotM, NegQuotM, NormQuotM);
|
||||||
|
|
||||||
// special case logic
|
// Select quotient or remainder and do normalization shift
|
||||||
always_comb
|
always_comb begin
|
||||||
if (BZeroM) begin // Divide by zero
|
|
||||||
if (RemOpM) SpecialFPIntDivResultM = AM;
|
|
||||||
else SpecialFPIntDivResultM = {(`XLEN){1'b1}};
|
|
||||||
end else if (ALTBM) begin // Numerator is zero
|
|
||||||
if (RemOpM) SpecialFPIntDivResultM = AM;
|
|
||||||
else SpecialFPIntDivResultM = '0;
|
|
||||||
end else begin
|
|
||||||
if (RemOpM) begin
|
if (RemOpM) begin
|
||||||
NormShiftM = ALTBM ? 0 : (mM + (`DIVBLEN+1)'(`DIVa)); // no postshift if forwarding input A to remainder
|
NormShiftM = ALTBM ? 0 : (mM + (`DIVBLEN+1)'(`DIVa)); // no postshift if forwarding input A to remainder
|
||||||
PreResultM = NormRemM;
|
PreResultM = NormRemM;
|
||||||
@ -129,9 +122,18 @@ module fdivsqrtpostproc(
|
|||||||
PreResultM = NormQuotM;
|
PreResultM = NormQuotM;
|
||||||
end
|
end
|
||||||
PreFPIntDivResultM = $signed(PreResultM >>> NormShiftM);
|
PreFPIntDivResultM = $signed(PreResultM >>> NormShiftM);
|
||||||
SpecialFPIntDivResultM = PreFPIntDivResultM[`XLEN-1:0];
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
// special case logic
|
||||||
|
always_comb
|
||||||
|
if (BZeroM) begin // Divide by zero
|
||||||
|
if (RemOpM) SpecialFPIntDivResultM = AM;
|
||||||
|
else SpecialFPIntDivResultM = {(`XLEN){1'b1}};
|
||||||
|
end else if (ALTBM) begin // Numerator is zero
|
||||||
|
if (RemOpM) SpecialFPIntDivResultM = AM;
|
||||||
|
else SpecialFPIntDivResultM = '0;
|
||||||
|
end else SpecialFPIntDivResultM = PreFPIntDivResultM[`XLEN-1:0];
|
||||||
|
|
||||||
// sign extend result for W64
|
// sign extend result for W64
|
||||||
if (`XLEN==64) begin
|
if (`XLEN==64) begin
|
||||||
mux2 #(64) resmux(SpecialFPIntDivResultM[`XLEN-1:0],
|
mux2 #(64) resmux(SpecialFPIntDivResultM[`XLEN-1:0],
|
||||||
|
Loading…
Reference in New Issue
Block a user