Exercise 5.2: Half and Full Adders
Welcome to Exercise 5.2! In this exercise, you will build circuits that can perform binary addition. By the end of this session, you will have moved from adding single bits to building a complex 4-bit calculator using nothing but basic logic gates.
1) The Half Adder
To start us off, let's explore the simplest addition circuit: the Half Adder. This circuit adds two single binary digits (Input A and Input B) and produces a Sum and a Carry.
Theory and Derivation
How do we decide which gates to use? We look at the Truth Table for adding two bits:
| Input A | Input B | Sum | Carry |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 1 |
- Sum Logic: The Sum is HIGH (1) only when the inputs are different (0+1 or 1+0). This is the exact behavior of an XOR Gate.
- Equation: S = A \oplus B
- Carry Logic: The Carry is HIGH (1) only when both inputs are HIGH (1+1). This is the exact behavior of an AND Gate.
- Equation: C = A \cdot B
Circuit Diagram
Build the Circuit
Let's connect this on your breadboard!
1. Place a 7486 (XOR) chip and a 7408 (AND) chip on the breadboard.
2. Connect VCC (Pin 14) to 5V and GND (Pin 7) to Ground for both chips.
3. Use a 2xDIP switch to control Input A and Input B.
4. Connect Input A to Pin 1 of both the XOR and AND gates.
5. Connect Input B to Pin 2 of both the XOR and AND gates.
6. Connect the Output of the XOR gate (Pin 3) to an LED (This is your SUM).
7. Connect the Output of the AND gate (Pin 3) to a second LED (This is your CARRY).
8. Connect all your DIP switches in 1kΩ pull down configuration, with bottom pins being constant High (5v).
9. Connect LEDs to ground through a 220Ω resistor.
10. Turn Power ON.
Submission
2) The Full Adder
The Half Adder is useful, but it cannot handle a "carry-in" from a previous addition. To add larger numbers, we need the Full Adder, which adds three inputs: A, B, and C_{in} (Carry In).
Theory: Combining Half Adders
We don't need to memorize a complex new circuit. A Full Adder is literally just two Half Adders chained together with a little glue logic.
- Stage 1 (First Half Adder): We add the main inputs A and B.
- This gives us a Partial Sum and a Partial Carry.
- Stage 2 (Second Half Adder): We take that Partial Sum and add it to the Carry In (C_{in}).
- This gives us our Final Sum.
- Stage 3 (Carry Logic): If either Stage 1 or Stage 2 produces a carry, we need to output a carry.
- We use an OR Gate to combine the Partial Carry from Stage 1 and the carry from Stage 2.
Logic Equations:
- Sum = (A \oplus B) \oplus C_{in}
- Carry_{out} = (A \cdot B) + (C_{in} \cdot (A \oplus B))
Circuit Diagram
Build the Circuit
Now, expand your circuit to be a Full Adder.
1. Place a 7486 (XOR) chip, a 7408 (AND) chip and a 7432 (OR) chip on your breadboard.
2. Build two seperate Half Adder with those logic gates, with no inputs or outputs connected for now.
3. Connect the first Half Adder input like before to Input A & B of the 4xDIP switch.
4. Connect the Sum output of the first Half Adder into the input of a second Half Adder.
5. Connect the third switch (Cin) to the other input of the second Half Adder.
6. Connect the Sum output of second Half Adder to the Sum LED.
7. Connect the Carry outputs of both Half Adder into the OR gate.
8. Connect the final OR output to the Carry LED.
9. Connect all your DIP switches in 1kΩ pull down configuration, with bottom pins being constant High (5v).
10. Connect LEDs to ground through a 220Ω resistor.
11. Turn Power ON.
Submission