Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

module fa(s,carry,a,b,c);

input a,b;
output s,carry;
wire g,h,i;
xor y(sum,a,b,c);
and b1(g,a,b);
and b2(h,b,c);
and b3(i,c,a);
or z(carry,g,h,i);
endmodule

module rcaa(cout,sum,a,b,cin);
output [3:0]cout;
output [3:0]sum;
input [3:0]a;
input [3:0]b;
input cin;
wire c0,c1,c2,c3;
fa g1(c[0],sum[0],a[o],b[0],cin);
fa g2(c[1],sum[1],a[1],b[1],c[0]);
fa g3(c[2],sum[2],a[2],b[2],c[1]);
fa g4(cout,sum[3],a[3],b[3],c[2]);
endmodule

You might also like