SlideShare una empresa de Scribd logo
1 de 11
MAGNITUDE COMPARATOR
PREET PATEL
AIIE
ANALOG ELECTRONICS
Magnitude Comparator
• A magnitude digital comparator is a combinational circuit that compares two
digital or binary numbers (consider A and B) and determines their relative
magnitudes in order to find out whether one number is equal, less than or greater
than the other digital number.
• Three binary variables are used to indicate the outcome of the comparison as A>B,
A<B, or A=B. The below figure shows the block diagram of a n-bit comparator
which compares the two numbers of n-bit length and generates their relation
between themselves.
Magnitude comparator is a combinational circuit that compares two numbers and determines their
relative magnitude. A comparator is shown as Figure 2.1. The output of comparator is usually 3
binary variables indicating:
A>B
A=B
A<B
LOGIC DESIGN PROCEDURE
A>B
A=B
A<B
Comparator
A
B
For a 2-bit comparator, we have four inputs A1A0 and B1B0 and three outputs:
E (is 1 if two numbers are equal)
G (is 1 when A > B) and
L (is 1 when A < B)
G(A>B)
E(A=B)
L(A<B)
Comparator
A1
B1
A0
B0
LOGIC DESIGN FOR 2-BIT COMPARATOR
If we use truth table and K-MAP, the result is
E= A’1A’0B’1B’0 + A’1A0B’1B0 + A1A0B1B0 + A1A’0B1B’0
or
E=(( A0 ⊕ B0) + ( A1 ⊕ B1))’
G = A1B’1 + A0B’1B’0 + A1A0B’0
L= A’1B1 + A’1A’0B0 + A’0B1B0
Here we use simpler method to find E (called X) and G (called Y) and L (called Z)
CASE 1: A=B if all Ai= Bi
It means X0 = A0B0 + A’0B’0 and
X1= A1B1 + A’1B’1
If X0=1 and X1=1 then A0=B0 and A1=B1
Thus, if A=B then X0X1 = 1 it means
X= (A0B0 + A’0B’0)(A1B1 + A’1B’1)
since (x ⊕ y)’ = (xy +x’y’)
X= ( A0⊕B0)’ ( A1⊕B1)’ = (( A0 ⊕ B0) + ( A1 ⊕ B1))’
It means for X we can NOR the result of two exclusive-OR gates.
RESULT
Ai Bi Xi
0 0 1
0 1 0
1 0 0
1 1 0
CASE 2: A>B
means
If A1=B1 (X1=1) then A0 should be 1 and B0 should be 0
For A> B: A1 > B1 or
A1 =B1 and A0 > B0
It means Y= A1B’1 + X1A0B’0 should be 1 for A> B.
CASE 3: For B>A : B1 > A1
A1=B1 and B0> A0
Z= A’1B1 + X1A’0B0
A1 B1 Y1
0 0 0
0 1 0
1 0 1
1 1 0
A0 B0 Y0
0 0 1
0 1 0
1 0 0
1 1 0
4-BIT COMPARATOR
The procedure for binary numbers with
more than 2 bits can also be found in the
similar way. Figure shows the 4-bit
magnitude comparator.
Input: A=A3A2A1A0
B=B3B2B1B0
A3
B3
x3
A2
B2
x2
A1
B1
x1
A0
B0
x0
(A<B)
(A>B)
(A=B)
4-Bit Magnitude Comparator
CASE 1: A=B
A3=B3, A2=B2, A1=B1, A0=B0
xi = AiBi + Ai’Bi’
XOR-Invert = (AiBi’+Ai’Bi)’
= (Ai’+Bi)(Ai+Bi’)
= Ai’Ai + Ai’Bi’ + AiBi + BiBi’
= AiBi + Ai’Bi’
Output: X3X2X1X0
CASE 2: A>B
Output: A3B’3 + X3A2B’2 + X3X2A1B’1+ X3X2X1A0B’0
CASE 3: A<B
Output: A’3B3 + X3A’2B2 + X3X2A’1B1+ X3X2X1A’0B0
Truth table of 4-Bit Comparator
COMPARING INPUTS OUTPUT
A3, B3 A2, B2 A1, B1 A0, B0 A > B A < B A = B
A3 > B3 X X X H L L
A3 < B3 X X X L H L
A3 = B3 A2 >B2 X X H L L
A3 = B3 A2 < B2 X X L H L
A3 = B3 A2 = B2 A1 > B1 X H L L
A3 = B3 A2 = B2 A1 < B1 X L H L
A3 = B3 A2 = B2 A1 = B1 A0 > B0 H L L
A3 = B3 A2 = B2 A1 = B1 A0 < B0 L H L
A3 = B3 A2 = B2 A1 = B1 A0 = B0 H L L
A3 = B3 A2 = B2 A1 = B1 A0 = B0 L H L
A3 = B3 A2 = B2 A1 = B1 A0 = B0 L L H
H = High Voltage Level, L = Low Voltage, Level, X = Don’t Care
Applications of Comparators
• These are used in the address decoding circuitry in computers and microprocessor based
devices to select a specific input/output device for the storage of data.
• These are used in control applications in which the binary numbers representing physical
variables such as temperature, position, etc. are compared with a reference value. Then
the outputs from the comparator are used to drive the actuators so as to make the
physical variables closest to the set or reference value.
• Process controllers
• Servo-motor control
Magnitude comparator

Más contenido relacionado

La actualidad más candente

Decoders
DecodersDecoders
Decoders
Re Man
 
Adder substracter
Adder substracterAdder substracter
Adder substracter
WanNurdiana
 

La actualidad más candente (20)

Encoder and decoder
Encoder and decoderEncoder and decoder
Encoder and decoder
 
multiplexers and demultiplexers
 multiplexers and demultiplexers multiplexers and demultiplexers
multiplexers and demultiplexers
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
 
Combinational circuit
Combinational circuitCombinational circuit
Combinational circuit
 
Latches and flip flop
Latches and flip flopLatches and flip flop
Latches and flip flop
 
NAND and NOR implementation and Other two level implementation
NAND and NOR implementation and  Other two level implementationNAND and NOR implementation and  Other two level implementation
NAND and NOR implementation and Other two level implementation
 
Combinational circuits
Combinational circuits Combinational circuits
Combinational circuits
 
Parity Generator and Parity Checker
Parity Generator and Parity CheckerParity Generator and Parity Checker
Parity Generator and Parity Checker
 
Decoders-Digital Electronics
Decoders-Digital ElectronicsDecoders-Digital Electronics
Decoders-Digital Electronics
 
Flip flops, counters &amp; registers
Flip flops, counters &amp; registersFlip flops, counters &amp; registers
Flip flops, counters &amp; registers
 
encoder and decoder in digital electronics
encoder and decoder in digital electronicsencoder and decoder in digital electronics
encoder and decoder in digital electronics
 
Design half ,full Adder and Subtractor
Design half ,full Adder and SubtractorDesign half ,full Adder and Subtractor
Design half ,full Adder and Subtractor
 
6 2 magnitudecomparator ibit and 2 bit converted
6 2 magnitudecomparator ibit and 2 bit converted6 2 magnitudecomparator ibit and 2 bit converted
6 2 magnitudecomparator ibit and 2 bit converted
 
boolean algebra and logic simplification
boolean algebra and logic simplificationboolean algebra and logic simplification
boolean algebra and logic simplification
 
Decoders
DecodersDecoders
Decoders
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
 
BCD ADDER
BCD ADDER BCD ADDER
BCD ADDER
 
Adder substracter
Adder substracterAdder substracter
Adder substracter
 
MULTIPLEXER
MULTIPLEXERMULTIPLEXER
MULTIPLEXER
 
Binary multipliers
Binary multipliersBinary multipliers
Binary multipliers
 

Similar a Magnitude comparator

DLD Lecture No 21 BCD Multiplier and Magnitude Comparator.pptx
DLD Lecture No 21  BCD Multiplier and Magnitude Comparator.pptxDLD Lecture No 21  BCD Multiplier and Magnitude Comparator.pptx
DLD Lecture No 21 BCD Multiplier and Magnitude Comparator.pptx
SaveraAyub2
 

Similar a Magnitude comparator (20)

I semester Unit 4 combinational circuits.pptx
I semester Unit 4 combinational circuits.pptxI semester Unit 4 combinational circuits.pptx
I semester Unit 4 combinational circuits.pptx
 
Unit 4 combinational circuit
Unit 4 combinational circuitUnit 4 combinational circuit
Unit 4 combinational circuit
 
Magnitude Comparator
Magnitude ComparatorMagnitude Comparator
Magnitude Comparator
 
Python : basic operators
Python : basic operatorsPython : basic operators
Python : basic operators
 
Logic Gates.pptx
Logic Gates.pptxLogic Gates.pptx
Logic Gates.pptx
 
DLD Lecture No 21 BCD Multiplier and Magnitude Comparator.pptx
DLD Lecture No 21  BCD Multiplier and Magnitude Comparator.pptxDLD Lecture No 21  BCD Multiplier and Magnitude Comparator.pptx
DLD Lecture No 21 BCD Multiplier and Magnitude Comparator.pptx
 
IS 151 Lecture 9
IS 151 Lecture 9IS 151 Lecture 9
IS 151 Lecture 9
 
Digital 4-bit Comprator
Digital 4-bit CompratorDigital 4-bit Comprator
Digital 4-bit Comprator
 
Arithmatic &Logic Unit
Arithmatic &Logic UnitArithmatic &Logic Unit
Arithmatic &Logic Unit
 
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic CircuitsFYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
 
Digital 1 8
Digital 1 8Digital 1 8
Digital 1 8
 
B sc3 unit 4 combi..lckt
B sc3 unit 4 combi..lcktB sc3 unit 4 combi..lckt
B sc3 unit 4 combi..lckt
 
Logic gates
Logic gatesLogic gates
Logic gates
 
COA(Unit_3.pptx)
COA(Unit_3.pptx)COA(Unit_3.pptx)
COA(Unit_3.pptx)
 
Combinational and sequential logic
Combinational and sequential logicCombinational and sequential logic
Combinational and sequential logic
 
Computer arithmetic
Computer arithmeticComputer arithmetic
Computer arithmetic
 
2dig circ
2dig circ2dig circ
2dig circ
 
Comparators_and_Code_Convertersv.pptx.ppt
Comparators_and_Code_Convertersv.pptx.pptComparators_and_Code_Convertersv.pptx.ppt
Comparators_and_Code_Convertersv.pptx.ppt
 
Lesson Week 1-2.pptx
Lesson Week 1-2.pptxLesson Week 1-2.pptx
Lesson Week 1-2.pptx
 
Digital electronics & microprocessor Batu- s y computer engineering- arvind p...
Digital electronics & microprocessor Batu- s y computer engineering- arvind p...Digital electronics & microprocessor Batu- s y computer engineering- arvind p...
Digital electronics & microprocessor Batu- s y computer engineering- arvind p...
 

Más de Preet_patel

Más de Preet_patel (19)

DESIGN OF TURBO ALTERNATORS
DESIGN OF TURBO ALTERNATORSDESIGN OF TURBO ALTERNATORS
DESIGN OF TURBO ALTERNATORS
 
LOAD FREQUENCY AND VOLTAGE GENERATION CONTROL
LOAD FREQUENCY AND VOLTAGE GENERATION CONTROLLOAD FREQUENCY AND VOLTAGE GENERATION CONTROL
LOAD FREQUENCY AND VOLTAGE GENERATION CONTROL
 
Wind farm planning and commissioning
Wind farm planning and commissioningWind farm planning and commissioning
Wind farm planning and commissioning
 
Rotor Resistance Control and Slip Power Control using Chopper
Rotor Resistance Control and Slip Power Control using ChopperRotor Resistance Control and Slip Power Control using Chopper
Rotor Resistance Control and Slip Power Control using Chopper
 
Transient in Power system
Transient in Power systemTransient in Power system
Transient in Power system
 
Impulse testing of transformer
Impulse testing of transformerImpulse testing of transformer
Impulse testing of transformer
 
Three Phase Separately Exited Drives
Three Phase Separately Exited DrivesThree Phase Separately Exited Drives
Three Phase Separately Exited Drives
 
Ac distribution
Ac distributionAc distribution
Ac distribution
 
Signal Flow Graph
Signal Flow GraphSignal Flow Graph
Signal Flow Graph
 
MMF for Airgap and Tooth
MMF for Airgap and ToothMMF for Airgap and Tooth
MMF for Airgap and Tooth
 
Special transformers
Special transformersSpecial transformers
Special transformers
 
WITRICITY FIELD THEORY
WITRICITY FIELD THEORYWITRICITY FIELD THEORY
WITRICITY FIELD THEORY
 
State table and characteristic equation for sequential circuit
State table and characteristic equation for sequential circuitState table and characteristic equation for sequential circuit
State table and characteristic equation for sequential circuit
 
Cost and BEA
Cost and BEACost and BEA
Cost and BEA
 
Phase locked loop
Phase locked loopPhase locked loop
Phase locked loop
 
Garodiya survey
Garodiya survey Garodiya survey
Garodiya survey
 
Cpd ch 3
Cpd ch 3Cpd ch 3
Cpd ch 3
 
Static and dynamic personality
Static and dynamic personalityStatic and dynamic personality
Static and dynamic personality
 
who is a contributor...?
who is a contributor...?who is a contributor...?
who is a contributor...?
 

Último

Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 

Último (20)

Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 

Magnitude comparator

  • 2. Magnitude Comparator • A magnitude digital comparator is a combinational circuit that compares two digital or binary numbers (consider A and B) and determines their relative magnitudes in order to find out whether one number is equal, less than or greater than the other digital number. • Three binary variables are used to indicate the outcome of the comparison as A>B, A<B, or A=B. The below figure shows the block diagram of a n-bit comparator which compares the two numbers of n-bit length and generates their relation between themselves.
  • 3. Magnitude comparator is a combinational circuit that compares two numbers and determines their relative magnitude. A comparator is shown as Figure 2.1. The output of comparator is usually 3 binary variables indicating: A>B A=B A<B LOGIC DESIGN PROCEDURE A>B A=B A<B Comparator A B
  • 4. For a 2-bit comparator, we have four inputs A1A0 and B1B0 and three outputs: E (is 1 if two numbers are equal) G (is 1 when A > B) and L (is 1 when A < B) G(A>B) E(A=B) L(A<B) Comparator A1 B1 A0 B0 LOGIC DESIGN FOR 2-BIT COMPARATOR
  • 5. If we use truth table and K-MAP, the result is E= A’1A’0B’1B’0 + A’1A0B’1B0 + A1A0B1B0 + A1A’0B1B’0 or E=(( A0 ⊕ B0) + ( A1 ⊕ B1))’ G = A1B’1 + A0B’1B’0 + A1A0B’0 L= A’1B1 + A’1A’0B0 + A’0B1B0 Here we use simpler method to find E (called X) and G (called Y) and L (called Z) CASE 1: A=B if all Ai= Bi It means X0 = A0B0 + A’0B’0 and X1= A1B1 + A’1B’1 If X0=1 and X1=1 then A0=B0 and A1=B1 Thus, if A=B then X0X1 = 1 it means X= (A0B0 + A’0B’0)(A1B1 + A’1B’1) since (x ⊕ y)’ = (xy +x’y’) X= ( A0⊕B0)’ ( A1⊕B1)’ = (( A0 ⊕ B0) + ( A1 ⊕ B1))’ It means for X we can NOR the result of two exclusive-OR gates. RESULT Ai Bi Xi 0 0 1 0 1 0 1 0 0 1 1 0
  • 6. CASE 2: A>B means If A1=B1 (X1=1) then A0 should be 1 and B0 should be 0 For A> B: A1 > B1 or A1 =B1 and A0 > B0 It means Y= A1B’1 + X1A0B’0 should be 1 for A> B. CASE 3: For B>A : B1 > A1 A1=B1 and B0> A0 Z= A’1B1 + X1A’0B0 A1 B1 Y1 0 0 0 0 1 0 1 0 1 1 1 0 A0 B0 Y0 0 0 1 0 1 0 1 0 0 1 1 0
  • 7. 4-BIT COMPARATOR The procedure for binary numbers with more than 2 bits can also be found in the similar way. Figure shows the 4-bit magnitude comparator. Input: A=A3A2A1A0 B=B3B2B1B0 A3 B3 x3 A2 B2 x2 A1 B1 x1 A0 B0 x0 (A<B) (A>B) (A=B) 4-Bit Magnitude Comparator
  • 8. CASE 1: A=B A3=B3, A2=B2, A1=B1, A0=B0 xi = AiBi + Ai’Bi’ XOR-Invert = (AiBi’+Ai’Bi)’ = (Ai’+Bi)(Ai+Bi’) = Ai’Ai + Ai’Bi’ + AiBi + BiBi’ = AiBi + Ai’Bi’ Output: X3X2X1X0 CASE 2: A>B Output: A3B’3 + X3A2B’2 + X3X2A1B’1+ X3X2X1A0B’0 CASE 3: A<B Output: A’3B3 + X3A’2B2 + X3X2A’1B1+ X3X2X1A’0B0
  • 9. Truth table of 4-Bit Comparator COMPARING INPUTS OUTPUT A3, B3 A2, B2 A1, B1 A0, B0 A > B A < B A = B A3 > B3 X X X H L L A3 < B3 X X X L H L A3 = B3 A2 >B2 X X H L L A3 = B3 A2 < B2 X X L H L A3 = B3 A2 = B2 A1 > B1 X H L L A3 = B3 A2 = B2 A1 < B1 X L H L A3 = B3 A2 = B2 A1 = B1 A0 > B0 H L L A3 = B3 A2 = B2 A1 = B1 A0 < B0 L H L A3 = B3 A2 = B2 A1 = B1 A0 = B0 H L L A3 = B3 A2 = B2 A1 = B1 A0 = B0 L H L A3 = B3 A2 = B2 A1 = B1 A0 = B0 L L H H = High Voltage Level, L = Low Voltage, Level, X = Don’t Care
  • 10. Applications of Comparators • These are used in the address decoding circuitry in computers and microprocessor based devices to select a specific input/output device for the storage of data. • These are used in control applications in which the binary numbers representing physical variables such as temperature, position, etc. are compared with a reference value. Then the outputs from the comparator are used to drive the actuators so as to make the physical variables closest to the set or reference value. • Process controllers • Servo-motor control