Tut07 Selected Ans
Tut07 Selected Ans
Tutorial questions
Note that for questions on logic design, you may assume that logical constants 0 and 1 are always
available. However, complemented literals are not available unless otherwise stated.
1. [Past-year’s question]
You are to design a circuit to implement a function V(A,B,C,D,E) that takes in input ABCDE and
generates output 1 if ABCDE is a valid input for the circuit in question D3 above, or 0 if ABCDE is an
invalid input. You are allowed to use only the following devices: full adder, 2-bit parallel adder, and 4-
bit magnitude comparator. You should use the fewest number of these approved devices, and no
other devices or logic gates. The block diagrams for these devices are shown below.
2-bit 4-bit
Full Adder COMP
Cin X3
Adder X2
X1 Cout
X Carry X1
X0
Y S1 X0 X<Y
Sum
Z Y1 S0 X=Y
Y0 Y3 X>Y
Y2
Y1
Y0
Answer:
Idea: Count the number of 1’s in ABCDE. If count > 1, then it’s a valid input.
4-bit
COMP
0 X3
0 X2
0 X1
Full 2-bit 1
Adder Adder X0 X<Y V
A D Cin X=Y
X Carry 0 Y3
X1 Cout X>Y
B Y Y2
Sum X0
C Z S1 Y1
0 S0 Y0
Y1
E Y0
You want to construct a 4221-to-8421 decimal code converter, which takes in a 4-bit 4221 decimal
code PQRS and generates the corresponding 4-bit 8421 decimal code WXYZ.
Let’s call the circuit you created in part (a) above the A1H (Add-1-then-Half) device, represented
by the block diagram below. Implement your 4221-to-8421 decimal code converter using this A1H
device with the fewest number of additional logic gates.
A1H
A E
B F
C G
D H
2(b) P Q R S W X Y Z
0 0 0 0 0 0 0 0
A1H 0 0 0 1 0 0 0 1
0 A E 0 0 1 0 0 0 1 0
P B F W 0 0 1 1 0 0 1 1
Q C G X 0 1 1 0 0 1 0 0
R D H Y 1 0 0 1 0 1 0 1
1 1 0 0 0 1 1 0
S Z 1 1 0 1 0 1 1 1
1 1 1 0 1 0 0 0
1 1 1 1 1 0 0 1
Answers:
(a) (b)
A X3 4-bit A X3 4-bit
B X2 COMP B X2 COMP
C X1 C X1
D X0 X<Y D X0 X<Y
X=Y X=Y G
1 Y3 D Y3
0 Y2 X>Y F C Y2 X>Y
1 Y1 B Y1
1 Y0 A Y0