Adding the carry-in
Every column past the first has three bits to add: the two number bits a and b, plus a carry-in cin from the column to its right.
A full adder takes all three and produces the same two outputs as before:
- Sum: the result bit for this column.
- Carry-out (
cout): the bit passed to the next column.
Eight rows
Three inputs means eight rows. Read cout and sum together as the 2-bit count of how many inputs are 1:
| a | b | cin | cout | sum |
|---|
| 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 1 | 1 | 0 |
| 1 | 0 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 | 0 |
| 1 | 1 | 0 | 1 | 0 |
| 1 | 1 | 1 | 1 | 1 |
The last row is , which is : sum 1, carry 1.
Reuse the block
Figure: A full adder drawn as two half-adder blocks and an OR gate
This is hierarchy at work. A full adder is two half adders plus one OR gate:
- Half adder 1 adds
a and b, giving a partial sum and a carry. - Half adder 2 adds that partial sum to
cin, giving the final sum and a second carry. - An OR gate combines the two carries into
cout.
Only one of the two carries can ever be 1, so OR is enough to merge them.