CIE AS & A Level Computer Science, section 15.2 (Boolean algebra and logic circuits)
Half adder
A half adder adds two single bits, A and B. It gives a sum (S) and a carry (C).
| A | B | S | C |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
An XOR gate gives the sum and an AND gate gives the carry.
Full adder
A half adder cannot accept a carry in. A full adder adds A, B and a carry-in (C_in), giving a sum and a carry-out.
It is built from two half adders and an OR gate: the first half adder adds A and B, the second adds its sum to C_in, and the OR gate combines the two carries.
Adding multi-bit numbers
To add two n-bit numbers, join n full adders in a row: the carry-out of each becomes the carry-in of the next (the first can be a half adder). This is a ripple carry adder, and it is slow because each stage waits for the previous carry.
Common mistake: using only a half adder for the middle bits of a number. A bit position other than the first can receive a carry, so it needs a full adder. Also, the sum is XOR, not OR.
Exam tip: give the truth table with the correct S and C columns. For a full adder, state it is made of two half adders and an OR gate.
Check yourself
Which gate produces the sum output of a half adder?
An XOR gate.
Why is a full adder needed for most bits?
It accepts a carry in from the previous bit, which a half adder cannot.
What are the outputs when A = 1, B = 1 and Cin = 1 in a full adder?
Sum is 1 and carry-out is 1.