ViewWiki

Lesson 3 of 4

A half adder.

About 20 minutes · 5 practice questions

Gates that compute: adding two bits, a carry that is AND and a sum that is XOR, how the NOT blocks the sum at 1 + 1, and why it is only half an adder.

Step 1 of 5 · Adding two bits

Step 1 of 5

Adding two bits

Adding two bits is a small truth table: 0+0=00 + 0 = 0⁠, 0+1=10 + 1 = 1⁠, 1+0=11 + 0 = 1⁠, and 1+1=21 + 1 = 2⁠. But base 2 has no digit 2, so 22⁠ is written 10210_2⁠: two digits. Every sum of two bits gives two bits, a sum digit and a carry digit, just as 5+55 + 5⁠ in base ten gives 0 and carries 1 into the next column.

The board has rewired the same gates, plus one more AND, into a half adder. The two lights are the carry and the sum, and together they read A+BA + B⁠ in base 2. Predict, and then both inputs will go up.

To the question

Step 2 of 5

A sum with no carry

The sum column and the carry column differ. Find a setting where only the sum is on.

To the question

Step 3 of 5

The carry

Write out the carry column for the four rows, and compare it with the columns you know.

To the question

Step 4 of 5

The sum

The sum column is 0, 1, 1, 0: XOR. The board has no XOR gate, so the sum digit SS⁠ is built from the others, just as in the last Lesson:

S=(A OR B) AND NOT (A AND B)S = (A \text{ OR } B) \text{ AND NOT } (A \text{ AND } B)⁠

Follow the traces: the AND’s output goes to the carry light and also to the NOT, and the NOT and the OR go together into the second AND, which lights the sum. Predict what will block the sum when B goes up.

To the question

Step 5 of 5

Half an adder

A half adder adds any two bits correctly. But to add long numbers, column by column, every column except the first also receives a carry from the column to its right. That needs something more.

To the question

Interactive scene

Loading the interactive version…

Each step sets up the Scene for you, and a control marked “fixed” stays put for that step.

To the experiment

Practice · Predict, then look

The gates are rewired into a half adder, and both inputs are 0. What will the Carry and Sum lights show when we add 1+11 + 1⁠?

To the experiment

Practice · Reach the target

The carry is on and the sum is dark. Find inputs at which the Sum light is on and the Carry light is dark, and press Check.

To the experiment

Practice · Choose

The carry light is on only for 1+11 + 1⁠. Which gate on its own computes the carry?

To the experiment

Practice · Predict, then look

The sum is built as (A OR B) AND NOT (A AND B)(A \text{ OR } B) \text{ AND NOT } (A \text{ AND } B)⁠. Now A = 1 and B = 0, and the sum is on. When B goes up too, the sum will go dark. What will the NOT’s output, NOT(A AND B)\text{NOT}(A \text{ AND } B)⁠, be then?