LogicLab

1-bit comparator

A digital comparator tells you whether one binary number is less than, equal to, or greater than another.

Circuit diagram of the 1-bit comparator

Open this circuit in LogicLab →

Boolean expressions

Truth table

ABA<BA=BA>B
00010
01100
10001
11010

How it works

For one bit, A is greater when A is 1 and B is 0, less when A is 0 and B is 1, and equal when the bits match (an XNOR). Exactly one of the three outputs is 1 at any time.

Try it yourself

Compares two bits and lights exactly one of A<B, A=B or A>B. Open the circuit, click the switches to change the inputs, and watch the LEDs and the waveform panel respond. You can edit the circuit, convert it to NAND-only or NOR-only gates, and save or export your version.

Related circuits

Reference: en.wikipedia.org/wiki/Digital_comparator