Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

DIGITAL CIRCUIT DESIGN

(18B11EC215)
Lecture 18
Magnitude Comparator and Binary
Multiplier

1
▪ Comparators
Outline
▪ 1-Bit Magnitude Comparator
▪ 2-Bit Magnitude Comparator
▪ Extending to Multibit Numbers
▪ Arithmetic Circuits: Comparator

▪ Binary Multipliers
▪ 2-Bit Binary Multiplier
▪ Implementation with basic Gates
▪ 2-Bit By 2-Bit Binary Multiplier
▪ 4-Bit By 3-Bit Binary Multiplier
▪ 4-Bit By 4-Bit Binary Multiplier
▪ References
2
Comparators [1-3]
• A magnitude digital Comparator is a combinational circuit
that compares two digital or binary numbers in order to find
out whether one binary number is equal, less than or greater
than the other binary number.
• We logically design a circuit for which we 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.

3
1-Bit Magnitude Comparator
• A comparator used to compare two bits is called a single bit
comparator.
• It consists of two inputs each for two single bit numbers and
three outputs to generate less than, equal to and greater than
between two binary numbers.
• The truth table for a 1-bit comparator is given below:

4
1-Bit Magnitude Comparator
• From the truth table logical expressions for each output can be
expressed as follows:
– A>B: AB'
– A<B: A'B
– A=B: A'B' + AB

5
2-Bit Magnitude Comparator
• A comparator used to compare two binary numbers
each of two bits is called a 2-bit Magnitude
comparator.

• It consists of four inputs and three outputs to generate


less than, equal to and greater than between two
binary numbers.

6
2-Bit Magnitude Comparator

7
(A>B) = A1B1' + A0B1'B0' + A1A0B0' (A<B) = A1'B1 + A0'B1B0 + A1'A0'B0

(A=B) = A1'A0'B1'B0' + A1'A0B1'B0 +


A1A0B1B0 + A1A0'B1B0'
=A1'B1' (A0'B0' + A0B0) + A1B1 (A0B0 + A0'B0')
= (A0B0 + A0'B0') (A1B1 + A1'B1')
= (A0 Ex-Nor B0) (A1 Ex-Nor B1)

8
Extending to Multibit Numbers
▪ Compare the most significant bits.
– If they are not equal, no need to compare the other bits.

– If they are equal, we must check the next bit.

▪ Continue until one number if found to be greater than the


other, or all bits are checked and the numbers are found equal.

9
Arithmetic Circuits: Comparator
▪ Magnitude comparator: compares 2 values A and B, to see
if A>B, A=B or A<B.
▪ Classical method requires 22n rows in truth table.
▪ How do we compare two 4-bit values A (a3a2a1a0) and B
(b3b2b1b0)?
If (a3 > b3) then A > B
If (a3 < b3) then A < B
If (a3 = b3) then if (a2 > b2) ….

10
Arithmetic Circuits: Comparator
Let A = A3A2A1A0 , B = B3B2B1B0; xi = Ai.Bi + Ai'.Bi'

A3
x3
A3'.B3
A3.B3'
B3
A3'.B3 + x3.A2'.B2
A2 + x3.x2.A1'.B1
x2 + x3. x2.x1.A0'.B0
B2
(A < B)
A1
x1
A3.B3' + x3.A2.B2'
B1
+ x3.x2.A1.B1'
+ x3. x2.x1.A0.B0'
A0
x0 (A > B)
B0
(A = B) x3. x2.x1.x0

11
Arithmetic Circuits: Comparator

0 A3 4-bit
1 A2 comp
1 A1
0 A0

1 B3 (A < B) 1
0 B2 (A > B) 0
1 B1 (A = B) 0
0 B0

Block diagram of a 4-bit magnitude comparator

12
References
[1] M. Morris Mano and Michael D. Ciletti, “Digital Design with
an Introduction to the Verilog HDL”, 5th Edition, Pearson
Education, 2013.

[2] S. Salivahanan and S. Arivazhagan, “Digital circuits and


design”, Vikas Publishing House PVT Limited, Fifth edition.

[3] A. Anand Kumar, “Fundamentals of Digital Circuits”, PHI,


Fourth Edition.

13

You might also like