mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
more lza cleanup
This commit is contained in:
parent
48500c642c
commit
31215277ee
@ -39,15 +39,17 @@ module fmalza( // [Schmookler & Nowka, Leading zero anticipation and detection,
|
|||||||
localparam WIDTH = 3*`NF+7;
|
localparam WIDTH = 3*`NF+7;
|
||||||
|
|
||||||
logic [WIDTH-1:0] B,F;
|
logic [WIDTH-1:0] B,F;
|
||||||
logic [WIDTH-1:0] P, G, K;
|
logic [WIDTH-1:0] P, G;
|
||||||
|
logic [WIDTH-2:0] K;
|
||||||
logic [WIDTH-2:0] Pp1, Gm1, Km1;
|
logic [WIDTH-2:0] Pp1, Gm1, Km1;
|
||||||
|
|
||||||
assign B = {{(`NF+3){1'b0}}, Pm}; // Zero extend product
|
assign B = {{(`NF+3){1'b0}}, Pm}; // Zero extend product
|
||||||
// assign AA = A + Cin;
|
|
||||||
|
// next steps***replace P[WIDTH-1] with sub, then remove one bit from A
|
||||||
|
|
||||||
assign P = A^B;
|
assign P = A^B;
|
||||||
assign G = A&B;
|
assign G = A[WIDTH-2:0]&B[WIDTH-2:0];
|
||||||
assign K= ~A&~B;
|
assign K= ~A[WIDTH-2:0]&~B[WIDTH-2:0];
|
||||||
|
|
||||||
assign Pp1 = {A[WIDTH-1], P[WIDTH-2:1]};
|
assign Pp1 = {A[WIDTH-1], P[WIDTH-2:1]};
|
||||||
assign Gm1 = {G[WIDTH-3:0], Cin};
|
assign Gm1 = {G[WIDTH-3:0], Cin};
|
||||||
@ -58,7 +60,7 @@ module fmalza( // [Schmookler & Nowka, Leading zero anticipation and detection,
|
|||||||
//f[n] = ~P[n]&P[n-1] note: n is the MSB
|
//f[n] = ~P[n]&P[n-1] note: n is the MSB
|
||||||
//f[i] = (P[i+1]&(G[i]&~K[i-1] | K[i]&~G[i-1])) | (~P[i+1]&(K[i]&~K[i-1] | G[i]&~G[i-1]))
|
//f[i] = (P[i+1]&(G[i]&~K[i-1] | K[i]&~G[i-1])) | (~P[i+1]&(K[i]&~K[i-1] | G[i]&~G[i-1]))
|
||||||
assign F[WIDTH-1] = ~P[WIDTH-1]&P[WIDTH-2];
|
assign F[WIDTH-1] = ~P[WIDTH-1]&P[WIDTH-2];
|
||||||
assign F[WIDTH-2:0] = (Pp1&(G[WIDTH-2:0]&~Km1 | K[WIDTH-2:0]&~Gm1)) | (~Pp1&(K[WIDTH-2:0]&~Km1 | G[WIDTH-2:0]&~Gm1));
|
assign F[WIDTH-2:0] = (Pp1&(G&~Km1 | K&~Gm1)) | (~Pp1&(K&~Km1 | G&~Gm1));
|
||||||
|
|
||||||
lzc #(WIDTH) lzc (.num(F), .ZeroCnt(SCnt));
|
lzc #(WIDTH) lzc (.num(F), .ZeroCnt(SCnt));
|
||||||
endmodule
|
endmodule
|
||||||
|
Loading…
Reference in New Issue
Block a user