National University of Computer and Emerging Sciences: EL227-Digital Logic Design Lab-08
National University of Computer and Emerging Sciences: EL227-Digital Logic Design Lab-08
National University of Computer and Emerging Sciences: EL227-Digital Logic Design Lab-08
Inputs Outputs
B AB
AB
Y2 A B
AB
AB AB
Y3 A B
AB
Y1 AB
Y2 AB AB
Y3 AB
Engr. Khuram Shahzad, FAST NUCES Peshawar 8
1-Bit Magnitude Comparator
A0 Y1
A
A 2-Bit Comparator Y2
B01
B
B1 Y3
Input Output
01 0 0 1 1 01 0 1 0 0
11 0 0 0 0 11 0 0 1 0
10 0 0 1 0 10 0 0 0 1
For A<B
Y1 A1 A 0 B 0 A1 B1 A 0 B1
B0 For A=B
Y2 A1 A0 B1 B0 A1 A0 B1 B0 A1A0B1B0 A1 A0 B1 B0
Engr. Khuram Shahzad, FAST NUCES Peshawar 13
K-MAP FOR A>B
B 1B 0
A1A0 10
00 01 11
00 0 0 0 0
01 1 0 0 0
11 1 1 0 1
10 1 1 0 0
Y3 A 0 B1 B0 A1 B1 A1A0 B0
Y2 A1 A 0 B1 B0 A1 A 0 B1 B0 A1A0B1B0 A1 A 0 B1 B0
Y2 A 0 B0 (A1 B1 A1B1 ) A 0 B0 (A1 B1 A1B1 )
Y2 (A1 B1 A1B1 ) (A 0 B0 A 0 B0 )
Y2 (A1 B1 ) (A 0 B0 )
A1 A0 B1 B0
A1 A 0 B 0
A1 B1 A< B
A 0 B1 B0
A1 B1
A=B
A 0 B0
A 0 B1 B 0
A1 A 0 B 0 A>
B
A 1 B1
If A3 = 1 and B3 = 0
If A3 = B3 and A2 = 1 and B2 = 0
If A3 = B3, A2 = B2 and A1 = 1 and B1 = 0
If A3 = B3, A2 = B2, A1 = B1 and A0 = 1 and B0 = 0
• Similarly the condition for A<B can be possible in the following four cases:
If A3 = 0 and B3 = 1
If A3 = B3 and A2 = 0 and B2 = 1
If A3 = B3, A2 = B2 and A1 = 0 and B1 = 1
If A3 = B3, A2 = B2, A1 = B1 and A0 = 0 and B0 = 1
• The condition of A=B is possible only when all the individual bits of one number exactly coincide with
corresponding bits of another number.
•
A=B: (A3 Ex-Nor B3) (A2 Ex-Nor 82) (Al Ex-Nor BI) (AO Ex-Nor BO)
The Code converter is used to convert one type of binary code to another.
There are different types of binary codes like BCD code, gray code, excess-3 code, etc. Different codes are used for
different types of digital applications.
To get the required code from any one type of code, the simple code conversion process is done with the help of
combinational circuits.
A code converter circuit will convert coded information in one form to a different coding form.