A comparator is a digital logic circuit. It compares two binary numbers and gives a single output for each combination depends on three conditions.

Comparator


Conditions


  1. Inputs are equal
  2. The first input is less than the second one
  3. The first input is greater than the second one


Comparator


1-bit comparator



Comparator


1-bit comparator is a comparator for a single bit.
Here for 3 conditions equations will be like these,

X(A>B) = AB̄

Y(A=B) = ĀB̄ + AB

Z(A<B) = ĀB

From these conditions, we will get the logic circuit as given below.


A truth table for 1-bit comparator



A
B
A>B
A=B
A<B
0
0
0
1
0
0
1
0
0
1
1
0
1
0
0
1
1
0
1
0

Read about different logical gates.