Half adder
Adding two bits
A half adder adds two single bits and produces a Sum (their XOR) and a Carry (their AND). It is the first arithmetic circuit, built directly from the logic gates you already have.
Build it in the lab →At the end of the XOR lesson you saw the punchline: the sum of two bits is
A XOR B and the carry is A AND B. This lesson cashes that in. You will place one XOR and one AND, both from your library, and you have built arithmetic.The job: add two one-bit numbers. The catch is that
1 + 1 = 2, and 2 does not fit in one bit. So the result needs two output bits: a Sum bit for the low-order result and a Carry bit for the overflow into the next column, exactly as you carry a 1 when adding on paper.| A | B | S | C |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
S is the low bit of A+B; C is the high bit (the carry out).Read the last row as binary:
1 + 1 = 10 (two). S = 0 is the low bit, C = 1 is the high bit. The carry is not an error; it is simply how binary addition overflows into the next column.Recognizing the gates
Compare each output column with truth tables you already know.
S is 1 exactly when the inputs differ, which is XOR. C is 1 only when both inputs are 1, which is AND. So a half adder is nothing more than an XOR and an AND driven by the same two inputs.- Place an XOR part and an AND part on the canvas.
- Run a wire from input
Ato the top pin of XOR and the top pin of AND. - Run a wire from input
Bto the bottom pin of XOR and the bottom pin of AND. - Label the XOR output
Sand the AND outputC.
S = A ⊕ B
C = A ∧ B
A and B. Open it in the lab and add the four combinations by hand.Notice that
A and B each fan out into two gates, the branching you met in wires and nets. Start a new wire segment from any point on an existing wire to split a signal.Try it
Add
1 + 1 on the half adder. Read the result as a 2-bit binary number C S. What value is that, and why is the carry not an error?Answer
1 + 1: S = 1 XOR 1 = 0 and C = 1 AND 1 = 1. Read C S together: 10 in binary, which is 2, the correct sum. The carry is the high bit of a 2-bit answer, exactly the 1 you carry into the next column when adding on paper. 1 + 1 = 2 simply does not fit in one bit.The half adder only handles the rightmost column of an addition, where nothing is carried in. To add real multi-bit numbers, every other column also needs a carry-*in*. Teaching it that third input is the full adder, and a row of those is the adder inside your CPU.
Frequently asked
What is a half adder?
A half adder adds two single bits and produces two outputs: a Sum (
S = A XOR B) and a Carry (C = A AND B). It is the simplest arithmetic circuit.Which gates make a half adder?
Just one XOR gate for the Sum and one AND gate for the Carry, both driven by the same two inputs
A and B.What is the difference between a half adder and a full adder?
A half adder adds only two bits, so it has no way to take a carry coming in from a previous column. A full adder adds three bits (two operands plus a carry-in), which is what lets you chain them to add multi-bit numbers.
Why does a half adder need a carry output?
Because
1 + 1 = 2, which does not fit in one bit. Read as binary, 1 + 1 = 10: the Sum bit is the low 0 and the Carry bit is the high 1 that overflows into the next column.You've got the theory. Now build it from scratch and watch it work.
Build it in the lab →Builds towardFull adder