1-Bit Greater Than Comparator

Build a 1-bit "greater than" comparator using a NOT gate and an AND gate—detect when input A is greater than input B!

Overview

The "greater than" comparator is the mirror image of the "less than" comparator. For single bits, A > B is true only when A=1 and B=0. This is expressed as A AND NOT(B)—we invert B instead of A. Building both less-than and greater-than comparators shows how swapping which input gets inverted changes the comparison direction. Together with the equality comparator, these three circuits form the complete set of comparison operations.

Components Needed

  • 1x SN74HC04 IC (Hex Inverter)
  • 1x CD4081 IC (Quad AND)
  • 2x Switch
  • 1x LED
  • severalx Wires

Instructions

  1. Gather Your Components

    Collect the SN74HC04 hex inverter IC, the CD4081 quad AND gate IC, two switches (left for A, right for B), one LED, wires, breadboard, and 5V power supply. These are the same components as the less-than comparator—only the wiring changes.

  2. Identify the SN74HC04 Inverter IC

    The SN74HC04 contains six independent NOT gates. This time we'll use one inverter to create NOT(B) instead of NOT(A). Pin 1 is input, Pin 2 is output for the first inverter.

  3. Identify the CD4081 AND Gate IC

    The CD4081 contains four 2-input AND gates. We'll feed A and NOT(B) into one AND gate. The output will be HIGH only when A=1 and B=0.

  4. Wire the Greater Than Comparator

    Place both ICs on the breadboard and connect power. Wire the right switch (B) to an inverter input on the 74HC04. Connect the left switch (A) directly and the inverter output (NOT B) to an AND gate on the CD4081. Connect the AND gate output to the LED. The LED lights when A > B.

  5. Test: A=0, B=0 → LED OFF (0 is not > 0)

    Both switches OFF. A=0 and B=0, so A is not greater than B. A=0, so AND(0, anything)=0. LED is OFF.

  6. Test: A=0, B=1 → LED OFF (0 is not > 1)

    Left switch (A) OFF, right switch (B) ON. A=0, so the AND gate output is 0 regardless. LED stays OFF.

  7. Test: A=1, B=0 → LED ON (1 > 0)

    Left switch (A) ON, right switch (B) OFF. A=1 and B=0, so A IS greater than B! A=1, NOT(B)=NOT(0)=1, AND(1,1)=1. The LED turns ON—this is the only case where A > B for single bits.

  8. Test: A=1, B=1 → LED OFF (1 is not > 1)

    Both switches ON. A=1 and B=1. NOT(B)=NOT(1)=0, so AND(1,0)=0. LED is OFF—equal values are not greater than each other. All four combinations verified!

Challenges

  • Compare this circuit side-by-side with the less-than comparator—notice the symmetry!
  • Combine all three comparators (less, equal, greater) into one circuit with 3 LEDs
  • Extend to 2-bit comparison by handling the most significant bit first
  • Design a circuit that lights one of three LEDs based on the comparison result