Half Adder: Implementation and Truth Table
Two gates that add two bits. The smallest piece of arithmetic hardware there is, and the basis of every larger adder.
A half adder adds two single bits. It produces two outputs, a SUM bit and a CARRY bit, and it is the smallest piece of arithmetic hardware there is, which matters because every larger adder is built from copies of it.
Why two outputs are necessary
Adding two bits can produce 2. That does not fit in one bit, so the result has to spill somewhere, and in binary 1 + 1 = 10, which reads as a sum of 0 and a carry of 1. The carry output is where the overflow goes.
Truth table
| A | B | SUM | CARRY |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
Which gates produce each output
SUM is XOR
Look at the SUM column. It is 1 exactly when the inputs differ, which is the definition of XOR, so SUM = A XOR B.
CARRY is AND
CARRY is 1 only when both inputs are 1, and that is AND, so CARRY = A AND B. Two gates, and the half adder is finished.
The limitation: no carry in
A half adder has nowhere to accept a carry from a previous column, so it can only ever add the rightmost bit of a number. Fixing that is what the full adder is for.
Build it yourself
Two gates and four rows to check. If you are building your first circuit from scratch this is the one to start with, because you can verify every possible input by hand in about a minute.