Binary Comparators using Logic Gates

Binary comparators are logic gates circuit used to compare two binary inputs. There are two types of binary comparators:

  • Equality Comparators are used to check if the two binary inputs (A and B) are equal or not.
  • Magnitude Comparators are used to fully compare two binary inputs A and B and produce three possible outpus if A>B, A==B or A

On this post we will focus on Magnitude Operators. You can use this link to find out more about Equality Comparators.

1-bit Magnitude Comparator

A 1-bit magnitude operator compare two 1-bit inputs A and B and is based on the following Truth Table:
And here is the logic gates diagram for this circuit:

1-bit Magnitude Comparator Logic Gates Diagram

1-bit Magnitude Comparator Logic Gates Diagram

4-bit Magnitude Comparator

We can now combine several of the above diagrams to create a 4-bit magnitude comparator as follows:

8-bit Magnitude Comparator

We can then combine two 4-bit magnitude comparators to create an 8-bit magnitude comparator. The first 4-bit-comparator will compare the 4 most significant digits whereas the second will focus on the 4 least significant digits.

Share Button
Tagged with: