From 7856f08e1d7c8204aceddb870cae13c703d8e5a9 Mon Sep 17 00:00:00 2001 From: David Harris Date: Mon, 29 Aug 2022 04:29:58 -0700 Subject: [PATCH] Renamed special case --- pipelined/src/fpu/fdivsqrtfsm.sv | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pipelined/src/fpu/fdivsqrtfsm.sv b/pipelined/src/fpu/fdivsqrtfsm.sv index 52cc6b757..c4780bcee 100644 --- a/pipelined/src/fpu/fdivsqrtfsm.sv +++ b/pipelined/src/fpu/fdivsqrtfsm.sv @@ -65,6 +65,8 @@ module fdivsqrtfsm( logic WZero; //logic [$clog2(`DIVLEN/2+3)-1:0] Dur; logic [`DIVb+3:0] W; + logic SpecialCase; + //flopen #($clog2(`DIVLEN/2+3)) durflop(clk, DivStart, CalcDur, Dur); assign DivBusy = (state == BUSY); // calculate sticky bit @@ -90,13 +92,16 @@ module fdivsqrtfsm( assign NegSticky = W[`DIVb+3]; assign EarlyTermShiftE = step; + // terminate immediately on special cases + assign SpecialCase = XZeroE | (YZeroE&~SqrtE) | XInfE | YInfE | XNaNE | YNaNE | (XsE&SqrtE); + always_ff @(posedge clk) begin if (reset) begin state <= #1 IDLE; end else if (DivStart&~StallE) begin step <= Dur; - if (XZeroE|(YZeroE&~SqrtE)|XInfE|YInfE|XNaNE|YNaNE|(XsE&SqrtE)) state <= #1 DONE; - else state <= #1 BUSY; + if (SpecialCase) state <= #1 DONE; + else state <= #1 BUSY; end else if (state == BUSY) begin if ((~|step[`DURLEN-1:1]&step[0])|WZero) begin state <= #1 DONE;