yeolyi.comSeongyeol's CS

Full Adder

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.

Full adder

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.

4s2s1sCarry11A+ BSum100
1s
1 + 1 = 102
2s
1 + 1 + 0 = 102

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.

SumCout
00000
00110
01010
01101
10010
10101
11001
11111

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.

  1. Set A, B, and Cin all to 1. Since 1 + 1 + 1 = 112, SUM and Cout are both 1.
  2. Switch only Cin back to 0. Since 1 + 1 = 102, SUM is 0 and Cout is 1.

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.

Wrapping up

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.

Challenge

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.