Tut 07 Qns
Tut 07 Qns
Discussion Questions
D1. Design a circuit, without using any logic gate, that takes a 3-bit input ABC representing an unsigned
integer x, and produces a 5-bit output VWXYZ which is equivalent to 4x+2. What are V, W, X, Y and Z?
D2. The following algorithm to convert binary to standard Gray code sequence is given in “Digital Logic
Design” book, page 35:
1. Retain the MSB.
2. From left to right, add each adjacent pair of binary code bits to get the next Gray code bit,
discarding the carry.
The following example shows the conversion of binary number (10110)2 to its corresponding standard
Gray code value, (11101)Gray.
1 0 1 + 1 0 Binary 1 0 1 1 + 0 Binary
↓ ↓
1 1 1 0 Gray 1 1 1 0 1 Gray
Given a half-adder as shown on the right where X and Y are its inputs and C X Y
(carry) and S (sum) its outputs, implement a 5-bit binary to Gray code
converter to convert the binary value ABCDE to its equivalent Gray code PQRST
C S
by using the fewest number of half-adders without any additional logic gates.
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
A1H
A E
B F
C G
D H
Digit: 0 1 2 3 4 5 6 7 8 9
Code: 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001
For example, the decimal value 396 is represented as 0011 1001 0110 in BCD code.
Given two decimal digits A and B, represented by their BCD codes A3A2A1A0 and B3B2B1B0 respectively,
implement a circuit without using any logic gates to calculate the BCD code of the 3-digit output of
(51A) + (20(B%2)), where % is the modulo operator. Name the outputs F11F10F9F8 F7F6F5F4 F3F2F1F0.
For example, if A=2 (or 0010 in BCD) and B=7 (or 0111 in BCD), then (51A) + (20(B%2)) = 122 or
0001 0010 0010 in BCD. Hence, the circuit is to produce the output 0001 0010 0010 for the inputs
0010 and 0111.
[Hint: Fill in the table below that computes 5A.]
A
5A
A3 A2 A1 A0
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
A3 A2 A1 A0 B3 B2 B1 B0
F11 F10 F9 F8 F7 F6 F5 F4 F3 F2 F1 F0