Adding two bits
Adding two single bits A and B by hand has four possible outcomes: 0+0=0, 0+1=1, 1+0=1, and 1+1=10 in binary — that is, Sum=0 with a Carry of 1. Notice that the Sum is exactly the XOR of A and B, and the Carry is exactly the AND of A and B.
The half adder
A half adder is precisely this circuit: two inputs (A, B), two outputs (Sum, Carry), built from one XOR gate and one AND gate.
- Sum = A ⊕ B
- Carry = A · B
The full adder
A half adder can't add a third bit — the carry coming in from a previous, less-significant column. A full adder adds that third input, Cin, giving Sum and Cout:
- Sum = A ⊕ B ⊕ Cin
- Cout = A·B + Cin·(A⊕B)
- In practice a full adder is built from two half adders: the first adds A and B, the second adds that result to Cin, and the two carries are combined with an OR gate.
Chaining into an N-bit adder
Connect the Cout of one full adder to the Cin of the next, and you get a ripple-carry adder capable of adding two N-bit numbers. Boolflow's built-in 4-bit Adder block is exactly this — four full adders chained together. Load the example circuit to see both the half adder and full adder built gate-by-gate, then verify the carry propagation with the Truth Table tool.