Half Adder
Truth Table of Full Adder:
A B Cin Sum Cout
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
This is a proyect to express the sum of 2 bit expressions with carry, where AB + CD are the binary numbers, R2 is the MSB and R1 is the LSB of the sum, and S is the final carry, ONLY USING NAND GATES.
MODULE HalfAdder(A, B, Sum, Carry);
INPUT A, B;
OUTPUT Sum, Carry;
XOR (Sum, A, B); // Sum = A ⊕ B
AND (Carry, A, B); // Carry = A ∧ B
ENDMODULE;