Magnitude Comparator

In this article you will learn about magnitude comparator. 1 Bit & 2 Bit comparators with truth table and circuit diagram.

Magnitude Comparator

A combinational circuit that compares two digital or binary numbers and compare them in the form of A < B, A = B & A > B is known as magnitude comparator. A Magnitude comparator is also known as digital comparator.

1 Bit Magnitude Comparator

A magnitude comparator that compares two bits is known as 1 bit comparator. It consist of two inputs ( A & B ) each of 1 bit and has three outputs. The three outputs are A is less than B ( A < B ) , A is equal to B ( A = B ) and A is greater than B ( A > B ).

1 Bit Comparator Truth Table

A

B

A<B

A=B

A>B

     

0

0

0

1

0

1

0

0

0

1

0

1

1

0

0

1

1

0

1

0

Output Expression

The output expression is written in SOP form ( A = 1 & A’ = 0 ), similarly ( B = 1 & B’ = 0 ).

The output is written only when logic 1 is obtained in the output.

Expression for A < B

Y = A’B

Expression for A = B

Y = A’B’ + AB

Expression for A > B

Y = AB’

2 bit Magnitude Comparator

A magnitude comparator that compares two bits, each of two bit is known as two bit comparator. It consist of four inputs ( A1, A0 & B1, B0 ) each of 1 bit and has three outputs. The three outputs are A is less than B ( A < B ) , A is equal to B ( A = B ) and A is greater than B ( A > B ).

2 Bit Comparator Truth Table

A

B

A<B

A=B

A>B

A1

A0

B1

B0

   
       

0

0

0

0

0

1

0

0

0

0

1

1

0

0

0

0

1

0

1

0

0

0

0

1

1

1

0

0

0

1

0

0

0

0

1

0

1

0

1

0

1

0

0

1

1

0

1

0

0

0

1

1

1

1

0

0

1

0

0

0

0

0

1

1

0

0

1

0

0

1

1

0

1

0

0

1

0

1

0

1

1

1

0

0

1

1

0

0

0

0

1

1

1

0

1

0

0

1

1

1

1

0

0

0

1

1

1

1

1

0

1

0

The above comparison is done on the basis of weight. Here, A1 & B1 has weight 2 and A2 & B2 has weight 1.

Lets take example of 6 and 9 and compare them

A1

A0

B1

B0

    

0

1

1

0

1

0

0

1

In BCD, 6 A0 has weight 1 and B1 has weight 2. So, B will be greater than A.

In BCD, 9 A1 has weight 2 and B0 has weight 1. So, A will be greater than B.

Output Expression

The output expression is written in SOP form ( A = 1 & A’ = 0 ), similarly ( B = 1 & B’ = 0 ).

The output is written only when logic 1 is obtained in the output.

K Map for A < B

Expression for A < B

Y = A1’B1 + A1’A0’B0 + A0’B1B0

K Map for A = B

Expression for A = B

Y = A1’A0’B1’B0’ + A1’A0B1’B0 + A1A0B1B0 + A1A0’B1B0

K Map for A > B

2 bit magnitude comparator

Expression for A > B

Y = A1B1’ + A0B1’B0’ + A1A0B0

Application of Magnitude Comparator

  1. Magnitude comparators are used in CPU’s ( Central Processing Unit ) and MCU’s ( Microcontrollers ).
  2. It is used in servo motor control.
  3. Used in biometric applications and password verifications.

Author

Akash Sharma

Share This Post

3 thoughts on “Magnitude Comparator”

Leave a Comment