Beruflich Dokumente
Kultur Dokumente
OTHER COMBINATIONAL
LOGIC CIRCUITS
WEEK 7 AND WEEK 8
(LECTURE 1 OF 3)
COMPARATORS
CODE CONVERTERS
1
COMPARATORS
Comparator is a combinational logic circuit that
compares the magnitudes of two binary
quantities to determine which one has the greater
magnitude.
In other word, a comparator determines the
relationship of two binary quantities.
A exclusiveOR gate can be used as a basic
comparator.
2
Contd...
There are two different types of output relationship
between the two binary quantities;
Equality output indicates that the two binary numbers
being compared is equal (A = B) and
Cascading
Inputs
Outputs
Solution: The number on the A inputs is 0110 and the number on the B
inputs is 0011. The A > B output is HIGH and the other outputs (A=B
and A<B) are LOW
10
Contd...
In addition, it also has three cascading inputs:
These inputs provides a means for expanding the
comparison operation by cascading two or more 4bit
comparator.
To expand the comparator, the A<B, A=B, and A>B
outputs of the lowerorder comparator are connected to
the corresponding cascading inputs of the next
higherorder comparator.
11
Contd...
The lowest-order comparator must have a HIGH on the
A=B, and LOWs on the A<B and A>B inputs as shown in
next slide.
13
14
15
16
17
Example :
Determine the output for the following sets of binary
numbers to the comparator inputs in figure below.
(a) 10 and 10
(b) 11 and 10
Solution
( a )The output is 1 (b) The output is 0
18
CODE CONVERTERS
A code converter is a logic circuit that changes data
presented in one type of binary code to another type of
binary code, such as BCD to binary, BCD to 7segment,
binary to BCD, BCD to XS3, binary to Gray code, and
Gray code to binary.
We know that, two digit decimal values ranging from 00
to 99 can be represented in BCD by two 4bit code
groups.
19
BCD-to-Binary Conversion
One method of BCD-to-Binary code conversion uses adder
circuits :
1. The value, or weight, of each bit in the BCD number is
represented by a binary number
2. All of the binary representations of the weights of bits that
are 1s in the BCD number are added
20
Contd...
For example, 4610 is represented as
The MSB has a weight of 10, and the LSB has a weight
of 1.
So the most significant 4bit group represents 40, and
the least significant 4bit group represents 6 as in
Table.
21
Weight Table
22
23
24
Example :
Convert the BCD equivalent of 26 to binary.
Solution
25
MSB
0
+
1
+
1
+
0
+
1
Binary code
Gray code
B2
B1
B0
G3
G2
G1
G0
26
27
28
+
0
+
1
+
0
+
0
Truth Table:
1
1 )
OUTPUTS (BINARY
G2
G1
G0
B3
B2
B1
Gray code
Binary code
B0
29
30
31
32
Exercise
1. Convert the binary number 0101 to Gray code with XOR
gates
2. Convert the gray code 1011 to binary with XOR gates
Solution:
33
34
35
36
37