Skip to content
Tactiverge

School/△ Builder/Week 16

Half adders and full adders

In binary, 1 + 1 = 10. A computer does that with two gates. How many does it need to add 1 + 1 + 1?

About 35 min · 3 goals · Checked by automated tests

1.Why should I care?

The adder is the heart of a processor's arithmetic logic unit. Once you can add one column of bits with gates, you can add numbers of any size, and from there subtract, count and address memory.

  • ◇ Write the truth tables of a half adder and a full adder.
  • ◇ Derive S = A ⊕ B ⊕ Cin and Cout = A·B + Cin·(A ⊕ B).
  • ◇ Explain how full adders chain to add multi-bit numbers.

2.Predict

Adding one column of binary, the inputs are A = 1, B = 1 and a carry in of 1. What do you write, and what do you carry?

Guess first. Being wrong here is how the surprise works.

3.Discover

Set 4 bits. Make A = 0001 and B = 0001 and step: the first column is a half adder. Now try A = 0111, B = 0001 and watch the carry ripple through three columns. Then turn on carry in. Fill in the eight-row full adder table in your notebook from what you see.

Loading the interactive…

Can't use the interactive? Read a description instead

The adder stepper shows two 4-bit numbers as rows of bit buttons and reveals one column at a time from the right, giving each column's carry in, sum and carry out. Adding 0111 and 0001, the carry ripples through three columns to give 1000. The full adder table for A B Cin from 000 to 111 is Cout S = 00, 01, 01, 10, 01, 10, 10, 11.

4.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1

A half adder is built from…

Practice 2

For a full adder with A = 1, B = 1, Cin = 1, read Cout S as a 2-bit binary number. What is its value in decimal?

5.Watch

→ Watch the half adder being drawn from an XOR and an AND, then two half adders and an OR becoming a full adder.

Builds half and full adders from gates, chains them into a ripple-carry adder and explains overflow.

Length: see YouTube · captions on YouTube · source

Nothing loads from YouTube until you press play.

The video is optional: everything you need is also in the lesson text and the interactive.

6.Understand

Column addition in binary

Binary adds like decimal, with only two digits: 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10 (write 0, carry 1), 1 + 1 + 1 = 11 (write 1, carry 1).

The full adder table

For A B Cin = 000, 001, 010, 011, 100, 101, 110, 111, the outputs Cout S are 00, 01, 01, 10, 01, 10, 10, 11. In other words, Cout S is just the count of 1s written in binary.

Chaining adders

To add 4-bit numbers, line up four full adders, one per column. Each carry out feeds the next column's carry in, so the carry ripples from right to left. Next week you will add multi-bit numbers this way and see what happens when the answer is too big.

Explain it another way

A full adder counts how many of its three inputs are 1 and writes that count in binary: the right digit is the sum, the left digit is the carry.

Derivation: Building the full adder
  1. Half adder (two inputs): the sum is 1 when exactly one input is 1, so S = A ⊕ B; the carry is 1 only when both are 1, so C = A · B.

  2. Full adder (three inputs A, B, Cin): the column total A + B + Cin is 0, 1, 2 or 3, written as two bits Cout S.

  3. S is 1 when the total is odd (1 or 3), which is when an odd number of inputs are 1: S = A ⊕ B ⊕ Cin.

  4. Cout is 1 when the total is 2 or 3. Either A and B are both 1 (A·B), or exactly one of them is 1 and there is a carry in (Cin·(A ⊕ B)). So Cout = A·B + Cin·(A ⊕ B).

  5. This is two half adders and an OR: the first adds A and B, the second adds Cin to that sum, and either carry makes Cout.

Worked example 1

Use the full adder equations for A = 1, B = 0, Cin = 1.

A ⊕ B = 1. S = 1 ⊕ 1 = 0. Cout = A·B + Cin·(A ⊕ B) = 0 + 1·1 = 1. Cout S = 10 = 2, and indeed 1 + 0 + 1 = 2.

Common mix-ups

  • A half adder is half as accurate as a full adder.
    ✓ It is exact, but it adds only two bits; the full adder also takes a carry in.
  • Binary 1 + 1 = 2.
    ✓ 2 is not a binary digit: 1 + 1 = 10, write 0 and carry 1.

7.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 3

A full adder's sum output S is 1 exactly when…

Practice 4 · a fresh version every time

With A = 1, B = 0 and C = 0, what is Y = (C ⊕ B) ⊕ A? Answer 0 or 1.

Practice 5 · a fresh version every time

An unsigned 8-bit register adds 01110011 + 00001101. What value does the register hold afterwards, in decimal? (Any carry out of the top bit is lost.)

Practice 6

How many full adders does an 8-bit ripple-carry adder use (one per column)?

adders

8.Apply it

Build a full adder in the logic lab (the 'Full adder' preset is a model answer, so try it from scratch first) and check all eight rows against your table. Then explain in two sentences why the carry out is the majority function from week 15.

9.Reflect

Concepts: Binary arithmetic and adders · Logic gates and Boolean algebra