mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Initial FDIVSQRT simplification working
This commit is contained in:
parent
16cde5f87e
commit
7b0e43bc10
@ -66,6 +66,7 @@ module fdivsqrtfsm(
|
|||||||
//logic [$clog2(`DIVLEN/2+3)-1:0] Dur;
|
//logic [$clog2(`DIVLEN/2+3)-1:0] Dur;
|
||||||
logic [`DIVb+3:0] W;
|
logic [`DIVb+3:0] W;
|
||||||
logic SpecialCase;
|
logic SpecialCase;
|
||||||
|
logic WZeroDelayed; // *** later remove
|
||||||
|
|
||||||
//flopen #($clog2(`DIVLEN/2+3)) durflop(clk, DivStart, CalcDur, Dur);
|
//flopen #($clog2(`DIVLEN/2+3)) durflop(clk, DivStart, CalcDur, Dur);
|
||||||
assign DivBusy = (state == BUSY);
|
assign DivBusy = (state == BUSY);
|
||||||
@ -87,7 +88,8 @@ module fdivsqrtfsm(
|
|||||||
assign WZero = ((NextWSN^NextWCN)=={NextWSN[`DIVb+2:0]|NextWCN[`DIVb+2:0], 1'b0});
|
assign WZero = ((NextWSN^NextWCN)=={NextWSN[`DIVb+2:0]|NextWCN[`DIVb+2:0], 1'b0});
|
||||||
assign DivSE = |W;
|
assign DivSE = |W;
|
||||||
end
|
end
|
||||||
assign DivDone = (state == DONE);
|
flopr #(1) WZeroReg(clk, reset | DivStart, WZero, WZeroDelayed);
|
||||||
|
assign DivDone = (state == DONE) | WZeroDelayed;
|
||||||
assign W = WC+WS;
|
assign W = WC+WS;
|
||||||
assign NegSticky = W[`DIVb+3];
|
assign NegSticky = W[`DIVb+3];
|
||||||
assign EarlyTermShiftE = step;
|
assign EarlyTermShiftE = step;
|
||||||
@ -102,14 +104,14 @@ module fdivsqrtfsm(
|
|||||||
step <= Dur;
|
step <= Dur;
|
||||||
if (SpecialCase) state <= #1 DONE;
|
if (SpecialCase) state <= #1 DONE;
|
||||||
else state <= #1 BUSY;
|
else state <= #1 BUSY;
|
||||||
|
end else if (DivDone) begin
|
||||||
|
if (StallM) state <= #1 DONE;
|
||||||
|
else state <= #1 IDLE;
|
||||||
end else if (state == BUSY) begin
|
end else if (state == BUSY) begin
|
||||||
if ((step == 1) | WZero) begin
|
if (step == 0) begin
|
||||||
state <= #1 DONE;
|
state <= #1 DONE;
|
||||||
end
|
end
|
||||||
step <= step - 1;
|
step <= step - 1;
|
||||||
end else if (state == DONE) begin
|
|
||||||
if (StallM) state <= #1 DONE;
|
|
||||||
else state <= #1 IDLE;
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
@ -73,7 +73,7 @@ module fdivsqrtpreproc (
|
|||||||
assign SqrtX = Xe[0]^XZeroCnt[0] ? {1'b0, ~XZero, PreprocX} : {~XZero, PreprocX, 1'b0};
|
assign SqrtX = Xe[0]^XZeroCnt[0] ? {1'b0, ~XZero, PreprocX} : {~XZero, PreprocX, 1'b0};
|
||||||
assign X = Sqrt ? {SqrtX, {`DIVb-1-`NF{1'b0}}} : {~XZero, PreprocX, {`DIVb-`NF{1'b0}}};
|
assign X = Sqrt ? {SqrtX, {`DIVb-1-`NF{1'b0}}} : {~XZero, PreprocX, {`DIVb-`NF{1'b0}}};
|
||||||
assign Dpreproc = {PreprocY, {`DIVN-1-`NF{1'b0}}};
|
assign Dpreproc = {PreprocY, {`DIVN-1-`NF{1'b0}}};
|
||||||
assign Dur = (`DURLEN)'(`FPDUR);
|
assign Dur = (`DURLEN)'(`FPDUR-1);
|
||||||
|
|
||||||
// radix 2 radix 4
|
// radix 2 radix 4
|
||||||
// 1 copies DIVLEN+2 DIVLEN+2/2
|
// 1 copies DIVLEN+2 DIVLEN+2/2
|
||||||
|
Loading…
Reference in New Issue
Block a user