4-Bit Adder from Logic Gates

Build a complete 4-bit binary adder using discrete logic gate ICs—chain full adders to add numbers from 0-15!

Overview

A 4-bit adder can add two 4-bit numbers (0-15) plus an optional carry-in, producing a 5-bit result (0-31). This project chains four full adders together in a ripple-carry configuration. Each full adder's carry-out connects to the next stage's carry-in. This is how arithmetic works inside computer processors—just scaled up to 32 or 64 bits!

Components Needed

  • 1x SN74HC86 IC (XOR)
  • 2x CD4081 IC (AND)
  • 2x SN74LS32 IC (OR)
  • 5x LED
  • manyx Wires

Instructions

  1. Gather Your Components

    This project requires multiple ICs: one SN74HC86 (contains 4 XOR gates), two CD4081 (8 AND gates total), and two SN74LS32 (8 OR gates total). You'll also need 5 LEDs, lots of wires, and ideally the 4-bit switch tool from a previous project.

  2. Reference: 4-Bit Switch Tool

    For convenient input, use the 4-bit logic switch tool from a previous project. It provides two rows of 4 switches each, giving you easy control over both 4-bit input numbers.

  3. Reference: BCD 7-Segment Display (Optional)

    To see results as decimal numbers instead of binary LEDs, you can connect the output to the BCD 7-segment display project. This makes it much easier to verify your additions!

  4. Wire the 4-Bit Adder

    Build four full adder stages. Connect them in series: carry-out of bit 0 goes to carry-in of bit 1, and so on. The carry-out of bit 3 becomes the 5th output bit (LED). Each full adder needs: 2 XOR gates, 2 AND gates, and 1 OR gate.

  5. Connect the Switch Tool

    Connect the 4-bit switch tool to provide inputs. Top row switches are number A (A3,A2,A1,A0), bottom row is number B (B3,B2,B1,B0). Each switch pair feeds one full adder stage.

  6. Test: 0000 + 0000 = 00000

    All switches OFF. Adding 0+0=0. All five LEDs should be OFF.

  7. Test: 0001 + 0000 = 00001

    Top row: 0001 (decimal 1), Bottom: 0000 (decimal 0). Result: 00001 (decimal 1). Only the rightmost LED lights.

  8. Test: 0010 + 0010 = 00100

    Top: 0010 (decimal 2), Bottom: 0010 (decimal 2). Result: 00100 (decimal 4). The third LED lights.

  9. Test: 1011 + 1010 = 10101

    Top: 1011 (decimal 11), Bottom: 1010 (decimal 10). Result: 10101 (decimal 21). Note the 5th bit (carry) is set!

  10. Test: 1111 + 1111 = 11110

    Top: 1111 (decimal 15), Bottom: 1111 (decimal 15). Result: 11110 (decimal 30). Maximum 4-bit addition!

  11. Optional: Add 7-Segment Display

    Connect the 4 sum bits (not the carry) to the BCD 7-segment display to see results in decimal. Note: the display only shows 0-9, so for results above 9, the display shows special characters.

Challenges

  • Build an 8-bit adder by chaining two 4-bit adders
  • Add subtraction by inverting one input and setting initial Cin=1
  • Compare performance to the dedicated SN74LS83 adder IC
  • Design overflow detection for signed number arithmetic