02 October, 2018

Full Adder using module instantiation


//BlueTechspot.blogspot.com
module halfadder2 (a,b,s,c);
output s,c;
input a,b;
wire s,c;
xor (s,a,b);
and(c,a,b);
endmodule


module fulladder(A,B,Cin,Sum,Cout);
output Sum,Cout;
input A,B,Cin;
wire Sum,Cout,w1,w2,w3;
halfadder2 h1(.a(A),.b(B),.s(w1),.c(w2));
halfadder2 h2(.a(Cin),.b(w1),.s(Sum),.c(w3));
or (Cout,w2,w3);
endmodule

No comments:

Post a Comment

If you have any Queries, suggestions or requests, Do comment here!