# Digital Comparator

Suppose we have two binary numbers which we have to compare according to their magnitude. One number of these two numbers can either be greater, equal or smaller than the other number. The digital circuit which performs this comparison task between binary numbers is called

When, A = 0 and B = 0, then A = B and E = 1

When, A = 0 and B = 1, then A < B and L = 1

When, A = 1 and B = 0, then A > B and G = 1

When, A = 1 and B = 1, then A = B and E = 1

Now from above table, we get, This circuit can be realized as, As the above can only compare two single bit binary numbers, it is called single bit digital comparator.

The binary number system normally does not use single binary numbers instead it uses multi bit binary numbers which are normally 4 bits and above. So, let us design a 4 bit

Suppose, there are two 4 bit binary numbers, Let us compare those two numbers

Condition (1), when A

Condition (2), when A

Condition (3), when A

Condition (4), when A

**digital comparator**. For understanding better let us consider two single bit binary numbers A and B. The value of A and B either be 0 or 1 and nothing else. Now let us logically design a circuit which will have two inputs one for A and other for B and have three output terminals, one for A > B condition, one for A = B condition and one for A < B condition. Let us name the output terminals G, E and L respectively.We want,

G = 1 (logically 1) when A > B.

B = 1 (logically 1) when A = B.

And

L = 1 (logically 1) when A < B.

If we successfully design this logic circuit, it will confidently compare two single bit binary numbers A, B and gives high state at respective output terminal according to the comparison conditions of A and B.

A | B | G | E | L |

0 | 0 | 0 | 1 | 0 |

0 | 1 | 0 | 0 | 1 |

1 | 0 | 1 | 0 | 0 |

1 | 1 | 0 | 1 | 0 |

When, A = 0 and B = 1, then A < B and L = 1

When, A = 1 and B = 0, then A > B and G = 1

When, A = 1 and B = 1, then A = B and E = 1

Now from above table, we get, This circuit can be realized as, As the above can only compare two single bit binary numbers, it is called single bit digital comparator.

The binary number system normally does not use single binary numbers instead it uses multi bit binary numbers which are normally 4 bits and above. So, let us design a 4 bit

**digital comparator**to get more clear idea of comparator.Suppose, there are two 4 bit binary numbers, Let us compare those two numbers

Condition (1), when A

_{1}> B_{1}i.e. A_{1}= 1 and B_{1}= 0, ⇒ A > B or G = 1.Condition (2), when A

_{1}= B_{1}and A_{2}> B_{2}i.e. A_{2}= 1 and B_{2}= 0 ⇒ A >B or G = 1.Condition (3), when A

_{1}= B_{1}and A_{2}= B_{2}and A_{3}> B_{3}i.e. A_{3}= 1 and B_{3}= 0 ⇒ A >B or G = 1.Condition (4), when A

_{1}= B_{1}, A_{2}= B_{2}, A_{3}= B_{3}and A_{4}> B_{4}i.e. A_{4}= 1 and B_{4}= 0 ⇒ A > B or G = 1. Hence, G = 1 if either of the above equations is true, Similarly, Now, Again when, The logic circuit can be drawn from the above equations (i), (ii) and (iii). This is 4bit digital comparator.## IC of Digital Comparator

The IC available for 4 bit**digital comparator**is IC 7485. For more bit comparison, more than one such ICs can be cascaded. This IC has three terminals, labeled as (A < B)_{in}, (A = B)_{in}and (A > B)_{in}and other three terminals labeled as, as (A < B)_{out}, (A = B)_{out}and (A > B)_{out}. During cascading of two 7485 ICs, (A < B)_{out}, (A = B)_{out}and (A > B)_{out}of lower order IC would be connected to (A < B)_{in}, (A = B)_{in}and (A > B)_{in}of higher order IC, respectively.**Comments/Feedbacks**

Closely Related Articles Binary Adder Half and Full AdderBinary SubstractorSeven Segment DisplayBinary to Gray Code Converter and Grey to Binary Code ConverterBinary to BCD Code ConverterAnalog to Digital ConverterDigital Encoder or Binary EncoderBinary DecoderBasic Digital CounterBCD to Seven Segment DecoderParallel AdderParallel Adder or SubtractorMultiplexerDemultiplexer555 Timer and 555 Timer WorkingLook Ahead Carry AdderMore Related Articles Digital ElectronicsBoolean Algebra Theorems and Laws of Boolean AlgebraDe Morgan Theorem and Demorgans LawsTruth Tables for Digital LogicBinary Arithmetic Binary AdditionBinary SubtractionSimplifying Boolean Expression using K MapBinary DivisionExcess 3 Code Addition and SubtractionK Map or Karnaugh MapSwitching Algebra or Boolean AlgebraBinary MultiplicationParallel SubtractorOR Operation | Logical OR OperationAND Operation | Logical AND OperationLogical OR GateLogical AND GateNOT GateUniversal Gate | NAND and NOR Gate as Universal GateNAND GateDiode and Transistor NAND Gate or DTL NAND Gate and NAND Gate ICsX OR Gate and X NOR GateTransistor Transistor Logic or TTLNOR GateFan out of Logic GatesINHIBIT GateNMOS Logic and PMOS LogicSchmitt GatesLogic Families Significance and Types of Logic FamiliesBinary Number System | Binary to Decimal and Decimal to Binary ConversionBinary to Decimal and Decimal to Binary ConversionBCD or Binary Coded Decimal | BCD Conversion Addition SubtractionBinary to Octal and Octal to Binary ConversionOctal to Decimal and Decimal to Octal ConversionBinary to Hexadecimal and Hex to Binary ConversionHexadecimal to Decimal and Decimal to Hexadecimal ConversionGray Code | Binary to Gray Code and that to Binary ConversionOctal Number SystemDigital Logic Gates2′s Complement1′s ComplementASCII CodeHamming Code2s Complement ArithmeticError Detection and Correction Codes9s complement and 10s complement | SubtractionSome Common Applications of Logic GatesKeyboard EncoderAlphanumeric codes | ASCII code | EBCDIC code | UNICODELatches and Flip FlopsS R Flip Flop S R LatchActive Low S R Latch and Flip FlopGated S R Latches or Clocked S R Flip FlopsD Flip Flop or D LatchJ K Flip FlopMaster Slave Flip FlopRead Only Memory | ROMProgrammable Logic DevicesProgrammable Array LogicApplication of Flip FlopsShift RegistersBuffer Register and Controlled Buffer RegisterData Transfer in Shift RegistersSerial In Serial Out (SISO) Shift RegisterSerial in Parallel Out (SIPO) Shift RegisterParallel in Serial Out (PISO) Shift RegisterParallel in Parallel Out (PIPO) Shift RegisterUniversal Shift RegistersBidirectional Shift RegisterDynamic Shift RegisterApplications of Shift RegistersUninterruptible Power Supply | UPSConversion of Flip FlopsJohnson CounterSequence GeneratorRing CounterNew Articles Principle of Water Content Test of Insulating OilCollecting Oil Sample from Oil Immersed Electrical EquipmentCauses of Insulating Oil DeteriorationAcidity Test of Transformer Insulating OilMagnetic Flux