Home
LogicRoo / Combinational Gates / Comparator - Truth Table, Boolean Expression & Logic Circuit | Logicroo
Digital Comparator

Comparator - Truth Table, Boolean Expression & Logic Circuit | Logicroo

Learn about Digital Comparators with interactive circuit diagrams, truth tables, Boolean expressions, comparison logic, logic gate implementation, and digital logic examples.

1-Bit Comparator

Digital Comparator

A magnitude comparator decides whether A is greater than, less than, or equal to B. EQ = A XNOR B (the bits match), GT = A·B′ (A is a 1 where B is a 0), and LT = A′·B (A is a 0 where B is a 1). Exactly one of the three outputs is ever high — chaining these stages (with priority logic on the equal output) lets you compare multi-bit numbers MSB to LSB.

Inputs
A > B
0
A < B
0
A = B
1
Delay
D = A ⊕ B, A′, B′ (1 gate delay — XOR, NOT, NOT)
EQ = D′, GT = A·B′, LT = A′·B (2 gate delay — NOT, AND, AND)
Exactly one of EQ, GT, LT is high for any input pair.
Truth table
ABGTLTEQ