What is a Digital Comparator and Magnitude Comparator
Nowadays, electronics are completely a part of human life and the whole world observes dramatic progress in the utilization of electronic devices. Providing many advantages, electronics is now so prevalent that it’s almost streamlined to think of the devices that don’t make use of it than that of devices that do. The enhanced trend in electronic technology today allowed us to discuss the widely used devices digital comparator and magnitude comparators. Then after the extensive performance of operational amplifiers, the most widely accepted simple electronic devices are comparators. So, let’s dive deep into the topics of what is a digital comparator, its operation, performance, and applications.
Digital Comparator And Magnitude Comparator
A detailed discussion of digital comparator and magnitude comparator mainly includes the following.
What is Digital Comparator?
As data comparison is mostly required in many digital systems at the time of logical or arithmetic functions, digital comparators are the one best option to compare data. Digital comparators are the most appropriate combinational logic circuits used to compare relative magnitudes of two binary numbers.
The device accepts two binary numbers (A and B)as input and generates an output based on the magnitude of given inputs (example: A=B or A>B or A<B). Digital Comparators are developed through logic gates like AND, NOT or NOR gates. Digital comparators are available as identity comparators and magnitude comparators.
What is Magnitude Comparator?
Magnitude comparators are mostly utilized in microcontrollers and CPUs to address data comparison, register and perform all other arithmetic operations. Magnitude comparators are implemented in many devices and every auto-turn-off device is surely designed using a comparator.
A comparator is a decision-making tool and it holds the ability to be executed in numerous control devices. Accepting two binary numbers as input (A and B), data comparison through magnitude comparators produces the output to indicate equality (A=B), logic 1 in two conditions when (A>B or A<B).
Types of Magnitude Comparators
There are different kinds of magnitude comparators which include the following.
1-bit Magnitude Comparator
A comparator that compares two binary bits and produces three outputs based on the relative magnitudes of given binary bits is called a 1-bit magnitude comparator.
Truth Table
A |
B | A<B | A>B |
A=B |
0 |
0 | 0 | 0 | 1 |
0 |
1 | 1 | 0 |
0 |
1 | 0 | 0 | 1 |
0 |
1 | 1 | 0 | 0 |
1 |
The truth table derives the expressions of A<B, A>B and A=B as below
A<B – A’B
A>B – AB’
A=B – A’B’+AB
With these expressions, the Circuit diagram can be as follows
2-bit Magnitude Comparator
A comparator that compares two binary numbers (each number having 2 bits) and produces three outputs based on the relative magnitudes of given binary bits is called a 2-bit magnitude comparator.
Truth Table
A1 |
A0 | B1 | B0 | A<B | A=B | A>B |
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 truth table derives the expressions of A<B, A>B, and A=B as below
A<B – A1’B1’+ A0’B1B0 + A1’A0’B0
A>B – A1B1’ + A0B1’B0’ + A1A0B0’
A=B – (A0 Ex-Nor B0) (A1 Ex-Nor B1)
With these expressions, the Circuit diagram can be as follows
3-bit Magnitude Comparator
A comparator that compares two binary numbers (each number having 3 bits) and produces three outputs based on the relative magnitudes of given binary bits is called a 3-bit magnitude comparator.
The equal functions are A0 = B0, A1= B1, A2 = B2
Then A=B = (A0’B0’ + A0B0)(A1’B1’ + A1B1)(A2’B2’ + A2B2)
The output is A< B in the cases of
A2<B2
A2 = B2 then A1<B1
A2 = B2, A1 = B1 then A0<B0
A<B = A2’B2 + [(A2’B2’ + A2B2) * A1’B1] + [(A2’B2’ + A2B2) *[(A1’B’ + A1B1) * A0’B0]
The output is A> B in the cases of
A2>B2
A2 = B2 then A1>B
A2 = B2, A1 = B1 then A0>B0
A>B = A2B2’ + + [(A2’B2’ + A2B2) * A1B1’] + + [(A2’B2’ + A2B2) * [(A1’B’ + A1B1) * A0B0’]
4-bit Magnitude Comparator
A comparator that compares two binary numbers (each number having 4 bits) and produces three outputs based on the relative magnitudes of given binary bits is called a 4-bit magnitude comparator.
The input bits can be termed as A = A3 A2 A1 A0 and B = B3 B2 B1 B0
The output is A> B in the cases of
A3 = 1 and B3 = 0
A3 = B3 and A2 = 1, B2 = 0
A3 = B3 and A2= B2 and A1 = 1 and B1 = 0
A3 = B3 and A2= B2 and A1 = B1 and A0 = 1 and B0 = 0
And A>B can be expressed as
A>B = A3B3’ + (A3 Ex-Nor B3) A2B2’ + (A3 Ex-Nor B3) (A2 Ex-Nor B2) A1B1’ + (A3 Ex-Nor B3) (A2 Ex-Nor B2) (A1 Ex-Nor B1) A0B0’
While
A<B = A3‘B3 + (A3 Ex-Nor B3) A2’B2 + (A3 Ex-Nor B3) (A2 Ex-Nor B2) A1’B1 + (A3 Ex-Nor B3) (A2 Ex-Nor B2) (A1 Ex-Nor B1) A0’B0
And similarly, A=B can be expressed as
A=B = (A3 Ex-Nor B3) (A2 Ex-Nor B2) (A1 Ex-Nor B1)(A0 Ex-Nor B0)
With these expressions, the Circuit diagram can be as follows.
Mostly, 4-bit comparators are in the form of IC’s and the IC 7485 is widely used. Data comparison can be performed by grounding A>B, A<B and A+B inputs to the Vcc terminal. Furthermore, this integrated circuit performs a cascading operation where it helps for cascading multiple comparators.
8-bit Magnitude Comparator
Here, data comparison is possible through the cascading of two 4-bit comparators. The circuit is connected as below
The outputs of the lower-order comparator are connected to the corresponding cascading inputs of the higher-order comparator
In the lower order comparator, the cascading input (A=B) needs to be connected HIGH, and A, B needs to be connected to LOW. The result of the 8-bit comparator is the output of the higher-order comparator.
Applications Comparator
Digital comparator and magnitude comparator is used in different applications where data comparison is mostly required in many of the activities, and these hold many benefits too.
- Now, look into few of the applications of comparators
- Used for authorization purposes (such as password management) and biometric applications.
- These are implemented in process controllers and also in servo motor controls.
- Implemented for the data comparison of variables like temperature, the pressure is compared with that of reference values.
- Used to address decoding circuitry in computers.
Thus, this is all about digital comparator and magnitude comparator. So, the augmented performance of comparators allowed these devices to gain more prominence in the electronics industry and let them be implemented in many applications.