Exercise 5.2: Half and Full Adders

You are not logged in.

Please Log In for full access to this page.

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

Figure 1: The Half Adder Circuit. The XOR gate generates the Sum, and the AND gate generates the Carry.

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.
Figure 2: Example of the completed Half Adder circuit.

Test your circuit. When you turn BOTH switches ON (1 + 1), what should the LEDs show?

Submission

Upload a short video (10 seconds) showing your Half Adder working. Toggle the switches through all combinations (00, 01, 10, 11) to show the LEDs responding correctly.
 No file selected

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.

  1. Stage 1 (First Half Adder): We add the main inputs A and B.
    • This gives us a Partial Sum and a Partial Carry.
  2. 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.
  3. 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

Figure 3: The Full Adder Circuit. Notice the structure: The first XOR/AND pair is the first Half Adder. The second XOR/AND pair is the second Half Adder. The OR gate combines the carries.

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.
Figure 4: Example of the completed Full Adder circuit.

Set your switches to A=1, B=1, and Cin=1. What is the result?

Submission

Upload a short video (15 seconds) showing your Full Adder. Specifically demonstrate the case where A, B, and Cin are ALL ON, showing that both LEDs light up.
 No file selected