mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
CSA-based completion detection
This commit is contained in:
parent
a493b402cb
commit
5ea82cff33
@ -155,8 +155,8 @@ module fdivsqrtiter(
|
|||||||
|
|
||||||
|
|
||||||
// if starting a new divison set Q to 0 and QM to -1
|
// if starting a new divison set Q to 0 and QM to -1
|
||||||
mux2 #(`DIVb+1) QMmux(QMNext[`DIVCOPIES-1], '1, DivStart, QMMux);
|
|
||||||
flopenr #(`DIVb+1) Qreg(clk, DivStart, DivBusy, QNext[`DIVCOPIES-1], Q[0]);
|
flopenr #(`DIVb+1) Qreg(clk, DivStart, DivBusy, QNext[`DIVCOPIES-1], Q[0]);
|
||||||
|
mux2 #(`DIVb+1) QMmux(QMNext[`DIVCOPIES-1], '1, DivStart, QMMux);
|
||||||
flopen #(`DIVb+1) QMreg(clk, DivStart|DivBusy, QMMux, QM[0]);
|
flopen #(`DIVb+1) QMreg(clk, DivStart|DivBusy, QMMux, QM[0]);
|
||||||
|
|
||||||
flopenr #(`DIVb+1) SMreg(clk, DivStart, DivBusy, SMNext[`DIVCOPIES-1], SM[0]);
|
flopenr #(`DIVb+1) SMreg(clk, DivStart, DivBusy, SMNext[`DIVCOPIES-1], SM[0]);
|
||||||
|
@ -59,7 +59,6 @@ module fdivsqrtpostproc(
|
|||||||
assign FZero = SqrtM ? {FirstSM[`DIVb], FirstSM, 2'b0} | {FirstK,1'b0} : {3'b1,D,{`DIVb-`DIVN+2{1'b0}}};
|
assign FZero = SqrtM ? {FirstSM[`DIVb], FirstSM, 2'b0} | {FirstK,1'b0} : {3'b1,D,{`DIVb-`DIVN+2{1'b0}}};
|
||||||
csa #(`DIVb+4) fadd(WS, WC, FZero, 1'b0, WSF, WCF); // compute {WCF, WSF} = {WS + WC + FZero};
|
csa #(`DIVb+4) fadd(WS, WC, FZero, 1'b0, WSF, WCF); // compute {WCF, WSF} = {WS + WC + FZero};
|
||||||
aplusbeq0 #(`DIVb+4) wcfpluswsfeq0(WCF, WSF, wfeq0);
|
aplusbeq0 #(`DIVb+4) wcfpluswsfeq0(WCF, WSF, wfeq0);
|
||||||
// assign WZero = weq0|(wfeq0&qn[`DIVCOPIES-1]);
|
|
||||||
assign WZero = weq0|(wfeq0 & Firstqn);
|
assign WZero = weq0|(wfeq0 & Firstqn);
|
||||||
end else begin
|
end else begin
|
||||||
assign WZero = weq0;
|
assign WZero = weq0;
|
||||||
|
@ -85,7 +85,6 @@ module fdivsqrtpreproc (
|
|||||||
flopen #(`NE+2) expflop(clk, DivStart, Qe, QeM);
|
flopen #(`NE+2) expflop(clk, DivStart, Qe, QeM);
|
||||||
expcalc expcalc(.Fmt, .Xe, .Ye, .Sqrt, .XZero, .XZeroCnt, .YZeroCnt, .Qe);
|
expcalc expcalc(.Fmt, .Xe, .Ye, .Sqrt, .XZero, .XZeroCnt, .YZeroCnt, .Qe);
|
||||||
|
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
||||||
module expcalc(
|
module expcalc(
|
||||||
|
@ -51,6 +51,7 @@ module fdivsqrtstage4 (
|
|||||||
logic [`DIVb+3:0] F;
|
logic [`DIVb+3:0] F;
|
||||||
logic [`DIVb+3:0] AddIn;
|
logic [`DIVb+3:0] AddIn;
|
||||||
logic [4:0] Smsbs;
|
logic [4:0] Smsbs;
|
||||||
|
logic CarryIn;
|
||||||
|
|
||||||
// Qmient Selection logic
|
// Qmient Selection logic
|
||||||
// Given partial remainder, select quotient of +1, 0, or -1 (qp, qz, pm)
|
// Given partial remainder, select quotient of +1, 0, or -1 (qp, qz, pm)
|
||||||
@ -77,7 +78,8 @@ module fdivsqrtstage4 (
|
|||||||
// Partial Product Generation
|
// Partial Product Generation
|
||||||
// WSA, WCA = WS + WC - qD
|
// WSA, WCA = WS + WC - qD
|
||||||
assign AddIn = SqrtM ? F : Dsel;
|
assign AddIn = SqrtM ? F : Dsel;
|
||||||
csa #(`DIVb+4) csa(WS, WC, AddIn, |q[3:2]&~SqrtM, WSA, WCA);
|
assign CarryIn = ~SqrtM & (q[3] | q[2]); // +1 for 2's complement of -D and -2D
|
||||||
|
csa #(`DIVb+4) csa(WS, WC, AddIn, CarryIn, WSA, WCA);
|
||||||
|
|
||||||
otfc4 otfc4(.q, .Q, .QM, .QNext, .QMNext);
|
otfc4 otfc4(.q, .Q, .QM, .QNext, .QMNext);
|
||||||
sotfc4 sotfc4(.s(q), .Sqrt(SqrtM), .C({1'b1, C}), .S, .SM, .SNext, .SMNext);
|
sotfc4 sotfc4(.s(q), .Sqrt(SqrtM), .C({1'b1, C}), .S, .SM, .SNext, .SMNext);
|
||||||
|
Loading…
Reference in New Issue
Block a user