The code:
module HA(x,y,s,c);
input x,y;
output s,c;
xor xor1(s,x,y);
and and1(c,x,y);
endmodule
module FA(x,y,cin,s,cout);
input x,y,cin;
output s,cout;
wire s1,c1,c2;
HA ha_1(x,y,s1,c1);
HA ha_2(cin,s1,s,c2);
or or1(cout,c1,c2);
endmodule
copy-paste the code as done in the video at 00:58
Understanding the code:
We are creating a half adder module HA and creating two instances of the same, namely ha_1 and ha_2. Using these, we create the Full Adder module FA.
#xilinx #fulladder #halfadder