Tuesday, 2 August 2016

Adder

Half Adder:


module ha(s,c,a,b);
    output s,c;
    input a,b;

assign s = a ^ b,
       c = a & b;

endmodule




Full Adder:



module fa(s,cout,a,b,c);
    output s,cout;
    input a,b,c;

   assign s = a ^ b ^ c;
   assign cout = (a & b) | (b & c) | (a & c);


endmodule

0 comments:

Post a Comment

if you have any doubt please let me know