Digital Comparator
   HOME

TheInfoList



OR:

A digital comparator or magnitude comparator is a hardware electronic device that takes two numbers as input in
binary Binary may refer to: Science and technology Mathematics * Binary number, a representation of numbers using only two digits (0 and 1) * Binary function, a function that takes two arguments * Binary operation, a mathematical operation that ta ...
form and determines whether one number is greater than, less than or equal to the other number. Comparators are used in
central processing unit A central processing unit (CPU), also called a central processor, main processor or just Processor (computing), processor, is the electronic circuitry that executes Instruction (computing), instructions comprising a computer program. The CPU per ...
s (CPUs) and microcontrollers (MCUs). Examples of digital comparator include the CMOS 4063 and 4585 and the TTL 7485 and 74682. An
XNOR gate The XNOR gate (sometimes XORN'T, ENOR, EXNOR or NXOR and pronounced as Exclusive NOR. Alternatively XAND, pronounced Exclusive AND) is a digital logic gate whose function is the logical complement of the Exclusive OR ( XOR) gate. It is equival ...
is a basic comparator, because its output is "1" only if its two input bits are equal. The
analog Analog or analogue may refer to: Computing and electronics * Analog signal, in which information is encoded in a continuous variable ** Analog device, an apparatus that operates on analog signals *** Analog electronics, circuits which use analog ...
equivalent of digital comparator is the voltage comparator. Many microcontrollers have analog comparators on some of their inputs that can be read or trigger an
interrupt In digital computers, an interrupt (sometimes referred to as a trap) is a request for the processor to ''interrupt'' currently executing code (when permitted), so that the event can be processed in a timely manner. If the request is accepted, ...
.


Implementation

Consider two 4-bit binary numbers A and B so A=A_3A_2A_1A_0 B=B_3B_2B_1B_0 Here each subscript represents one of the digits in the numbers. ;Equality The binary numbers A and B will be equal if all the pairs of significant digits of both numbers are equal, i.e., A_3=B_3, A_2=B_2, A_1=B_1 and A_0=B_0 Since the numbers are binary, the digits are either 0 or 1 and the boolean function for equality of any two digits A_i and B_i can be expressed as x_i= A_i B_i + \overline_i \overline_i we can also replace it by
XNOR The XNOR gate (sometimes XORN'T, ENOR, EXNOR or NXOR and pronounced as Exclusive NOR. Alternatively XAND, pronounced Exclusive AND) is a digital logic gate whose function is the logical complement of the Exclusive OR ( XOR) gate. It is equival ...
gate in
digital electronics Digital electronics is a field of electronics involving the study of digital signals and the engineering of devices that use or produce them. This is in contrast to analog electronics and analog signals. Digital electronic circuits are usual ...
. x_i is 1 ''only if'' A_i and B_i are equal. For the equality of A and B, all x_i variables (for i=0,1,2,3) must be 1. So the equality condition of A and B can be implemented using the
AND or AND may refer to: Logic, grammar, and computing * Conjunction (grammar), connecting two words, phrases, or clauses * Logical conjunction in mathematical logic, notated as "∧", "⋅", "&", or simple juxtaposition * Bitwise AND, a boolea ...
operation as (A=B) = x_3x_2x_1x_0 The binary variable (A=B) is 1 only if all pairs of digits of the two numbers are equal. ;Inequality In order to manually determine the greater of two binary numbers, we inspect the relative magnitudes of pairs of significant digits, starting from the
most significant bit In computing, bit numbering is the convention used to identify the bit positions in a binary number. Bit significance and indexing In computing, the least significant bit (LSB) is the bit position in a binary integer representing the binar ...
, gradually proceeding towards lower significant bits until an inequality is found. When an inequality is found, if the corresponding bit of A is 1 and that of B is 0 then we conclude that A>B. This sequential comparison can be expressed logically as: (A>B)=A_3 \overline_3+x_3 A_2 \overline_2+x_3 x_2 A_1 \overline_1+x_3x_2x_1 A_0 \overline_0 (A (A>B) and (A < B) are output binary variables, which are equal to 1 when A>B or A


See also

*
List of LM-series integrated circuits The following is a list of LM-series integrated circuits. Many were among the first analog integrated circuits commercially produced since late 1965; some were groundbreaking innovations. As of 2007, many are still being used. The LM series orig ...
*
4000 series The 4000 series is a CMOS logic family of integrated circuits (ICs) first introduced in 1968 by RCA. It had a supply voltage range of 5V to 20V, which is much wider than any contemporary logic family. Almost all IC manufacturers active during th ...
,
List of 4000 series integrated circuits The following is a list of CMOS 4000-series digital logic integrated circuits. In 1968, the original 4000-series was introduced by RCA. Although more recent parts are considerably faster, the 4000 devices operate over a wide power supply range ...
*
7400 series The 7400 series of integrated circuits (ICs) are a popular logic family of transistor–transistor logic (TTL) logic chips. In 1964, Texas Instruments introduced the SN5400 series of logic chips, in a ceramic semiconductor package. A lo ...
,
List of 7400 series integrated circuits The following is a list of 7400-series digital logic integrated circuits. In the mid-1960s, the original 7400-series integrated circuits were introduced by Texas Instruments with the prefix "SN" to create the name SN74xx. Due to the popularity o ...
*
Sorting network In computer science, comparator networks are abstract devices built up of a fixed number of "wires", carrying values, and comparator modules that connect pairs of wires, swapping the values on the wires if they are not in a desired order. Such net ...


External links


Digital Comparators by Texas Instruments
Digital circuits