does anybody know what are for PG and GG variables here:
module sum(S, Cout,PG,GG,A,B,Cin);
wire [3:0] G,P,C;
output [3:0] S;
output Cout,PG,GG;
input [3:0] A,B;
input Cin;
assign G = A & B;
assign P = A ^ B;
assign C[0] = Cin;
assign C[1] = G[0] | (P[0] & C[0]);
assign C[2] = G[1] | (P[1] & G[0]) | (P[1] & P[0] & C[0]);
assign C[3] = G[2] | (P[2] & G[1]) | (P[2] & P[1] & G[0]) | (P[2] & P[1] & P[0] & C[0]);
assign Cout = G[3] | (P[3] & G[2]) | (P[3] & P[2] & G[1]) | (P[3] & P[2] & P[1] & G[0]) |(P[3] & P[2] & P[1] & P[0] & C[0]);
assign S[0] = P[0] ^ C[0];
assign S[1] = P[1] ^ C[1];
assign S[2] = P[2] ^ C[2];
assign S[3] = P[3] ^ C[3];
endmodule
Your code is a four-bit carry-lookahead adder unit. PG and GG can be Group Propagate and Group Generate. PG and GG can be given to another CLA adder unit to combine such units to form a higher bit adder. They are given as
assign PG = P[3] & P[2] & P[1] & P[0];assign GG = G[3] | P[3] & G[2] | P[3] & P[2] | G[1] | P[3] & P[2] & P[1] & G[0];More details here. http://en.wikipedia.org/wiki/Lookahead_Carry_Unit#16-bit_adder