Students build a half adder from XOR and AND, add 4-bit binary numbers on a chain of full adders and watch the carries ripple, then build a full adder from gates (AC9TDI8K04 node 3, extended; the kit names adder circuits as going further).
From gates to a processor · Building with gates · about 45 minutes · Open the student lesson
Classroom resources
Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
SlidesDownload Present from the browser, or export to PowerPoint or PDF.
WorksheetDownload Print the student copy; the Teacher edition has the answers.
Students will be able to
I can add binary numbers in columns, with carries.
I can explain what a half adder and a full adder do.
I can build a full adder from gates.
Timing
Predict and Try 7 min · Worked example 10 min · Vary 10 min · Practise and Make 18 min
Before class
Try the boards yourself.
The one idea: one column of an addition is a small truth table (sum and carry), so gates can add. Students have met the half adder in Data representation's logic gates lesson; here they build it and then go further.
Column addition in base ten first helps: 5 + 5 writes 0 and carries 1, exactly like 1 + 1 in binary.
The 4-bit adder on the board is drawn as full adder boxes; the gates inside each box are the ones students build in the Make.
Running the lesson
Predict: students who chose 2 hold Sam's misconception.
Try: ask which gate makes the carry and why.
Worked example: write the carries above the columns, as in base ten.
Vary: after overflow, ask where the fifth bit would have to go.
Make: let students reuse the first XOR for the carry; compare gate counts.
The hard part (on purpose)
The full adder Make is hard on purpose: it is the first circuit with three inputs and two outputs. Point at the wanted columns and let students build the sum first, then the carry.
When students get stuck
What you will see
A question to ask
The fix
A student writes 2 in a binary sum (Sam's mistake).
Which digits can binary use?
1 + 1 = 10: write 0, carry 1.
A student's full adder sum is right but the carry is wrong.
Which rows need a carry? How many 1s does each have?
Two or more 1s: (A AND B) OR ((A XOR B) AND CIN).
Answers to the checks
1 + 1: In binary, what is 1 + 1? 10 (two): write 0 in this place and carry 1 to the next, just as 5 + 5 in base ten writes 0 and carries 1.
Try: build a half adder: Build the half adder: S (sum) and C (carry) for two bits. Every row should match.
Sum = A XOR B, carry = A AND B. The last row, 1 + 1, gives S 0 and C 1: binary 10.
Place by place: Add 0110 + 0011 (6 + 3) the same way. What is the sum, in four bits? 1001 Ones: 0 + 1 = 1. Twos: 1 + 1 = 0, carry 1. Fours: 1 + 0 + carry 1 = 0, carry 1. Eights: 0 + 0 + carry 1 = 1. 1001 = 9.
Find the mistake: Sam adds 0101 and 0011. Click the line where it first goes wrong. line 2 Line 2: binary has no digit 2. 1 + 1 = 10: write 0, carry 1. The answer is 1000 (8).
Why three inputs?: A half adder adds two bits. Why does a full adder need three inputs? It also adds the carry coming in from the place to its right Every place except the first may get a carry from the right: A + B + carry in.
No carry: Set A = 9 and B = 6. Does any place carry?
1001 + 0110 = 1111: each place has only one 1, so nothing carries. 15.
One carry: Find two numbers whose sum has exactly one carry, and still fits in four bits.
For example 1 + 1: the ones place carries into the twos, and that is all.
Overflow: Now make the last carry fall off the end: a sum that needs a fifth bit.
Overflow: four bits hold up to 15, so the sum needs another bit. In an 8-bit register, 255 + 1 gives 0 with a carry.
Every place: Make every place carry.
For example 15 + 1: the carry ripples through every place, like 9999 + 1 in base ten. Rippling takes time, so real processors use tricks to look ahead.
How many adders?: How many full adders does a processor need to add two 8-bit numbers in one go? 8: one for each place One full adder per place, side by side. (The first can be a half adder: nothing carries into it.)
Review: overflow: Review: an 8-bit register holds 255. You add 1. What does it hold? 0, and a carry falls off the end 11111111 + 1 = 100000000: the ninth bit has nowhere to go, so the register holds 0. That is overflow.
build a full adder: Build a full adder: inputs A, B and the carry in (CIN); outputs SUM and CARRY. Every row should match.
Five gates: two XORs for the sum, two ANDs and an OR for the carry. Line up four of these and you have the 4-bit adder from the board.
Solutions
One possible solution for each task. Other correct programs are fine.
Vary: carries › No carry
Open task: any program that does what the step asks.
Vary: carries › One carry
Open task: any program that does what the step asks.
Vary: carries › Overflow
Open task: any program that does what the step asks.
Vary: carries › Every place
Open task: any program that does what the step asks.
build a full adder
Open task: any program that does what the step asks.
Stretch and support
Stretch: Subtraction: look up two's complement. How could the same adder subtract?
Support: A column-addition frame with a carry row above, for binary.
Exit ticket
Add 0110 + 0101 in binary. Which places carried?
1011 (11). Only the fours place carried (1 + 1 = 10).
What each step is for
1 + 1: Committing to what 1 + 1 is in binary tests the new move, a sum bit and a carry bit, before students build it.
Try: build a half adder: Building the adder for one place settles the prediction: the A = 1, B = 1 row gives sum 0, carry 1.
Worked example: 5 + 7 in four bits: Adding 0101 + 0111 place by place, carries passed left, models the new move. Sam writes a 2, the misconception planted after the method.
Vary: carries: Each task changes one thing about the carries: none, exactly one, one that falls off the end (overflow), then a carry in every place.
adders: Adding and counting adders without the board is the same move in mixed forms, plus a review of overflow.
build a full adder: Building a full adder from its truth table reverses the process: from the sum and carry wanted to the gates that make them.
Where it leads
Next: Remembering a bit (latches and registers).
Links: Data representation › Bits all the way down (overflow); Inside a computer (the processor's speed).