From b13cdf79b3731fcdb0d0552e91f6d36a4ce8b56c Mon Sep 17 00:00:00 2001 From: David Harris Date: Tue, 2 Aug 2022 07:42:32 -0700 Subject: [PATCH] FMA cleanup --- pipelined/src/fpu/fmaadd.sv | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pipelined/src/fpu/fmaadd.sv b/pipelined/src/fpu/fmaadd.sv index 653b9b3e2..af7b15bf4 100644 --- a/pipelined/src/fpu/fmaadd.sv +++ b/pipelined/src/fpu/fmaadd.sv @@ -51,10 +51,10 @@ module fmaadd( // Addition /////////////////////////////////////////////////////////////////////////////// - // Choose an inverted or non-inverted addend - the one has to be added now for the LZA + // Choose an inverted or non-inverted addend. Put carry into adder/LZA for addition assign AmInv = InvA ? ~Am : Am; // Kill the product if the product is too small to effect the addition (determined in fma1.sv) - assign PmKilled = Pm&{2*`NF+2{~KillProd}}; + assign PmKilled = KillProd ? '0 : Pm; // Do the addition // - calculate a positive and negitive sum in parallel // Zsticky Psticky @@ -64,15 +64,12 @@ module fmaadd( assign {NegSum, PreSum} = {{`NF+3{1'b0}}, PmKilled, 1'b0, InvA&ZmSticky&KillProd} + {InvA, AmInv} + {{3*`NF+6{1'b0}}, InvA&~((ZmSticky&~KillProd))}; assign NegPreSum = Am + {{`NF+2{1'b1}}, ~PmKilled, 2'b11} + {(3*`NF+4)'(0), ZmSticky&~KillProd, ~(ZmSticky)}; - // Is the sum negitive -// assign NegSum = PreSum[3*`NF+6]; - // Choose the positive sum and accompanying LZA result. assign Sm = NegSum ? NegPreSum : PreSum; // is the result negitive // if p - z is the Sum negitive // if -p + z is the Sum positive // if -p - z then the Sum is negitive - assign Ss = NegSum^Ps; //*** move to execute stage + assign Ss = NegSum^Ps; assign Se = KillProd ? {2'b0, Ze} : Pe; endmodule