Adding two bits is a truth table: the sum is XOR and the carry is AND, a half adder. A full adder also takes a carry in. One full adder per place, carries passed to the left, adds whole binary numbers.
A processor adds billions of numbers a second, and it is only gates. How do switches add?
Adding in binary works like adding in columns at primary school, with only 0 and 1. Each column is a small truth table, so gates can do it.
Predict: Read the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
Try: Try it on the board and compare the result with your prediction.
Investigate: Work out why it happens, one step at a time.
Modify: Change the problem on purpose and see what happens.
Practise: A few on your own, to check you have it.
Make: Make your own problem using what you have learned. Expect a few tries; that is normal.
Make your prediction first. Help opens once you've locked it in.
PredictRead the problem and decide what you think before you try anything. A wrong guess is fine: it shows you what to look for.
1 + 1
TryTry it on the board and compare the result with your prediction.
Try: build a half adder
Was your prediction right? Look at the last row of the table.
Try it yourselfYour edits are saved in this browser.
Build the half adder: S (sum) and C (carry) for two bits. Every row should match.
Use the board. This ticks when you get there.
InvestigateWork out why it happens, one step at a time.
Worked example: 5 + 7 in four bits
Worked exampleBefore each step, say what you think comes next.
ones: 1+1=10Sum 0, carry 1 to the twos.
twos: 0+1+1=10Sum 0, carry 1 to the fours.
fours: 1+1+1=11Sum 1, carry 1 to the eights.
eights: 0+0+1=1Sum 1, no carry.
0101+0111=11005 + 7 = 12. Each line is one full adder: XOR gates for the sum, AND and OR for the carry.
Now add 6 + 3.
Add 0110 + 0011 (6 + 3) the same way. What is the sum, in four bits?
Sam adds 0101 and 0011. Click the line where it first goes wrong.
ModifyChange the problem on purpose and see what happens.
Vary: carries
Try it yourselfYour edits are saved in this browser.
Set A = 9 and B = 6. Does any place carry?
Use the board. This ticks when you get there.
Find two numbers whose sum has exactly one carry, and still fits in four bits.
Use the board. This ticks when you get there.
Now make the last carry fall off the end: a sum that needs a fifth bit.
Use the board. This ticks when you get there.
Make every place carry.
Use the board. This ticks when you get there.
PractiseA few on your own, to check you have it.
Adders
Add 0011 + 0011 in binary (four bits).
MakeMake your own problem using what you have learned. Expect a few tries; that is normal.
Build a full adder
Then: count the gates in an 8-bit adder built from your full adders.
Try it yourselfYour edits are saved in this browser.
Need a hint?
The sum is 1 when an odd number of the three inputs are on.
Another hint
Sum: XOR A with B, then XOR that with CIN.
Another hint
Carry: (A AND B) OR ((A XOR B) AND CIN). Reuse the first XOR.
Build a full adder: inputs A, B and the carry in (CIN); outputs SUM and CARRY. Every row should match.
Use the board. This ticks when you get there.
For teachers
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). About 45 minutes.
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.
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
A student writes 2 in a binary sum (Sam's mistake). Ask: Which digits can binary use? Fix: 1 + 1 = 10: write 0, carry 1.
A student's full adder sum is right but the carry is wrong. Ask: Which rows need a carry? How many 1s does each have? Fix: Two or more 1s: (A AND B) OR ((A XOR B) AND CIN).
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.
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).
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.