By combining logic gates, we can build a half adder that adds one-digit binary numbers. But the half adder has one limitation. For the first place, it only needs to handle two inputs, but from the next place on it must also handle the carry coming up from the place before.
Click the bits below to try adding two-digit binary numbers yourself. You can see how the carry is passed along when the 2s place is calculated.
A circuit that can handle all three inputs like this (A, B, and the Carry coming up from the place below) is called a full adder.
Here is the truth table of the full adder. To tell them apart, we call the carry coming in from the place before Cin, and the carry going out to the next place Cout.
| 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 |
It looks complicated, but think of each row as a binary addition. For example, the last row is 1 + 1 + 1 = 11₂, so Sum is 1 and Cout is 1.
A full adder can be built from half adders and an OR gate.
The first half adder adds A + B, and the second adds Cin to that. The two half adders’ carries can never both be 1 at the same time, so an OR is enough to combine them.
A full adder adds three bits: two bits plus the carry coming up from the place below. But a single full adder can only do 1-bit addition. How do we add numbers with many places, like 4 or 8 bits? In the next post, let’s chain full adders together.
Using four full adders, build a circuit that counts how many of 7 bits are 1 and outputs the count as a 3-bit binary number.