Documente Academic
Documente Profesional
Documente Cultură
for
INTRODUCTION TO DIGITAL SYSTEMS
Milos D. Ercegovac, Tomas Lang and Jaime H. Moreno
Wiley & Sons, New York, 1999
prepared by
Chapter 2
Exercise 2.1
Exercise 2.2
Inputs: x = (x15; x14; :::; x1; x0) and y = (y1 ; y0), with xi ; yi 2 f0; 1; 2g.
Output: z = (z13; z12; :::; z0), with zi 2 f0; 1; 2g.
Function:
(
z = ((0x;150;; :::; xi+2; xi 1; :::; x0) if (xi+1 ; xi ) = y and (xj +1 ; xj ) 6= y for j > i
0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0) otherwise
A tabular description would have as many rows as the number of combinations of x and y , which
is 318.
Solutions Manual - Introduction to Digital Design - September 29, 2000 3
Exercise 2.3
Input: x = (xn 1 ; : : :; x0); xi 2 f0; 1g
Output: an integer 1 z n 1.
Function:
z = ji j j if (xi = xj = 1)
4 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.4
Input: X is a 4 4 matrix of elements xij 2 fa; b; c; dg:
2 3
x x x x
66 11 12 13 14 77
66 x x x x 77
6 21 22 23 24 77
X = 66 77
66 x31 x32 x33 x34 77
64 5
x41 x42 x43 x44
Output: z 2 f0; 1g.
Function: The output is equal to 1 if one of x22; x23; x32; or x33 is b and it is surrounded by eight
a's. The conditional expression is
8
>
< 1 if xi;j = b and (xk;m = a for k 2 fi 1; i; i + 1g and m 2 fj 1; j; j + 1g)
z=> with i; j 2 f2; 3g and (k; m) 6= (i; j )
: 0 otherwise
A tabular representation would not be practical because there are 4 4 = 16 variables, each of
which can have 4 values, resulting in a table of 416 rows.
Solutions Manual - Introduction to Digital Design - September 29, 2000 5
Exercise 2.5
Inputs: Integer 0 x < 216, binary control variable d 2 f0; 1g
16
( Integer 0 16z < 2 .
Output:
z = ((xx + 1)
1) mod 2 if d = 1
mod 216 if d = 0
Tabular representation: Requires 216 rows for d = 1 and 216 rows for d = 0.
Total rows = 2 216 = 217. A tabular representation is out of question.
6 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.6
Exercise 2.7
Range from 10 to 25 ) 16 values.
Minimum number of binary variables: dlog2 16e = 4 variables.
Input: integer 10 x 25 Output: integer 0 z 15
z = (x 10)
In the next table the output z is represented by a vector z = (z3 ; z2; z1; z0), with zi 2 f0; 1g.
x 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
z 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
8 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.8
(a) Month: dlog2 12e = 4 bits
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Code 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011
(b) Day: dlog2 31e = 5 bits
Year (assuming 0-2500): dlog2 2501e = 12 bits
Month: 4 bits
A total of 21 bits would be needed.
(c) Each decimal digit needs 4 bits. Two digits are necessary to represent the day, and 4 digits to
represent the year. The number of bits to represent these elds would be 6 4 = 24 bits. Adding
the bits used in the month eld we get 28 bits total.
(d) If only one component is used, we need to specify a code for each particular day. This code
may be calculated as:
(year 1) 12 31 + (month 1) 31 + day 1
where month, year and day are the usual numbers associated to each eld (Jan = 1, Feb = 2,...).
Maximum date is 12/31/2500, which corresponds to the value:
2499 372 + 11 31 + 30 = 929999
So dlog2 929999e = 20 bits are needed to represent all possible codes. The disadvantage of this
method is that many calculations must be done to convert the code to the usual representation of
the date, and vice-versa.
Solutions Manual - Introduction to Digital Design - September 29, 2000 9
Exercise 2.9
Exercise 2.10
Consider that the vector of weights is w = (w0; w1; w2; w3). A number x is represented as a vector
x = (x0; x1; x2; x3) and its value in decimal is calculated as:
3
X
x= xi wi ; xi 2 f0; 1g and wi > 0
i=0
Without loss of generality we consider that the weights are sorted in ascending order, such that
w0 w1 w2 w3. The conditions that the weights have to satisfy in order to enable the
representation of x 2 f0; 1; 2; :::; 9g, assuming wi > 0, are:
P
1. 3i 0 wi 9. This condition is important to enable the generation of 9, and thus assure
containment;
2. w0 = 1, to generate x = 1;
3. wi 9, for all i;
4. Continuity condition: for 0 < i 3, wi is chosen such that wi is the sum of a subset (including
the empty set) of weights wj plus one, j < i.
With this condition:
w1 2 fw0; w0 + 1g = f1; 2g
thus, if we choose w1 = 1, the set of values for w2 is
w2 2 fw0; w0 + 1; w1 + 1; w0 + w1 + 1g = f1; 2; 3g
and for the choice w1 = 2 we should have w2 in the set fw0; w0 + 1; w1 + 1; w0 + w1 + 1g =
f1; 2; 3; 4g, but since we are assuming w0 w1 w2 w3, we get:
w2 2 f2; 3; 4g
Notice that when w2 5 the value x = 4 cannot be represented since w0 + w1 = 3, and the
other weights are greater than 4. The same reasoning is applied to the fourth weight.
Solutions Manual - Introduction to Digital Design - September 29, 2000 11
Exercise 2.11
(a)
34 567 = (0011 0100 0101 0110 0111)BCD
= (0110 0111 1000 1001 1010 )Excess 3
(b) BCD does not have the complementary property, so an actual subtraction is needed:
99 999 34 567 = 65 432 = (0110 0101 0100 0011 0010)BCD
2421 code has the complementary property, such that the subtraction is done by complementing
each bit:
34 567 = (0011 0100 1011 1100 1101)2421-code
99 999 34 567 = (1100 1011 0100 0011 0010)2421-code
12 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.12
a) All possiblep5-bit vectors x = (x4x3 x2 x1x0 ) and the valid 2-out-of-5 combinations (marked with
a tick mark ( )) are shown in Table 2.1.
b)
Input= x = (x4x3 x2 x1x0 )
Output= z 2 f0; 1g
Function:
8
>
< 1 if (xi = xj = 1 and xk = 0) for
z = > i 6= j 6= k and i; j; k 2 f0; 1; 2; 3; 4g
: 0 otherwise
Solutions Manual - Introduction to Digital Design - September 29, 2000 13
valid
2-out-of-5
x = (x4x3 x2x1x0 ) combinations
00000
00001
00010 p
00011
00100 p
00101 p
00110
00111
01000 p
01001 p
01010
01011 p
01100
01101
01110
01111
10000 p
10001 p
10010
10011 p
10100
10101
10110
10111 p
11000
11001
11010
11011
11100
11101
11110
11111
Exercise 2.13
(a) (1001010100011110)2 = (1001 0101 0001 1110 )2 = (951E )16
(b) (3456)8 = (011 100 101 110)2 = (011100101110)2
(c) To convert from radix-2 to radix-2k we consider groups of k bits. The digits in radix-2k are
obtained converting each group (binary representation of the digit) into a single value in the new
radix.
To convert from radix-2k to radix-2, the digits in radix-2k are converted to binary. The nal vector,
that corresponds to the concatenation of all digit representations in binary, is the radix-2 represen-
tation of the number.
Solutions Manual - Introduction to Digital Design - September 29, 2000 15
Exercise 2.14
We could directly build the tables of the functions and show that the identity holds by comparing
the tables. However, this would be time consuming since the table would have 32 rows. Therefore,
we look at dierent assignments as follows:
i) if a = 0 and b = 0 then both sides of the identity have value 0, since M (x; y; z) = 0 when
two of its arguments are 0.
ii) if a = 1 and b = 1 then both sides have value 1, since M (x; y; z) = 1 when two arguments
are 1.
iii) the two cases a 6= b are equivalent due to the symmetry of the majority function and the
fact that these variables appear together in all functions in the expression. Consequently, we
check only the case a = 0 and b = 1. For this assignment,
Exercise 2.15
(a) Prove that fXOR (fAND (x1; x0); fAND(x1 ; x0)) = fEQUIVALENCE (x1; x0)
x1 x0 f
AND ( x1 ; x0 ) f
XOR ( AND (
f ) AND (
x1 ; x0 ; f x1 ; x0 )) f
EQUIVALENCE ( x1 ; x0 )
0 0 0 0 1
0 1 0 0 0
1 0 0 0 0
1 1 1 0 1
(b) Prove that fNAND (fNAND (x1; x0); fNAND(x1 ; x0)) = fAND (x1; x0)
x1 x0 f
NAND ( x1 ; x0 ) f
NAND ( NAND (
f ) NAND (
x1 ; x0 ; f x1 ; x0 )) f
AND (
x1 ; x0 )
0 0 1 0 0
0 1 1 0 0
1 0 1 0 0
1 1 0 1 1
Exercise 2.16
Each variable can have 2 values (0 or 1).
Total number of n-variable inputs: |2 2 {z
::: 2} = 2n
n
For each input, the output function can have 2 values.
::: 2} = 22
Total number of functions: |2 2 {z n
2n
18 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.17
a) Let f be a symmetric switching function of three variables, x; y; and z . Since the function is
symmetric, f (0; 0; 1) = f (0; 1; 0) = f (1; 0; 0) and f (0; 1; 1) = f (1; 0; 1) = f (1; 1; 0) so that we have
the following table:
x y z f
0 0 0 a
0 0 1 b
0 1 0 b
0 1 1 c
1 0 0 b
1 0 1 c
1 1 0 c
1 1 1 d
where a; b; c; and d are binary variables. From this description any particular example can be
generated by assigning values to a; b; c, and d.
b) Since a; b; c; and d can each take two values (0 or 1), the number of symmetric functions of three
variables is 24 = 16.
c) A symmetric switching function has the same value for all argument values that have the same
number of 1's, since all these values can be obtained by permuting the arguments. Consequently,
the values of the function of n arguments are decomposed into n + 1 classes dened by the number
of 1's in the argument vector (four classes in part a). Therefore the set A completely denes the
function.
d) The function has value 1 whenever 0; 2 or 3 arguments have value 1. The table is
w x y z f
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0
0 0 1 1 1
0 1 0 0 0
0 1 1 1 1
0 1 1 0 1
0 1 1 1 1
1 0 0 0 0
1 0 0 1 1
1 0 1 0 1
1 0 1 1 1
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
e) In part (c) we saw that the argument values of symmetric switching function of n variables are
divided into n +1 classes. For each of these classes the function can have value 1 or 0. Consequently,
the number of symmetric switching functions of n variables is 2n+1 .
f) No, the composition of symmetric switching functions is not necessarily a symmetric function.
Consider as counterexample
f (x; y; z) = fAND (fOR(x; y ); z)
Solutions Manual - Introduction to Digital Design - September 29, 2000 19
Exercise 2.18
(a) The threshold switching function of three variables with w1 = 1, w2 = 2, w3 = 1, and T = 2
is:
x x = fx3; x2; x1g z = f (x)
0 000 0
1 001 0
2 010 0
3 011 1
4 100 0
5 101 0
6 110 0
7 111 0
one-set = f3g
zero-set = f0,1,2,3,4,5,6,7g
(b) The system of inequalities for the function one set(3; 5; 7) is:
0 T (2.1)
w0 T (2.2)
w1 T (2.3)
w2 T (2.4)
w0 + w1 > T (2.5)
w0 + w2 > T (2.6)
w1 + w2 T (2.7)
w2 + w1 + w0 > T (2.8)
A solution for this system is:
w0 = 2 w1 = 1 w2 = 1 T = 2
(c) We have the following eight equations:
0 > T (2.9) w2 T (2.13)
w0 T (2.10) w2 + w0 > T (2.14)
w1 T (2.11) w2 + w1 > T (2.15)
w1 + w0 > T (2.12) w2 + w1 + w0 T (2.16)
Exercise 2.19 The input of the system is x = (x3; x2; x1; x0), and the output is the bit-vector
z = (z1; z0). The output encoding and the respective function table are:
x3x2 x1 x0 z1 z0
0 0000 - -
1 0001 - -
2 0010 - -
3 0011 0 1
4 0100 - -
z z1 z0 5 0101 1 0
6 0110 0 1
1 01 7 0111 - -
2 10 8 1000 - -
3 11 9 1001 1 1
10 1010 1 0
11 1011 - -
12 1100 0 1
13 1101 - -
14 1110 - -
15 1111 - -
z1 : one-set(5,9,10), zero-set(3, 6, 12), dc-set(0,1,2,4,7,8,11,13,14,15)
z0 : one-set(3,6,9,12), zero-set(5, 10), dc-set(0,1,2,4,7,8,11,13,14,15)
Solutions Manual - Introduction to Digital Design - September 29, 2000 23
Exercise 2.20 Using BCD code, the function specied in Exercise 2.1 is described as:
x z7 z6 z5 z4 z3 z2 z1 z0
0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 1 0
2 0 0 0 0 0 1 0 0
3 0 0 0 0 0 1 1 0
4 0 0 0 0 1 0 0 0
5 0 0 1 0 0 1 0 1
6 0 0 1 1 0 1 1 0
7 0 1 0 0 1 0 0 1
8 0 1 1 0 0 1 0 0
9 1 0 0 0 0 0 0 1
10 - - - - - - - -
11 - - - - - - - -
12 - - - - - - - -
13 - - - - - - - -
14 - - - - - - - -
15 - - - - - - - -
Using a two-dimensional table:
x1 x0
x3 x2 00 01 10 11
00 00000000 00000010 00000100 00000110
01 00001000 00100101 00110110 01001001
10 01100100 10000001 - -
11 - - - -
Using one-set and d.c.-set representation:
z7 = one set(9); dc set(10; 11; 12; 13; 14; 15)
z6 = one set(7; 8); dc set(10; 11; 12; 13; 14; 15)
z5 = one set(5; 6; 8); dc set(10; 11; 12; 13; 14; 15)
z4 = one set(6); dc set(10; 11; 12; 13; 14; 15)
z3 = one set(4; 7); dc set(10; 11; 12; 13; 14; 15)
z2 = one set(2; 3; 5; 6; 8); dc set(10; 11; 12; 13; 14; 15)
z1 = one set(1; 3; 6); dc set(10; 11; 12; 13; 14; 15)
z0 = one set(5; 7; 9); dc set(10; 11; 12; 13; 14; 15)
24 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.21: Using EXCESS-3 code, the function specied in Exercise 2.1 is described as:
x z7 z6 z5 z4 z3 z2 z1 z0
0 - - - - - - - -
1 - - - - - - - -
2 - - - - - - - -
3 0 0 1 1 0 0 1 1
4 0 0 1 1 0 1 0 1
5 0 0 1 1 0 1 1 1
6 0 0 1 1 1 0 0 1
7 0 0 1 1 1 0 1 1
8 0 1 0 1 1 0 0 0
9 0 1 1 0 1 0 0 1
10 0 1 1 1 1 1 0 0
11 1 0 0 1 0 1 1 1
12 1 0 1 1 0 1 0 0
13 - - - - - - - -
14 - - - - - - - -
15 - - - - - - - -
Using a two-dimensional table:
x1 x0
x3 x200 01 10 11
00 - - - 00110011
01 00110101 00110111 00111001 00111011
10 01011000 01101001 01111100 10010111
11 10110100 - - -
Using one-set and dc-set representation:
z7 = one set(11; 12); dc set(10; 11; 12; 13; 14; 15)
z6 = one set(8; 9; 10); dc set(10; 11; 12; 13; 14; 15)
z5 = one set(3; 4; 5; 6; 7; 9; 10; 12); dc set(10; 11; 12; 13; 14; 15)
z4 = one set(3; 4; 5; 6; 7; 8; 10; 11; 12); dc set(10; 11; 12; 13; 14; 15)
z3 = one set(6; 7; 8; 9; 10); dc set(10; 11; 12; 13; 14; 15)
z2 = one set(4; 5; 10; 11; 12); dc set(10; 11; 12; 13; 14; 15)
z1 = one set(3; 5; 7; 11); dc set(10; 11; 12; 13; 14; 15)
z0 = one set(3; 4; 5; 6; 7; 9; 11); dc set(10; 11; 12; 13; 14; 15)
Solutions Manual - Introduction to Digital Design - September 29, 2000 25
Exercise 2.22 Using 2-out-of-5 code, the function specied in Exercise 2.1 is described by the
following table. As the table has 32 entries, only the 10 entries that are useful are shown, the
others have don't care values:
x z9 z8 z7 z6 z5 z4 z3 z2 z1 z0
3 0 0 0 1 1 0 0 0 1 1
5 0 1 0 0 1 1 1 0 0 0
6 0 1 1 0 0 0 0 1 1 0
9 0 0 1 1 0 1 0 0 1 0
10 1 0 1 0 0 0 1 0 1 0
12 0 0 0 1 1 0 0 1 1 0
17 1 0 0 1 0 0 0 1 0 1
18 0 0 0 1 1 1 0 0 0 1
20 0 0 0 1 1 1 0 0 1 0
24 0 0 0 1 1 1 0 1 0 0
Using a two-dimensional table:
x1 x0
x4 x3 x2 00 01 10 11
000 - - - 0001100011
001 - 0100111000 0110000110 -
010 - 0011010010 1010001010 -
011 0001100110 - - -
100 - 1001000101 0001101001 -
101 0001110010 - - -
110 0001110100 - - -
111 - - - -
Using one-set and d.c.-set representation:
z9 = one set(10; 17);
dc set(0; 1; 2; 4; 7; 8; 11; 13; 14; 15; 16; 19; 21; 22; 23; 25; 26; 27; 28; 29; 30; 31)
z8 = one set(5; 6);
dc set(0; 1; 2; 4; 7; 8; 11; 13; 14; 15; 16; 19; 21; 22; 23; 25; 26; 27; 28; 29; 30; 31)
z7 = one set(6; 7; 8);
dc set(0; 1; 2; 4; 7; 8; 11; 13; 14; 15; 16; 19; 21; 22; 23; 25; 26; 27; 28; 29; 30; 31)
z6 = one set(3; 9; 12; 17; 18; 20; 24);
dc set(0; 1; 2; 4; 7; 8; 11; 13; 14; 15; 16; 19; 21; 22; 23; 25; 26; 27; 28; 29; 30; 31)
z5 = one set(3; 5; 12; 18; 20; 24);
dc set(0; 1; 2; 4; 7; 8; 11; 13; 14; 15; 16; 19; 21; 22; 23; 25; 26; 27; 28; 29; 30; 31)
z4 = one set(5; 9; 18; 20; 24);
dc set(0; 1; 2; 4; 7; 8; 11; 13; 14; 15; 16; 19; 21; 22; 23; 25; 26; 27; 28; 29; 30; 31)
z3 = one set(5; 10);
dc set(0; 1; 2; 4; 7; 8; 11; 13; 14; 15; 16; 19; 21; 22; 23; 25; 26; 27; 28; 29; 30; 31)
26 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.23
The number of values of n binary variables is 2n . For each of these, the function can take three
possible values (0; 1 or dc) resulting in 32 functions. Out of these 22 are completely specied
n n
functions.
28 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.24
(a)
a0 b0 + ab + a0b = a0 (b + b0) + ab
= a0 1 + ab
= a0 + b
(b)
a0 + a(a0 b + b0c)0 = a0 + (a0b + b0c)0
= a0 + (a + b0)(b + c0 )
= a0 + ab + ac0 + bb0 + b0c0
= a0 + b + c0 + b0c0
= a0 + b + c0
(c)
(a0b0 + c)(a + b)(b0 + ac)0 = (a0 b0 + c)(a + b)b(a0 + c0 )
= (a0 b0 + c)b(a0 + c0)
= (ba0b0 + bc)(a0 + c0)
= bc(a0 + c0 )
= a0 bc
(d)
ab0 + b0c0 + a0c0 = ab0 + (a + a0 )b0c0 + a0c0
= ab0 + ab0c0 + a0 b0c0 + a0c0
= ab0 (1 + c0 ) + a0 (1 + b0)c0
= ab0 + a0 c0
(e)
wxy + w0 x(yz + yz0 ) + x0 (zw + zy 0) + z(x0w0 + y 0 x) = wxy + w0xy + z(x0(w + y0 ) + x0w0 + y 0x)
= (w + w0)xy + z (x0 (w + y 0 + w0) + y 0 x)
= xy + z (x0 + xy 0 )
= xy + z (x0 + y 0 )
= xy + z (xy )0
= xy + z
(f)
abc0 + bc0d + a0 bd = abc0 + (a + a0 )bc0d + a0bd
= abc0 + abc0d + a0bc0d + a0bd
= abc0(1 + d) + a0 bd(1 + c0)
= abc0 + a0bd
Solutions Manual - Introduction to Digital Design - September 29, 2000 29
Exercise 2.25
xz 0 + x0 z =
= x(xy 0 + x0 y )0 + x0(xy 0 + x0y )
= x(xy 0)0(x0y )0 + x0 xy 0 + x0 x0y
= x(x0 + y )(x + y 0 ) + x0 y
= (xx0 + xy )(x + y 0 ) + x0 y
= (xyx + xyy 0) + x0 y
= xy + x0 y
= (x + x0)y
= 1y
30 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.26
Exercise 2.28 As a counterexample consider the case a = 0; b = 0; and c = 1. For this set of
values ab = ac = 0 and b 6= c.
Solutions Manual - Introduction to Digital Design - September 29, 2000 33
Exercise 2.29 To be a boolean algebra the system must satisfy the postulates of commutativity,
distributivity, complement and additive (multiplicative) identity. Lets consider each one of these
cases:
(a) (#); (&) are commutative because the table is symmetric about the main diagonal, so
postulate 1 (P 1) is satised.
(b) For distributivity, we must show that a#(b&c) = (a#b)&(a#c). Let us prove that this
postulate is true for the system by perfect induction, as shown in Table 2.2.
(c) The additive identity element is 0 since a&0 = 0&a = a. The multiplicative identity
element is 2 since a#2 = 2#a = a.
(d) For 1 to have a complement 10 we need 1&10 = 2 and 1#10 = 0. Consequently, from the
table we see that 1 has no complement.
34 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.30
Let us call the four elements 0; x; y , and 1 with 0 the additive identity, 1 the multiplicative identity
and let x be the complement of y . The corresponding operation tables are
+ 0 x y 1
0 0 x y 1
x x x 1 1
y y 1 y 1
1 1 1 1 1
* 0 x y 1
0 0 0 0 0
x 0 x 0 x
y 0 0 y y
1 0 x y 1
Solutions Manual - Introduction to Digital Design - September 29, 2000 35
Exercise 2.31
To show that the NAND operator is not associative, that means, ((a:b)0:c)0 6= (a:(b:c)0)0 we just
need to nd a case when the expressions are dierent. Take a = 0, b = 0 and c = 1. For these
values we have:
((a:b)0:c)0 = ((0:0)0:1)0 = (1:1)0 = 0
(a:(b:c)0)0 = (0:(0:1)0)0 = 1
So, the NAND operator is not associative.
To show that the NOR operator is not associative, that means, ((a + b)0 + c)0 6= (a + (b + c)0)0 we
take a = 0, b = 0 and c = 1. For these values we have:
((a + b)0 + c)0 = ((0 + 0)0 + 1)0 = 0
(a + (b + c)0)0 = (0 + (0 + 1)0)0 = (0 + 0)0 = 1
So, the NOR operator is not associative.
36 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.32
Part (a)
(i) show that XOR operator is commutative:
a b ab ba
0 0 0 0
0 1 1 1
1 0 1 1
1 1 0 0
(ii) show that XOR operator is associative: a (b c) = (a b) c
abc a b b c (a b) c a (b c)
000 0 0 0 0
001 0 1 1 1
010 1 1 1 1
011 1 0 0 0
100 1 0 1 1
101 1 1 0 0
110 0 1 0 0
111 0 0 1 1
(iii) show that XOR operator is distributive with respect to AND operator, that means:
a:(b c) = ab ac
abc a:b a:c (b c) a:(b c) ab ac
000 0 0 0 0 0
001 0 0 1 0 0
010 0 0 1 0 0
011 0 0 0 0 0
100 0 0 0 0 0
101 0 1 1 1 1
110 1 0 1 1 1
111 1 1 0 0 0
Part (b)
(a) prove that if x y = 0 then x = y .
x y = xy 0 + x0y = 0 ! (x = 1 and y = 1) or (x = 0 and y = 0)
This implies x = y .
(b) x0 y = (x y )0
x y x0 y (x y )0
0 0 1 1
0 1 0 0
1 0 0 0
1 1 1 1
(c) x y = x0 y 0
Solutions Manual - Introduction to Digital Design - September 29, 2000 37
x y x y x0 y 0
0 0 0 0
0 1 1 1
1 0 1 1
1 1 0 0
(d) prove that if x y = z y then x = z .
xy = zy
(x y ) y = (z y ) y
x (y y ) = z (y y ) (Associativity)
x0= z0 (y y = 0)
x=z
Using the function table we come to the same conclusion. The lines where x y = z y are marked
with an *.
x y z xy z y
0 0 0 0 0 *
0 0 1 0 1
0 1 0 1 1 *
0 1 1 1 0
0 0 0 0 0 *
0 0 1 0 1
0 1 0 1 1 *
0 1 1 1 0
1 0 0 1 0
1 0 1 1 1 *
1 1 0 0 1
1 1 1 0 0 *
1 0 0 1 0
1 0 1 1 1 *
1 1 0 0 1
1 1 1 0 0 *
(e) For an even number of x's the expression
x x x x ::: x
can be rewritten as
(x x) (x x) :::(x x)
since x x = 0 the expression becomes:
0 0 0::: 0
and since 0 0 = 0, the resulting value is 0.
For an odd number of x's the same grouping of x's can be done and the expression is transformed
into:
0 0 0:::0 x = 0 x = 00x + 0:x0 = x
38 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.33
(a) Yes. (b) Yes. (c) No, Unmatched parenthesis.
Solutions Manual - Introduction to Digital Design - September 29, 2000 39
Exercise 2.34
(a)
E (w; x; y; z) = w + x0 + (x + y )(w + z)0
E (0; 1; 1; 0) = 0 + 10 + (1 + 1)(0 + 0)0 = 0 + 0 + (1)(0)0 = 0 + 0 + 1 1
= 1
E (1; 1; 1; 0) = 1 + 10 + (1 + 1)(1 + 0)0 = 1 + 0 + (1)(1)0 = 1 + 1 0
= 1
(b)
E (x3; x2; x1; x0) = x2 x1 + x3
E (0; 1; 1; 0) = 1 1 + 0 = 1 + 0 = 1
E (1; 1; 1; 0) = 1 1 + 1 = 1 + 1 = 1
40 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.35 Since the only term containing w is the same in both expressions (yw), to simplify
the tabular description (only 3 variables) we transform the proof as follows:
xyz + yw + x0z0 + xy0 = y 0z0 + yw + xz + x0yz0 if xyz + x0 z0 + xy 0 = y 0z 0 + xz + x0 yz0
Let us call E1 = xyz + x0 z 0 + xy and E2 = y 0z 0 + xz + x0 yz 0 . We show that E1 = E2 in the following
table.
x y z E1 E2
0 0 0 1 1
0 0 1 0 0
0 1 0 1 1
0 1 1 0 0
1 0 0 1 1
1 0 1 1 1
1 1 0 0 0
1 1 1 1 1
Note that if E1 is not equivalent to E2 it is still possible that the original expressions are equivalent.
An example of this type of situation is ab0 + b = a + b, in which ab0 and a are not equivalent.
Solutions Manual - Introduction to Digital Design - September 29, 2000 41
Exercise 2.36
(a) E (x; y ) = xy + xy 0
xy E (x; y )
00 0
01 0
10 1
11 1
(b) E (x; y; z ) = xyz + x0 y + xyz 0
x y z E (x; y; z)
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
42 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.37
Expr a Expr b Expr c Expr d Expr e
x y z xy
0 0
+ xz + xz 0
xy + x y
0 0
+ yz 0
xyz + x y z + x z
0 0 0 0
+ xyz 0
y z+xz
0 0 0
+ xyz x y
0 0
+ xz
0 0
+ xyz
0 0 0 1 1 1 1 1
0 0 1 1 1 1 1 1
0 1 0 1 1 1 1 1
0 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 0 0 1 0
1 1 0 0 1 1 0 0
1 1 1 1 1 1 1 1
Exercise 2.38
(a) E (a; b; c; d) = abc0d + ab0c + bc0d + ab0 c0 + acd + a0 bcd
Exercise 2.39
f = a0b0 c + a0bc0 + a0 bc + ab0c = m1 + m2 + m3 + m5 = P m(1; 2; 3; 5)
f = (a + b + c)(a0 + b + c)(a0 + b0 + c)(a0 + b0 + c0 ) = M0 + M4 + M6 + M7 = Q M (0; 4; 6; 7)
Solutions Manual - Introduction to Digital Design - September 29, 2000 45
Exercise 2.40
(a)
a0b + ac + bc = a0 b(c + c0) + a(b + b0)c + (a + a0 )bc
= a0 bc + a0bc0 + abc + ab0 c + abc + a0bc
m3 + m2 + m7 + mY5 + m7 + m3
= X
= m(2; 3; 5; 7) = M (0; 1; 4; 6)
(b) g (a; b; c; d; e; f ) = (ab + c)(d0e + f ) = g1 (a; b; c)g2(d; e; f )
Since the g1 and g2 are disjoint, we may obtain their minterms separately and combine them later
to get the minterms for g (a; b; c; d; e; f ):
X Y
g1 (a; b; c) = ab + c = abc + abc0 + abc + a0 bc + ab0c + a0b0c = m(1; 3; 5; 6; 7) = M (0; 2; 4)
X Y
g2(d; e; f ) = d0e + f = d0ef + d0ef 0 + def + d0ef + de0f + d0e0f = m(1; 2; 3; 5; 7) = M (0; 4; 6)
If g1 has a minterm mi (a; b; c) and g2 has a minterm mj (d; e; f ), since the expression for g is
the AND of both expressions, g has the minterms m8i+j (a; b; c; d; e; f ) = mi (a; b; c):mj (d; e; f ).
Consequently, the minterms and maxterms of g are:
P
CSP: Q m( 9; 10; 11; 13; 15; 25; 26; 27; 29; 31; 41; 42; 43; 45; 47; 49; 50; 51; 53; 55; 57; 58; 59; 61; 63)
CPS: M ( 0; 1; 2; 3; 4; 5; 6; 7; 8; 12; 14; 16; 17; 18; 19; 20; 21; 22; 23; 24; 28; 30; 32; 33; 34; 35; 36; 37;
38; 39; 40; 44; 46; 48; 52; 54; 56; 60; 62)
(c)
a0 b(ab + c)(b + c0d) = (a0 bab + a0 bc)(b + c0 d) = a0bc(b + c0d)
= a0 bcb + a0 bcc0d = a0bc(d + d0 )
= a0 bcd + a0 bcd0
P
CSP: Q m(6; 7)
CPS: M (0; 1; 2; 3; 4; 5; 8; 9; 10; 11; 12; 13; 14; 15)
46 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.41
CSP equivalent:
E (x; y; z) = x0 + x(x0 y + y0 z)0
= x0 (y + y 0 )(z + z 0) + x((x0y )0:(y 0z )0)
= x0 yz + x0yz 0 + x0 y 0 z + x0 y 0z 0 + x(x + y 0 ):(y + z 0 )
= x0 yz + x0yz 0 + x0 y 0 z + x0 y 0z 0 + x(xy + xz 0 + y 0 y + y 0 z 0 )
= x0 yz + x0yz 0 + x0 y 0 z + x0 y 0z 0 + xy + xz 0 + xy 0z 0
= x0 yz + x0yz 0 + x0 y 0 z + x0 y 0z 0 + xy (z + z 0 ) + xz 0 (y + y 0 ) + xy 0z 0
= x0 yz + x0yz 0 + x0 y 0 z + x0 y 0z 0 + xyz + xyz 0 + xyz 0 + xy 0z 0 + xy 0z 0
x0 yz + x0yz0 + x0 y0 z + x0y 0z 0 + xyz + xyz 0 + xy 0z0
= X
= m(0; 1; 2; 3; 4; 6; 7)
CPS equivalent:
E (x; y; z) = x0 + x(x0y + y0 z)0
= (x0 + x):(x0 + (x0 y + y 0 z )0)
= x0 + (x0y )0(y 0z )0
= (x0 + (x0 y )0)(x0 + (y 0 z )0)
= (x0 + x + y 0)(x0 + y + z 0 )
= 1Y:(x0 + y + z 0 )
= M (5)
Solutions Manual - Introduction to Digital Design - September 29, 2000 47
Exercise 2.42
a) We rst convert to a sum of products
= a0bc(d + d0) + a0 d(b + b0)(c + c0) + ab0 c(d + d0) + b0d(a + a0)(c + c0)
= a0bcd + a0 bcd0 + a0bc0d + a0 b0cd + a0 b0c0d + ab0 cd + ab0 cd0 + ab0c0 d
In m-notation,
X
E (a; b; c; d) = m(1; 3; 5; 6; 7; 9; 10; 11)
b) We rst get a sum of products
Exercise 2.43
(a) E (w; x; y; z ) = xyz + yw + x0z 0 + xy 0
E (w; x; y; z) = x(yz + y 0) + yw + x0 z0
= x(y 0 + z ) + yw + x0z 0
= (x(y 0 + z ) + yw + x0 )(x(y 0 + z ) + yw + z 0)
= (y 0 + z + yw + x0)(xy 0 + z 0 + xz + yw)
= (w + x0 + y 0 + z )(xy 0 + x + z 0 + yw)
= (w + x0 + y 0 + z )(x + z 0 + yw)
= (w + x0 + y 0 + z )(w + x + z 0 )(x + y + z 0 )
= (x + x0 + y 0 + z )(w + x + y + z 0 )(w + x + y 0 + z 0)(w0 + x + y + z 0)
(b) E (a; b; c; d) = (abc + ab0)0(a0 b + c0)
Exercise 2.44
(a)
P m(0; 1; 3; 4; 11; 12; 14; 15) = Q M (2; 5; 6; 7; 8; 9; 10; 13)
Q P
(b) M (0; 1; 3; 5; 6; 9; 10; 13) = m(2; 4; 7; 8; 11; 12; 14; 15)
50 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.45
Y
f (x; y; z) = M (0; 1; 4; 6; 7)
g (x; y; z) = (f (x; y; z))0
X Y
g (x; y; z) = m(0; 1; 4; 6; 7) = M (2; 3; 5)
Solutions Manual - Introduction to Digital Design - September 29, 2000 51
Exercise 2.46
(a)
Input: A; B 2 f0; 1; 2; 3g and Cin 2 f0; 1g
Output: Z 2 f0; 1; 2; 3g and Cout 2 f0; 1g
Z = (A + B + Cin) mod 4
(
if (A + B + Cin ) 4
Cout = 01 otherwise
C
in A B C out Z i C in a1 a0 b1 b0 C out z1 z0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 1 1 0 0 0 0 1 0 0 1
0 0 2 0 2 2 0 0 0 1 0 0 1 0
0 0 3 0 3 3 0 0 0 1 1 0 1 1
0 1 0 0 1 4 0 0 1 0 0 0 0 1
0 1 1 0 2 5 0 0 1 0 1 0 1 0
0 1 2 0 3 6 0 0 1 1 0 0 1 1
0 1 3 1 0 7 0 0 1 1 1 1 0 0
0 2 0 0 2 8 0 1 0 0 0 0 1 0
0 2 1 0 3 9 0 1 0 0 1 0 1 1
0 2 2 1 0 10 0 1 0 1 0 1 0 0
0 2 3 1 1 11 0 1 0 1 1 1 0 1
0 3 0 0 3 12 0 1 1 0 0 0 1 1
0 3 1 1 0 13 0 1 1 0 1 1 0 0
0 3 2 1 1 14 0 1 1 1 0 1 0 1
(b) 0 3 3 1 2 (c) 15 0 1 1 1 1 1 1 0
1 0 0 0 1 16 1 0 0 0 0 0 0 1
1 0 1 0 2 17 1 0 0 0 1 0 1 0
1 0 2 0 3 18 1 0 0 1 0 0 1 1
1 0 3 1 0 19 1 0 0 1 1 1 0 0
1 1 0 0 2 20 1 0 1 0 0 0 1 0
1 1 1 0 3 21 1 0 1 0 1 0 1 1
1 1 2 1 0 22 1 0 1 1 0 1 0 0
1 1 3 1 1 23 1 0 1 1 1 1 0 1
1 2 0 0 3 24 1 1 0 0 0 0 1 1
1 2 1 1 0 25 1 1 0 0 1 1 0 0
1 2 2 1 1 26 1 1 0 1 0 1 0 1
1 2 3 1 2 27 1 1 0 1 1 1 1 0
1 3 0 1 0 28 1 1 1 0 0 1 0 0
1 3 1 1 1 29 1 1 1 0 1 1 0 1
1 3 2 1 2 30 1 1 1 1 0 1 1 0
1 3 3 1 3 31 1 1 1 1 1 1 1 1
one-set(Cout) = f7; 10; 11; 13; 14; 15; 19; 22; 23; 25; 26; 27; 28; 29; 30; 31g
one-set(z1) = f2; 3; 5; 6; 8; 9; 12; 15; 17; 18; 20; 21; 24; 27; 30; 31g
one-set(z0) = f1; 3; 4; 6; 9; 11; 12; 14; 16; 18; ; 21; 23; 24; 26; 29; 31g
52 Solutions Manual - Introduction to Digital Design - September 29, 2000
z
x Ctl=Decrement Ctl=Increment
0 15 1
1 0 2
2 1 3
3 2 4
4 3 5
5 4 6
6 5 7
7 6 8
8 7 9
9 8 10
10 9 11
11 10 12
12 11 13
13 12 14
14 13 15
15 14 0
Table 2.3: Exercise 2.47(b)
Exercise 2.47
(a)
Inputs: Integer( x 2 f0; : : :; 15g, control variable Ctl 2 fIncrement,Decrementg
Output: z = ((xx + 1) 1) mod 16 if Ctl=Increment
mod 16 if Ctl=Decrement
(b) See Table 2.3 on page 52.
(c) We have to choose a code for x, Ctl and z . Coding x as x = (x3; x2; x1; x0) and z as
z = (z3; z2; z1; z0), using the conventional binary representation. Coding Ctl as c in binary with 0
meaning Decrement and 1 meaning Increment. Table 2.4 on page 53 shows the tabular representa-
tion of the switching functions.
The zero sets are:
zero-set(z3)=f1; 2; 3; 4; 5; 6; 7; 8; 16; 17; 18; 19; 20; 21; 22; 31g
zero-set(z2)=f1; 2; 3; 4; 9; 10; 11; 12; 16; 17; 18; 23; 24; 25; 26; 31g
zero-set(z1)=f1; 2; 5; 6; 9; 10; 13; 14; 16; 19; 20; 23; 24; 27; 28; 31g
zero-set(z0)=f1; 3; 5; 7; 9; 11; 13; 15; 17; 19; 21; 23; 25; 27; 19; 31g
Solutions Manual - Introduction to Digital Design - September 29, 2000 53
cx3x2 x1x0
00 01 10 11
000 1111 0000 0001 0010
001 0011 0100 0101 0110
010 0111 1000 1001 1010
011 1011 1100 1101 1110
100 0001 0010 0011 0100
101 0101 0110 0111 1000
110 1001 1010 1011 1100
111 1101 1110 1111 0000
(z3; z2; z1; z0)
Table 2.4: Exercise 2.47(c)
Exercise 2.48
(a) A high-level description is
Input: x = (x3; x2; x1; x0), and xi 2 f0; 1g
Output: z 2 f0; 1; 2; 3; 4g
Function: 3
X
z = xi
i=0
(b) the table for arithmetic function and (c) the table for the switching functions considering binary
code for z are shown next:
x3x2 x1x0 z x3x2 x1x0 z2z1 z0
0000 0 0000 000
0001 1 0001 001
0010 1 0010 001
0011 2 0011 010
0100 1 0100 001
0101 2 0101 010
0110 2 0110 010
0111 3 0111 011
1000 1 1000 001
1001 2 1001 010
1010 2 1010 010
1011 3 1011 011
1100 2 1100 010
1101 3 1101 011
1110 3 1110 011
1111 4 1111 100
The one-sets that correspond to this table are:
one-set(z2 )=f15g
54 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.49
(a)
Inputs: x; y where x; y 2 f0; 1; 2; 3g
Output: z 2 f0; 1; 2; 3; 4; 6; 9g
Function: z = x y
(b) The table for the arithmetic function is
x; y 0 1 2 3
0 0 0 0 0
1 0 1 2 3
2 0 2 4 6
3 0 3 6 9
(c) considering binary representation for inputs and outputs we obtain the following table:
x y z
i x1 x0 y1 y0 z3 z2 z1 z0
0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 0
2 0 0 1 0 0 0 0 0
3 0 0 1 1 0 0 0 0
4 0 1 0 0 0 0 0 0
5 0 1 0 1 0 0 0 1
6 0 1 1 0 0 0 1 0
7 0 1 1 1 0 0 1 1
8 1 0 0 0 0 0 0 0
9 1 0 0 1 0 0 1 0
10 1 0 1 0 0 1 0 0
11 1 0 1 1 0 1 1 0
12 1 1 0 0 0 0 0 0
13 1 1 0 1 0 0 1 1
14 1 1 1 0 0 1 1 0
15 1 1 1 1 1 0 0 1
one-set(z3 ) = f15g
one-set(z2 ) = f10; 11; 14g
one-set(z1 ) = f6; 7; 9; 11; 13; 14g
one-set(z0 ) = f5; 7; 13; 15g
56 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.51
a)
Input: x | a decimal digit
Output: z | a decimal digit
Function: z = 9 x
b) The tables for the specied codes are shown in book. Inputs and outputs use the same code.
The exercise asks for only one case, but for the sake of completeness we show the solution for all
four cases.
b1) Tabular description of the function using Excess-6 code.
dec x = (x3; x2; x1; x0) z = (z3; z2; z1 ; z0)
0 0110 1111
1 0111 1110
2 1000 1101
3 1001 1100
4 1010 1011
5 1011 1010
6 1100 1001
7 1101 1000
8 1110 0111
9 1111 0110
z3 :one-set(6,7,8,9,10,11,12,13), dc-set(0,1,2,3,4,5)
z2 :one-set(6,7,8,9,14,15), dc-set(0,1,2,3,4,5)
z1 :one-set(6,7,10,11,14,15), dc-set(0,1,2,3,4,5)
z0 :one-set(6,8,10,12,14), dc-set(0,1,2,3,4,5)
c1) Switching expressions:
z3 = x3x02 + x3x2 x01 + x03 x2x1
z2 = x03 x2x1 + x3 x02x01 + x3x2 x1
z1 = x1
z0 = x00
b2) Tabular description of the function using 2-out-of-5 code.
dec x = (x4; x3; x2; x1; x0) z = (z4 ; z3; z2; z1; z0)
0 00011 00101
1 11000 01001
2 10100 10001
3 01100 00110
4 10010 01010
5 01010 10010
6 00110 01100
7 10001 10100
8 01001 11000
9 00101 00011
58 Solutions Manual - Introduction to Digital Design - September 29, 2000
The dc-set is the same for all output functions and correspond to
dc-set(0,1,2,4,7,8,11,13,14,15,16,19,21,22,23,25,26,27,28,29,30,31)
z4 :one-set(20,10,17,9)
z3 :one-set(24,18,6,9)
z2 :one-set(3,12,6,17)
z1 :one-set(12,18,10,5)
z0 :one-set(3,24,20,5)
c2) Switching expressions:
z4 = x4 x03 x2x01 x00 + x04 x3 x02x1 x00 + x4 x03 x02x01 x0 + x04 x3 x02 x01x0
z3 = x4 x3 x02x01 x00 + x4 x03 x02x1 x00 + x04 x03 x2x1 x00 + x04 x3 x02 x01x0
z2 = x04 x03 x02x1 x0 + x04 x3 x2x01 x00 + x04 x03 x2x1 x00 + x4 x03 x02 x01x0
z1 = x04 x3 x2x01 x00 + x4 x03 x02x1 x00 + x04 x3 x02x1 x00 + x04 x03 x2 x01x0
z0 = x04 x03 x02x1 x0 + x4 x3 x02x01 x00 + x4 x03 x2x01 x00 + x04 x03 x2 x01x0
b3) Tabular description of the function using 4,3,2,1 code. Since this code allows two representations
for some decimal values (such as 3 or 4) we adopted the representation with least number of 1 bits.
z3 :one-set(0,1,2,3,6), dc-set(3,5,7,9,11,15)
z2 :one-set(0,1,2,8,10), dc-set(3,5,7,9,11,15)
z1 :one-set(0,4,8,12), dc-set(3,5,7,9,11,15)
z0 :one-set(1,13), dc-set(3,5,7,9,11,15)
c3) Switching expressions:
Exercise 2.52
(a)
Input:
x = (x3; x2; x1; x0) 2 f0; 1g4
Output:
z = (z 1; z0), where z 1 and z0 are in the range [0; 9], and z = 10z 1 + z0 .
Function:
z1 = BCD(z 1) = (z7; z6; z5; z4) and z0 = BCD(z 0 ) = (z3 ; z2; z1; z0), with zi 2 f0; 1g
P
As the value of x is x = 3i=0 xi 2i , we dene the digit values z 1 and z 0 as:
z 1 = x div 10
z 0 = x mod 10
(b)
Since 0 x 15 then z 1 2 f0; 1g, and therefore:
z7 = z6 = z5 = 0
one-set(z4 ) = f10; 11; 12; 13; 14; 15g
one-set(z3 ) = f8; 9g
one-set(z2 ) = f4; 5; 6; 7; 14; 15g
one-set(z1 ) = f2; 3; 6; 7; 12; 13g
Since z0 = z 0 mod 2 = (x mod 10) mod 2 = x0 then z0 = x0 .
Therefore :
z7 = 0
z6 = 0
z5 = 0
z4 = x3x02x1 x00 + x3x02 x1x0 + x3x2x01 x00 + x3 x2x01 x0 + x3x2 x1 x00 + x3x2x1 x0 = x3(x1 + x2)
z3 = x3x02x01 x00 + x3x02 x01x0 = x3x02x01
z2 = x03x2x01 x00 + x03x2 x01x0 + x03x2x1 x00 + x03x2x1 x0 + x3 x2 x1x00 + x3x2 x1x0 = x03 x2 + x3 x2x1
z1 = x03x02x1 x00 + x03x02 x1x0 + x03x2x1 x00 + x03x2x1 x0 + x3 x2 x01x00 + x3x2 x01x0 = x03 x1 + x3 x2x01
z0 = x0
Solutions Manual - Introduction to Digital Design - September 29, 2000 61
Exercise 2.53
Let the inputs be a and b and the output w and z , all hexadecimal integers. A high-level description
is
(
w= a if a b
b otherwise
(
z= a if a < b
b otherwise
b) In the radix-2 representation all bit-vectors have four bits.
zi = ai (g + e) + bis
wi = bi(g + e) + ais
Switching expressions for g; e, and s are
Exercise 2.54
a) A high level description of the priority encoder can be given as:
Input: x = (x7; x6; :::; x1; x0), with xi 2 f0; 1g.
Output: integer 0 z 7
Function:
z = k; where xk = 1 and (xj = 0 for every j < k)
b) In order to obtain switching expressions more easily, we divide the priority encoder into two
subsystems: a priority resolution system and an encoder. This is shown in Figure 2.16 in the
textbook.
The priority resolution subsystem has the same number of outputs as inputs, and gives a 1 on the
output that corresponds to the highest priority input that has value 1. So, the switching expressions
for the priority resolutor are
w0 = x0
w1 = x1 x00
w2 = x2 x01x00
w3 = x3 x02x01 x00
w4 = x4 x03x02 x01 x00
w5 = x5 x04x03 x02 x01 x00
w6 = x6 x05x04 x03 x02 x01x00
w7 = x7 x06x05 x04 x03 x02x01 x00
The second part is an encoder. If the output is represented in the binary code, we obtain the
following table:
w7 w6 w5 w4 w3 w2 w1 w0 z2 z2 z0
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1 0 1
0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
Now we can write the output switching expressions:
z0 = w1 + w3 + w5 + w7
z1 = w2 + w3 + w6 + w7
z2 = w4 + w5 + w6 + w7
c) For the output in Gray code we obtain the table:
Solutions Manual - Introduction to Digital Design - September 29, 2000 63
w7 w6 w5 w4 w3 w2 w1 w0 z2 z1 z0
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 1 0 0 0 1 1
0 0 0 0 1 0 0 0 0 1 0
0 0 0 1 0 0 0 0 1 1 0
0 0 1 0 0 0 0 0 1 1 1
0 1 0 0 0 0 0 0 1 0 1
1 0 0 0 0 0 0 0 1 0 0
The output expressions are
z0 = w1 + w2 + w5 + w6
z1 = w2 + w3 + w4 + w5
z2 = w4 + w5 + w6 + w7
64 Solutions Manual - Introduction to Digital Design - September 29, 2000
Exercise 2.55
The combinational comparator module compares hexadecimal digits a and b. The output z has
three values called G; E , and S . A high-level specication is
8
>
< G if a > b
z = > E if a = b
: S if a < b
A tabular representation of this function is given next:
b
a 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 E S S S S S S S S S S S S S S S
1 G E S S S S S S S S S S S S S S
2 G G E S S S S S S S S S S S S S
3 G G G E S S S S S S S S S S S S
4 G G G G E S S S S S S S S S S S
5 G G G G G E S S S S S S S S S S
6 G G G G G G E S S S S S S S S S
7 G G G G G G G E S S S S S S S S
8 G G G G G G G G E S S S S S S S
9 G G G G G G G G G E S S S S S S
10 G G G G G G G G G G E S S S S S
11 G G G G G G G G G G G E S S S S
12 G G G G G G G G G G G G E S S S
13 G G G G G G G G G G G G G E S S
14 G G G G G G G G G G G G G G E S
15 G G G G G G G G G G G G G G G E
For the binary description, digit a is represented by the vector a = (a3 ; a2; a1; a0) and digit b is
represented by b = (b3; b2; b1; b0). We encode the output variable z using 3 bits as follows:
z z2 z1 z0
G 1 0 0
E 0 1 0
S 0 0 1
We can derive switching expressions for the outputs considering the equality variable ei (bits ai
and bi are equal) and the conditional conditional expressions. The switching expressions are:
as indicated in the hint, for the case a = b = 1 and c = d = 0, there is a path from VDD to ground
passing through transistors S8, S7, S2, and S1. Consequently, this circuit does not operate correctly.
A correct circuit circuit for this function is shown in gure 3.1.
V
DD
a b
d
z
a c d
Exercise 3.3 The network on Figure 3.21 of the book corresponds to the expression: (abc + d) .
0
This function is implemented using AND and NOR circuits and also complex gates approach as
shown in Figure 3.2.
V
DD
d
a b c
a z
b d
gure 3.3.
V
DD
x1
x0 z
x1
Exercise 3.5 The circuit is similar to the one presented as an example for a transmission gate
(Figure 3.8 of the textbook).
When s = 1, the transmission gate in the bottom is ON and the transmission gate at the top
is OFF. When s = 0, the opposite happens. So, a switching expression for the circuit is:
z = b:s + a:s 0
Solutions Manual - Introduction to Digital Design - October 3, 2000 43
Exercise 3.6
(a) the output load of gate 1 is 4, since this output is connected to 4 inputs of load 1.
(b) gate 6 has the output connected to two inputs (gates 7 and 8) with a total load of 4. The
remaining fanout of gate 6 is 4 loads (its original Fanout factor is 8).
44 Solutions Manual - Introduction to Digital Design - October 3, 2000
Exercise 3.7 Based on the gure, and knowing that the propagation delay is measured based
on 50% of the voltage level transition (input to output), the propagation delay time is:
GATE TIMING
Input
0.58 0.60
output L=1
0.73 0.85
output L=2
Exercise 3.9 (a) For a load factor of L = 70 the propagation delays are:
tpHL = 0:43 + 0:15 70 = 10:93ns
tpLH = 0:35 + 0:25 70 = 17:85ns
(b) Using a buer with load factor of 2 and propagation time given by tpHL(buer) = tpLH (buer) =
0:6 + 0:02L(ns), the network consisting of a gate followed by the buer has a delay:
tpHL (gate&buer) = 0:43 + 0:15 2 + 0:6 + 0:02 70 = 2:73ns
tpLH (gate&buer) = 0:35 + 0:25 2 + 0:6 + 0:02 70 = 2:85ns
(c) using two buers we get:
tpHL (gate&2-buers) = 0:43 + 0:15 4 + 0:6 + 0:02 35 = 2:33ns
tpLH (gate&2-buers) = 0:35 + 0:25 4 + 0:6 + 0:02 35 = 2:65ns
(d) Optimum number of buers can be obtained by the generalization of the delay equation,
considering n as the number of buers:
tpHL (gate&n-buers) = 0:43 + 0:15 2n + 0:6 + 0:02 d70=ne = 1:03 + 0:3n + 0:02 d70=ne
tpLH (gate&n-buers) = 0:35 + 0:25 2n + 0:6 + 0:02 d70=ne = 0:95 + 0:5n + 0:02 d70=ne
The function has a minimum. We can see that for n = 3, the delays increase to tpHL = 2:41
and tpLH = 2:93, when compared to delays for n = 2. So, the best number of buers is 2, and the
load should be distributed in only 2 sets.
Solutions Manual - Introduction to Digital Design - October 3, 2000 47
Exercise 3.10 From the gure we get the time tpLH = 3ns (12 ticks) and tpHL = 1:25ns (5
ticks).
48 Solutions Manual - Introduction to Digital Design - October 3, 2000
a VH (I N ) b;
g VL (OU T ) h;
c VL (I N ) d
and
V Lmax(OU T ) V Lmax(I N ) = h d
41
Chapter 4
42 Solutions Manual - Introduction to Digital Design - October 3, 2000
Exercise 4.1
(a) gure 4.17(a) presents a valid gate network
(b) the network in gure 4.17(b) is not valid since:
the load factor (L) imposed to one of the 2-input AND gates exceeds the fan-out factor (F)
of this gate;
two outputs are connected together.
(c)gure 4.17(c) presents a valid network.
Solutions Manual - Introduction to Digital Design - October 3, 2000 43
Exercise 4.2 There's no active loop in the network because variable b interrupts the loop in
two dierent points. When b = 0, the analysis of the network gives:
z1 = ad (4.1)
z0 = ad + c (4.2)
When b = 1, the output switching expressions are:
z1 = z0d (4.3)
z0 = e + c (4.4)
As we can see from the equations, there is no feedback of signals in the physical loop, and the
network is combinational.
44 Solutions Manual - Introduction to Digital Design - October 3, 2000
Exercise 4.3
FROM TO
Gate Type Inputs Output X A1
A AND-2 A1 A3 Y A2
A2 W B1
B AND-2 B1 B3 Z B2
Gates: B2 Connections: A3 D1
C AND-2 C1 C3 A3 C1
C2 B3 D2
D OR-2 D1 D3 B3 E1
D2 C3 R
E NOT E1 E2 D3 C2
E2 T
Solutions Manual - Introduction to Digital Design - October 3, 2000 45
Exercise 4.4 The network is shown in gure 4.1. It's a valid network.
R
A B
S
C E Z
T D
X
Y
Exercise 4.5
The network for this exercise is presented in Figure 4.2.
R A
B
S
Z
E C
T D
Exercise 4.7 :
The operation specied by
g (x; y; z) = x0 yz + xy0 + y 0z
is universal because g (x; 1; 1) = x0 realizes the NOT operation, and g (x; 0; z ) = x + z realizes the
OR operation. Since the set fOR; NOT g is universal, the g operation is also universal.
Solutions Manual - Introduction to Digital Design - October 3, 2000 49
Exercise 4.8 :
To show that the set fXNOR; ORg is universal it suces to show a realization of the NOT
operation. The XNOR operation is dened as
XNOR(x; y ) = xy + x0y 0
Assuming that the constant 0 is available, we have:
NOT (x) = XNOR(x; 0) = x:0 + x0 :1 = x0
50 Solutions Manual - Introduction to Digital Design - October 3, 2000
Exercise 4.9
The function * is: x y = x0y . Observe that this function is not commutative (x y 6= y x).
For this reason, the order of inputs must be observed. The NOT gate is obtained as
x0 = x0 1 = x 1
The AND gate is mapped to the * function as:
x y = (x0)0 y = x0 y = (x 1) y
The networks to obtain the NOT and AND gates from the \*" gate are shown in Figure 4.3.
Since the * gate can implement the set fNOT,ANDg, and the set fNOT,ANDg is universal, the *
gate is also universal.
x x’ x
xy
* *
1 1 *
y
NOT gate AND gate
Figure 4.3: Implementing a NOT and AND gates using the * gate
Solutions Manual - Introduction to Digital Design - October 3, 2000 51
Exercise 4.10
Using backward analysis, and the node names presented in gure 4.4.
x1
T2
z1
T1
x0 T3
z0
T4
Mixed logic notation could be used in this problem and the network could be transformed in
the one showed in gure 4.5. The equation obtained by backward analysis are now:
x1
T2
z1
T1
x0 T3
z0
T4
Exercise 4.11
We obtain the following expressions:
z = ((x01 + x2x1 + x1x0 )(x2x1 + x2 x0 + x02 )(x2x0 + x1 x0 + x00 ))0
= ((x01 + x2 + x0 )(x02 + x1 + x0)(x00 + x1 + x2 ))0
= (x01 + x2 + x0 )0 + (x02 + x1 + x0 )0 + (x00 + x1 + x2 )0
= x1 x02 x00 + x2x01 x00 + x0 x01 x02
that is, the output is 1 whenever exactly two of the inputs are 0.
Solutions Manual - Introduction to Digital Design - October 3, 2000 53
Exercise 4.12
We have:
z3 = x00
z2 = (x03 + x02)(x1 + x0 )(x01 + x00 )
z1 = (x3 + x0)(x02 + x1 )(x2 + x01 + x00)
z0 = x3 (x2 + x0 )(x2 + x1)
Exercise 4.13
(a)The switching expressions are:
Eout = Ein I00 I10 I20 I30 I40 I50 I60 I70
G = Ein Eout0
z0 = Ein(I7 + I60 I5 + I60 I50 I40 I3 + I60 I40 I20 I1 )
z1 = Ein(I7 + I6 + I60 I50 I40 I3 + I50 I40 I2)
z2 = Ein (I7 + I6 + I60 I5 + I4 )
(b)Since a high-level description is not obvious from these expressions, we evaluate and present
the following table:
Ein I7 I6 I5 I4 I3 I2 I1 I0 Eout G z2 z1 z0
0 - - - - - - - - 0 0 0 0 0
1 0 0 0 0 0 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 0 1 0 1 0 0 0
1 0 0 0 0 0 0 1 - 0 1 0 0 1
1 0 0 0 0 0 1 - - 0 1 0 1 0
1 0 0 0 0 1 - - - 0 1 0 1 1
1 0 0 0 1 - - - - 0 1 1 0 0
1 0 0 1 - - - - - 0 1 1 0 1
1 0 1 - - - - - - 0 1 1 1 0
1 1 - - - - - - - 0 1 1 1 1
To get a high-level description we assume that the bit-vector z is the radix-2 representation of
the integer z . From the table we obtain:
(
z = j0 if Ij = 1 and Ik otherwise
= 0 for k > j and Ein = 1 (4.5)
(
Eout = 1 if Ein = 1 and Ij = 0 for all j (4.6)
0 otherwise
(
G= 1 if Ein = 1 and Ij = 1 for some j (4.7)
0 otherwise
In words, let us call Ein the module (network) enable. Then:
Eout is 1 when the module is enabled and all Ii inputs are 0.
G is 1 if the module is enabled and at least one of the Ii inputs is 1.
z corresponds to the highest index of the inputs Ii with value 1.
Such a network is called a priority encoder (studied in Chapter 9).
(c) The load factor of each input is calculated considering that each AND or NOT gate has an
input factor of 1.
Solutions Manual - Introduction to Digital Design - October 3, 2000 55
Input Load Factor
Ein0 1
I70 2
I60 2
I50 2
I40 2
I30 2
I20 2
I10 2
I00 1
The maximum delay for the network is obtained considering number and type of gates of each
path from inputs to the outputs. The critical path in this case is the one that goes from input I60
to output z00 .
TpLH (I60 ; z00 ) = tpLH (NOT) + tpHL (NOT) + tpHL (AND-5) + tpHL(OR-4) + tpLH (NOT)
TpLH (I60 ; z00 ) = (0:02 + 0:038 2) + (0:05 + 0:017 3) + T1 + (0:45 + 0:025 1) + (0:02 + 0:038 L)
TpLH (I60 ; z00 ) = 0:692 + T1 + 0:038 L
TpHL(I60 ; z00 ) = tpHL (NOT) + tpLH (NOT) + tpLH (AND-5) + tpLH (OR-4) + tpHL (NOT)
TpHL(I60 ; z00 ) = (0:05 + 0:017 2) + (0:02 + 0:038 3) + T2 + (0:13 + 0:038 1) + (0:05 + 0:017 L)
TpHL(I60 ; z00 ) = 0:436 + T2 + 0:017 L
where T1 and T2 are the HL and LH propagation delays for an AND gate with 5 inputs and
load factor of 1, respectively. The values of T1 and T2 are obtained by decomposition of the AND-5
gate into the gates listed in Table 3.1 of the book. This decomposition is:
AND(x4; x3; x2; x1; x0) = AND(AND(x4; x3; x2); AND(x1; x0))
The resulting delays are:
T1 = tpHL(AND-3) + tpHL (AND-2) = 0:18 + 0:018 + 0:16 + 0:017L = 0:358 + 0:017L = 0:392
T2 = tpLH (AND-3) + tpLH (AND-2) = 0:2 + 0:038 + 0:15 + 0:037L = 0:388 + 0:037L = 0:462
AND-5
I6’ A B C z0 z0’
AND3 AND2 OR4
I6’
0.084 0.096
A
0.101
0.134
B
0.392
0.462
C
0.168 0.475
z
0.05+0.017L
0.02+0.038L
z0’
The values of T1 ; T2; T3 and T4 are obtained by decomposition of the AND-5 and OR-8 gates
into the gates listed in Table 3.1 of the book. This decomposition is:
AND(x4; x3; x2; x1; x0) = AND(AND(x4; x3; x2); AND(x1; x0))
and
OR(x7; x6; : : :; x1; x0) = OR(OR(x7; x6; x5; x4); OR(x3; x2; x1; x0)
The resulting delays are:
T1 = tpLH (AND-3) + tpLH (AND-2) = 0:2 + 0:038 + 0:15 + 0:037 = 0:43
T2 = tpHL(AND-3) + tpHL (AND-2) = 0:18 + 0:018 + 0:16 + 0:017 = 0:38
T3 = tpLH (OR-4) + tpLH (OR-2) = 0:13 + 0:038 + 0:12 + 0:037(L1 + 1) = 0:33 + 0:037L1
T4 = tpHL(OR-4) + tpHL(OR-2) = 0:45 + 0:025 + 0:2 + 0:019(L1 + 1) = 0:69 + 0:019L1
(d) timing diagram presented in gure 4.7.
58 Solutions Manual - Introduction to Digital Design - October 3, 2000
AND-5 OR-8
s2 A B C z z’
AND3 AND2 OR4 OR2
s2
0.14 0.21
A
0.12
0.17
B
0.38
0.43
C
0.33+0.037L1 0.69+0.019L1
z
0.05+0.017L2
0.02+0.038L2
z’
Exercise 4.15
We dene the modules as indicated in gure 4.8. For module M1 we obtain the switching
expression:
y = (abc + ab0c0 + a0bc0 + a0b0c)0
A high-level description is:
(
y = 10 otherwise
if there are 0 or 2 inputs with value 1 (4.8)
I8 I7 I6 I5 I4 I3 I2 I1 I0
a b c a b c a b c
M1 M1 M1
y y y
e f g
M2
z1 z0
Delay of the network is obtained by the following expression for the path from input I2 to
output z1 :
TpHL(I2 z1) = tpHL (NOT ) + tpLH (OR-4) + tpLH (AND-3) + tpLH (NOT) +
tpHL (NOT) + tpLH (OR-4) + tpLH (AND-3) + tpLH (NOT) + tpHL(NOT)
= 0:05 + 0:017L + 0:13 + 0:038 1 + 0:2 + 0:038 1 + 0:02 + 0:038 4 +
0:05 + 0:017 5 + 0:13 + 0:038 1 + 0:2 + 0:038 1 + 0:02 + 0:038 2 +
0:05 + 0:017 3
= 1:37 + 0:017L
60 Solutions Manual - Introduction to Digital Design - October 3, 2000
C A B A B A B A B
0 0 0 1 1 2 2 3 3
M0 M0 M0 M0
y z
x
x0 x1 x2 x3
M1 M2 M3 M4
c0
c1 c2 c3
M5 M5 M5 M5
S S S S C
0 1 2 3 4
Chapter 5
56 Solutions Manual - Introduction to Digital Design - October 3, 2000
Exercise 5.1
z z
0 1 0 1 - 0 1 1
x 0 1 0 0 x - 0 0 1
f1 y f0 y
Solutions Manual - Introduction to Digital Design - October 3, 2000 57
Exercise 5.2
(a) the K-map for E (x; y; z ) =
P m(1; 5; 7) is:
z
0 1 0 0
x 0 1 1 0
y
(b)E (w; x; y; z ) = w x y + y z + xz
0 0 0 0
z
0 1 1 1
1 1 0 1
x
1 1 0 1
w
0 1 0 0
y
58 Solutions Manual - Introduction to Digital Design - October 3, 2000
Exercise 5.3
Q P
(a) E (w; x; y; z ) = M (1; 3; 4; 7; 10; 13; 14; 15) = m(0; 2; 5; 6; 8; 9; 11; 12)
z
1 0 0 1
0 1 0 1
x
1 0 0 0
w
1 1 1 0
y
(b)E (w; x; y; z ) =
P m(0; 4; 5; 9; 11; 14; 15); dc(w; x; y; z ) = P m(2; 8)
z
1 0 0 -
1 1 0 0
x
0 0 1 1
w
- 1 1 0
y
P
(c) E (x; y; z ) = m(0; 1; 4; 6) = Q M (2; 3; 5; 7)
z
1 1 0 0
x 1 0 0 1
y
Solutions Manual - Introduction to Digital Design - October 3, 2000 59
Exercise 5.4 f (w; x; y; z) = P m(0; 1; 2; 3; 5; 7; 8; 10; 11; 15)
(a) Kmap and prime implicants
z
1
1 1
1
0
1 1 0
x
0 0 1 0
w
1 0
1 1
y
prime implicants: w x ; w z; x y; yz; x z
0 0 0 0 0 0
Exercise 5.5
(a) More implicants than minterms
z
0
1
1 0
x 0 0 0 0
y
implicants: x yz; x y z , and x z
0 0 0 0
minterms: x yz and x y z
0 0 0
minterm: x y z
0 0 0
Solutions Manual - Introduction to Digital Design - October 3, 2000 61
Exercise 5.6
Q P
(a) E (w; x; y; z ) = M (1; 3; 4; 7; 10; 13; 14; 15) = m(0; 2; 5; 6; 8; 9; 11; 12)
z
1 0 0
1
0
1 0
1 x
1 0 0 0
w
1
1 1 0
y
x
1
0 0 1
0
1 0 1
w
1
0
0 0
z
1 1 1
0
y
(b)E (w; x; y; z ) =
P m(0; 4; 5; 9; 11; 14; 15); dc(w; x; y; z ) = P m(2; 8)
z
-
1 0 0
1 1
0 0 x
0 0
1 1
w
-
1 1 0
y
minimal SP: w y z + w y x + wx z + wxy
0 0 0 0 0 0
z
1 0
0
-
1 1
0 0 x
0 0 1 1
w
- 1 1 0
y
minimal PS: (w+x+z')(w+y')(x+y'+z)(w'+x'+y)
P Q
(c) E (x; y; z ) = m(0; 1; 4; 6) = M (2; 3; 5; 7)
z
1 1 0 0
x 1 0 0
1
y
minimal sum of products: x y + xz 0 0 0
z
1 1
0 0
x 1
0 0 1
y
minimal product of sums: (x + y )(x + z ) 0 0 0
Solutions Manual - Introduction to Digital Design - October 3, 2000 63
Exercise 5.7
f (w; x; y; z) = one set(1; 5; 7; 8; 9; 10; 14)
z
0 1
0 0
0
1 1
0 x
0 0 0 1
w
1 1
0 1
y
(a) prime implicates are:
(w + z ); (w + x + y ); (x + y + z ); (w + y + z ); (w + x + z ); (w + x + y ); (x + y + z )
0 0 0 0 0 0 0 0 0 0 0 0
the solution is not unique because there are other ways to cover the 0-cells (not covered by the
essential prime implicate) with the same number of terms.
64 Solutions Manual - Introduction to Digital Design - October 3, 2000
Exercise 5.8
Input: (a; b; c; d), with a; b; c; d 2 f0; 1g
Output: y 2 f0; 1g
Function: (
y = 10 if (8a + 4botherwise
+ 2c + d) is prime
and the gate network that implements this expression is shown in Figure 5.1.
d
0 0 1 1
0 1 1 0
b
0 1
0 0
a
0 0 1 0
c
Solutions Manual - Introduction to Digital Design - October 3, 2000 65
b’
c
d
a’
b’
c y
b
c’
d
a’
c
d
Figure 5.1: AND-OR gate network for \prime detector" (Exercise 5.8)
From the Kmap we get the following prime implicates: (b + d); (a + d); (b + c); (c + d) and (a +
0 0 0
b + c ). Only the (c + d) prime implicate is not essential. So, the minimal product of sums in this
0 0
case is:
y = (b + d)(a + d)(b + c)(a + b + c )
0 0 0 0 0
and the gate network that implements this expression is shown in Figure 5.2. Notice that the cost
of the product of sums is lower.
b’
d
a’
d
y
b
c
a’
b’
c’
Figure 5.2: OR-AND gate network for \prime detector" (Exercise 5.8)
66 Solutions Manual - Introduction to Digital Design - October 3, 2000
Exercise 5.9
To repeat the Exercise 5.8 using the Quine-McCluskey minimization method we make use of
two tables. The rst table is used to obtain the prime implicants and the second to select the
minimum cover.
The one set for this function is one set= f2; 3; 5; 7; 11; 13g
Minterms 3-literal Prods 2-literal Prods 1-literal Prods
0010 N 001-
0011 N -101
0101 N -011
0-11
0111 N 01-1
1011 N
1101 N
The second table consider the prime-implicants obtained in the previous table:
Prime Implicants 2 3 5 7 11 13 Essential
001- x x
-101 x x
-011 x x
0-11 x x
01-1 x x
Based on the table, the function is represented by 3 essential terms and the minterm 7 must be
covered with either 0 11 or 01 1. The minimal SP expressions are:
y = a b c + bc d + b cd + a cd
0 0 0 0 0
or
y = a b c + bc d + b cd + a bd
0 0 0 0 0
Solutions Manual - Introduction to Digital Design - October 3, 2000 67
Exercise 5.10 A high-level description for this system is:
Input: a; b; c; d; e 2 f0; 1g
Output: f 2 f0; 1g
Function: (
(a + b + c + d + e) 3
f = 10 ifotherwise
Using Quine-McCluskey minimization method we obtain the following table:
Minterms 4-literal products 3-literal products
00111 N 0-111 N --111
01011 N -0111 N -1-11
10011 N 01-11 N 1--11
01101 N 10-11 N -11-1
10101 N 1-011 N 1-1-1
11001 N 011-1 N 11- -1
01110 N -1101 N -111-
10110 N 101-1 N 1-11-
11010 N 1-101 N 11-1-
11100 N 110-1 N 111--
11-01 N
01111 N 0111- N
10111 N -1110 N
11011 N 1011- N
11101 N 1-110 N
11110 N 1101- N
11-10 N
11111 N 1110- N
111-0 N
-1111 N
1-111 N
11-11 N
111-1 N
1111- N
To obtain a cover for the minterms we use a second table to identify the essential prime impli-
cants, as shown below:
7 11 13 14 15 19 21 22 23 25 26 27 28 29 30 31 Essential Prime
- -111 x x x x
-1-11 x x x x
1--11 x x x x
-11-1 x x x x
1-1-1 x x x x
11- -1 x x x x
-111- x x x x
1-11- x x x x
11-1- x x x x
111-- x x x x
All the terms obtained in the rst table are essential prime implicants. The minimal expression
is:
f = abc + abd + abe + acd + ace + ade + bcd + bce + bde + cde
68 Solutions Manual - Introduction to Digital Design - October 3, 2000
and the corresponding two-level gate network is shown in Figure 5.3 on page 68. Note that the OR
gate has 10 inputs, which might make a two-level implementation impractical.
a
b
d
a
b
c
b
c
d
a
c
d
c
d
e f
b
c
e
b
d
e
a
b
e
a
d
e
a
c
e
+a b c e + a b d e + a c d e + b c d e
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
The gate network that implements the function f is shown in Figure 5.4. Note that the OR
gate has 15 inputs, which might make a two-level implementation impractical.
70 Solutions Manual - Introduction to Digital Design - October 3, 2000
a
b
c
a
b
d
a
c
d
b
c
d
a
b
e
a
c
e
a
d
e
b
c f
e
b
d
e
c
d
e a’
b’
c’
a’ e’
b’
d’
e’ a’
c’
d’
b’ e’
c’
d’
e’
a’
b’
c’
d’
Output: z 2 f0; 1; 2; 3; 4; 5; 6; 7g
Function: z = a + b + cin
The input is represented by 2-bit vectors (a1; a0) and (b1; b0), and the output is represented
by a 3-bit vector z = (z2; z1; z0). Using Quine-McCluskey tabular method we obtain the following
tables, based on the switching function table presented in Exercise 2.46. The synthesis for z0 is
shown in Table 5.2, z1 is shown in Table 5.3, and z2 is shown in Table 5.4.
72 Solutions Manual - Introduction to Digital Design - October 3, 2000
+ x1 x0y1 c + x1 y1 y0 c + x1 x0 y1 y0
in in
+ x1 x0y1 c + x1 y1 y0 c + x1 x0 y1 y0
0 0 0
in
0 0 0
in
0 0 0
+ x1 y1 y0 c + x1 x0 y1 c + x1 x0 y1 y0
0 0 0
in
0 0 0
in
0 0 0
The AND-OR networks are shown in Figure 5.5. They assume that the complement of inputs are
also available. Because of the large number of inputs to the OR gates, a two-level implementation
might not be practical.
x0
y0
cin
x0’
y0’
cin z0
x0 x1
y0’
cin’ y1
x0’ x1
y0 x0
cin’ y0 z2
Exercise 5.13
Input: x in the range [0; 15]
Output: y in the range [0; 7]
Function: y = x mod 7
The switching functions are shown in the table
x = (x3 x2x1 x0 ) y = (y2 y1 y0)
0000 000
0001 001
0010 010
0011 011
0100 100
0101 101
0110 110
0111 000
1000 001
1001 010
1010 011
1011 100
1100 101
1101 110
1110 000
1111 001
From K-maps (not shown) we obtain the following minimal switching expressions
y2 = (x3 + x2 )(x2 + x1 + x0)(x3 + x1 + x0 )(x2 + x1)
0 0 0 0 0
= x2 x1 + x3 x2x1 x0 + x3 x2 x0
0 0 0 0
Using the lowest cost version of the network that produces each output, we obtain the gate
network shown in Figure 5.6.
Solutions Manual - Introduction to Digital Design - October 3, 2000 77
x2
x1’
x3’ y2
x2 x3
x0’
x3 x0
x2’
x1 x3’
x0 x2
x0’
x3 x3’ y0
x1’ x1
x0 x0’
x3’ x2’
x2’ y1
x1’
x1 x0
x3’ x3
x1 x2’
x0’ x1’
x2’
x1
x0’
From the table we get the following K-maps and expressions for the multiplier binary outputs:
y0 y0 y0
0 0 0 0 0 0 0 0 0 0 0 0
0 0 0
0 x0 0 0
1 1 x
0
0 1 1 0 x
0
0 0
x1 0 1
x1 0 1 0
1
x1 0 1 1
0
0 0
1 1
0
1 1 0 0 0 0 0
z2 y1 z1 y1 z0 y1
z 0 = x 0 y0
z1 = x1x0 y0 + x0y1y0 + x1x0y1 + x1y1 y0
0 0 0 0
z2 = x1x0y1 + x1y1 y0
0 0
Output z3 corresponds to only one minterm (no Kmap is needed in this case):
z3 = x1x0 y1y0
The NAND-NAND network is obtained directly from the sum of products. The correspoding
network is presented in Figure 5.7.
x0
z0
y0
x1
x0’
y0
x0
y1
y0’ z1
x1’
x0
y1
x1
y1’
y0
x1
x0’
y1 z2
x1
y1
y0’
x1
x0 z3
y1
y0
Function: g is the Gray code that corresponds to b. The correspondence between binary and
Gray codes is shown in the following table:
Binary Gray
b3 b2b1 b0 g3g2 g1g0
0000 0000
0001 0001
0010 0011
0011 0010
0100 0110
0101 0111
0110 0101
0111 0100
1000 1100
1001 1101
1010 1111
1011 1110
1100 1010
1101 1011
1110 1001
1111 1000
The correspoding Kmaps are as follows:
g3 g2
b0 b0
0 0 0 0
0 0 0 0
0 0 0 0
b2 1 1 1 1
b2
1 1 1 1 0 0 0 0
b3 b3
1 1 1 1 1 1 1 1
b1 b1
g1 g0
b0 b0
0 0 1 1
0 1 0 1
1 1 0 0 0 1 0 1
b2 b2
1 1
0 0 0 1 0 1
b3 b3
0 0 1 1
0 1
0 1
b1 b1
80 Solutions Manual - Introduction to Digital Design - October 3, 2000
g1 = (b1 + b2)(b1 + b2 )
0 0
g0 = (b0 + b1)(b0 + b1 )
0 0
b0
b1
g0
b0’
b1’
b1
b2
g1
b1’
b2’
b2
b3
g2
b2’
b3’
b3 g3
Exercise 5.16
Using Quine-McCluskey minimization method to solve Exercise 5.15 we get Tables 5.5, 5.6, 5.7,
and 5.8. Minterms are obtained from the switching function presented in Exercise 5.15. From the
QM tables we obtain the expressions:
g3 = b3
g2 = b2b3 + b2b3
0 0
g1 = b1b2 + b1b2
0 0
g0 = b0b1 + b0b1
0 0
82 Solutions Manual - Introduction to Digital Design - October 3, 2000
x6 x5 x4 x3 x2 x1 x0 z
A 1 0 0 0 1 0 0 1
B 1 0 0 0 1 0 1 0
C 1 0 0 0 1 0 1 1
D 1 0 0 0 1 1 0 0
E 1 0 0 0 1 1 0 1
otherwise 0
Since all combinations producing output 1 have x6 x5x4 x3 = 1000, we dene m = x6x5 x4 x3. 0 0 0
A two-level NAND network is obtained from this expression. It has 3 6-input NAND gates and
one 3-input NAND gate. The description of it is:
NAND(NAND(x6; x5; x4; x3; x2; x1); NAND(x6; x5; x4; x3; x2; x0); NAND(x6; x5; x4; x3; x2; x1))
0 0 0 0 0 0 0 0 0 0 0 0
The gate networks are easily obtained from these expressions and descriptions.
84 Solutions Manual - Introduction to Digital Design - October 3, 2000
y3 = x2 x1 x0 + x2 x1x0
0 0
y4 = x2 x1 + x2 x0
0
y5 = x2 x1
y6 = x3
x3 x2 x1 x0
OR Array
AND Array
y6 y5 y4 y3 y2 y1 y0
-- programmable connection
-- connection made
Exercise 5.19 The high-level specication for this system is:
Function: e = b
The conversion of a BCD code, represented as b = (b3; b2; b1; b0) to an Excess-3 code, represented
by e = (e3; e2 ; e1; e0), is dened by the following K-maps:
86 Solutions Manual - Introduction to Digital Design - October 3, 2000
b0 b0
0 0 0 0
0 1
1 1
0 1 1 1 1 0 0 0
b2 b
-
-
--
- - - - 2
b3 b3
1 1 - -
0 1 - -
e3 : b1 e2 : b1
b0 b0
1 0 1 0 1 0 0 1
1 0 1 0 1 0 0 1
b b
- - - - 2 - - - - 2
b3 b3
1 0 -
- 1 0 - -
e1 : b1 e0 : b1
The minimal sum of products are:
e3 = b1b2 + b0b2 + b3
e2 = b1b2 + b0b2 + b2b1b0
0 0 0 0
e1 = b1b0 + b1b0
0 0
e0 = b0
0
b3 b2 b1 b0
OR Array
AND Array
e3 e2 e1 e0
-- programmable connection
-- connection made
x0 x0 x0
- - 1 -
-
- 1 - - - 0 -
0 0 0 0 x
2 0 0
1 0 x
0 1 0 1 x
2
- - - - - - - - -
2
x4
1 0
x4 x4
1
0 0 1 1 1 1 0 0 0
1 0 0
y0 : x1 y1 : x1 y2 : x1
88 Solutions Manual - Introduction to Digital Design - October 3, 2000
x0 x0
- - 1 -
- - 0 -
0 0 0 1 x 1
1 1 0 x
2
- -
- - - -
2
x4 0 x4 0
0 1 1 0 0 0 0
1
y3 : x1 y4 : x1
Using the K-maps we obtain the following minimal expressions for output y = (y4 ; y3; y2; y1; y0 ):
y0 = x3x2 + x2x1
0
y1 = x2x1 + x3x1 x0
0 0 0
y3 = x2x0 + x2x1 x0
0 0
I1
x0 0 4 8 12 16 20 24 28
O1
y0
I2
x1 8
IO2
y1
I3
x2
16
IO3
y2
I4
x3 24
IO4
y3
I5
Enable 32
IO5
y4
I6
40
IO6
I7
48
IO7
I8
56
O8
I9 I10
I1
x0 0 4 8 12 16 20 24 28
O1
y0
I2
x1 8
IO2
y1
I3
x2
16
IO3
y2
I4
x3 24
IO4
y3
I5
enable 32
IO5
y4
I6
40
IO6
y5
I7
48
IO7
I8
56
O8
I9 I10
Chapter 6
Exercise 6.1 From Exercise 5.11, we know that the single-error detector for a 2-out-of-5 code
(a; b; c; d; e) is implemented by the expression:
E (a; b; c; d; e) = abc + abd + acd + bcd + abe + ace + ade + bce + bde + cde + a b c e + a b d e +
0 0 0 0 0 0 0 0
acde +bcde
0 0 0 0 0 0 0 0
Using only gates from Table 4.1 of the textbook we can generate all product terms but the
OR operation of all 14 product terms must be implemented by a tree of gates. To minimize the
delay in the implementation, we should use NAND gates. The generation of the product terms is
done using 3 and 4-input NAND gates from Table 4.1. A 14-input NAND however is not available
and should be obtained combining smaller gates. The large NAND gate may be decomposed into
smaller ones as follows (for a 4-input NAND to 2-input NANDs):
(abcd) = (ab) + (cd)
0 0 0
a
b
c
a
b
d
a
c
d
b
c
d
a
b
e
a
c
e
a
d f(a,b,c,d,e)
e
b
c
e
b
d
e
c
d
e
a’
b’
c’
e’
a’
b’
d’
e’
a’
c’
d’
e’
b’
c’
d’
e’
= (x0 y0 ) cin
s1 = x1 (x0y1 cin + y1 y0cin + x0 y1y0 + x0y1 cin + y1 y0 cin + x0 y1 y0 )
0 0 0 0 0 0 0 0 0 0
= x1 (y1A + y1 B ) + x1 (y1A + y1 B )
0 0 0
where A = x0cin + y0 cin + x0y0 and B = x0cin + y0 cin + x0y0 . It can be shown that B = A , and
0 0 0 0 0 0 0
= x1 y1 + x1 y1 A + x1y1 A 0 0
= x1 y1 + (x1 y1 + x1 y1 )A = x1 y1 + (x1 y1 )A 0 0
The expression for A can also be transformed to the following more convenient form:
A = x0 cin + y0 cin + x0 y0
= x0 (cin + y0 ) + y0 (cin + x0)
= x0 (ciny0 + y0 ) + y0 (cin x0 + x0 ) 0 0
= x0 cin y0 + x0 y0 + y0 cin x0 0 0
= (x0 y0 )cin + x0 y0
The gate network is shown in Figure 6.2 on page 88.
88 Solutions Manual - Introduction to Digital Design - November 2, 2000
x0
y0 s0
cin
A
s1
x1
y1
cout
y3 = y2 = 0
y1 = x3 + x2 x1 x0
y0 = x2 x1 + x2x0
0 0
z3 = x2 x1x0 + x2x1 x0
0 0
z2 = x3 + x2 x1x0 + x2x1x0
0 0 0
z0 = x0
The (NAND; NAND) network is shown in Figure 6.3.
90 Solutions Manual - Introduction to Digital Design - November 2, 2000
0 y3
0 y2
x3’
y1
x2
x1
x0
x2
x1’ y0 x2
x1’
x2 x0’
x0’ x2’ z1
x1’
x2
x0
x1
x0’ z3 x2’
x2’ x1
x1 x0’
x0
x3’
x2
z0
x1’ x0
x0 z2
x2’
x1
x0’
Equal = w3w2w1w0
Greater = a3 b3 + w3a2 b2 + w3 w2a1 b1 + w3w2w1a0 b0
0 0 0 0
where wi = ai bi + ai bi
0 0
a3 w3
w2 y0
w3 w1
w0
a3
b3
b3’
w3
a2
a2 w2 b2’
W y1
b2 w3
w2
a1 a1
w1 b1’
b1 W
w3
w2
a0 w0 w1
b0 W a0
b0’
y2 w2 y1 w1 y0 w0
x0
x1 O1
x2 2-AND/NOR2
N1
N2 N3 N4
ANx
A1 A2 A3 AN4 N6
N5
O2 z0
z1
z2
Load factor: 1
Network size: The NOT gates have size 1 and all others have size 2, thus the network has 23
equivalent gates. The size of the network on Example 4.6 was 38 equivalent gates.
Number of levels: 6
where SAME (x; y ) = xy + x y = (x y ). Since xy , x y and SAME (x; y ) are mutually exclusive,
0 0 0 0 0
z1 = E = (x1 y1 )(x0 y0 ) 0 0
The NOT gate is implemented using a XOR gate as: x = x 1. Thus, we can transform the
0
y1’ x1 z2=G
y1
1
y0 y0’ x0
1
x1 x1’
z0=S
1 y1
x0 x0’
1 y0
z1=E
x1
x0
DIFFERENT = x y
Using these expressions, we obtain the expression for each output, z2(GREATER), z1 (EQUAL)
and z0 (LESS) as:
z2 = DIFFERENT:x + SAME:c2
z1 = SAME:c1
z0 = DIFFERENT:y + SAME:c0
The gate network using XOR and NAND gates is shown in Figure 6.7, on page 97.
x’ SAME
z1
y
c1
c2
z2
x
x DIFFERENT
y
y z0
c0
z0
xo
x1 z1
x2 z2
z3
x3
and using this function we want to represent the following functions using muxes:
OR(a; b) = a + b = ab + b = MUX(a; 1; b )
0 0
XOR(a; b) = a b = a b + ab = MUX(a ; a; b)
0 0 0
XNOR(a; b) = a b = ab + a b = MUX(a; a ; b)
0 0 0 0
100 Solutions Manual - Introduction to Digital Design - November 2, 2000
Exercise 6.10 From the network in Figure 6.13 we can obtain the following expressions for the
selection signal s (which controls the rightmost multiplexers), and the output signals z1 and z2 :
s = ab + a b = (a b)
0 0 0
z1 = cs + c s 0 0
= cs 0
= abc
z2 = bs + cs 0
= b(ab + a b ) + c(ab + a b)
0 0 0 0
= ab + ab c + a bc0 0
= a(b + b c) + b(a + a c)
0 0
= a(b + c) + b(a + c)
= ab + ac + bc
From the boolean expressions we can see that z1 = a b c corresponds to the high-level
description:
z1 = (a + b + c) mod 2
and z2 = 1 when 2 or more inputs have the value 1. These equations correspond to sum and
carry-out outputs of a one-bit adder, with inputs a; b, and c.
Solutions Manual - Introduction to Digital Design - November 2, 2000 101
Exercise 6.11 Tree of multiplexers:
Part (a) E (a; b; c; d) = a b + a b c + bc d + abd + b cd
0 0 0 0 0 0 0
E (a; b; 1; 0) = a b + ab = b
0
E (a; b; 1; 1) = a b + b = a + b = (ab)
0 0 0 0 0
From these expressions we obtain the tree of multiplexers as shown in Figure 6.9.
a’ E(a,b,1,1)
1 1 E(a,b,c,1)
MUX MUX 1 E(a,b,c,d)
E(a,b,0,1)
1 0 0 MUX
E(a,b,c,0)
0
b c
d
a’ 1 b 1
MUX
MUX
0 E(a,b,0,0)
1 0
b’
c
0010 (a b) 0
0011 ab
0100 (a b) 0
0101 ab
0110 ab
0111 (a b) 0
1000 (a b) 0
1001 ab
1010 ab
1011 (a b) 0
1100 ab
1101 (a b) 0
1110 (a b) 0
1111 ab
102 Solutions Manual - Introduction to Digital Design - November 2, 2000
The straight implementation of the tree of multiplexers will look like the network shown in Figure
6.10(a). Simplifying the network by removing the repeated terms we obtain the network shown in
Figure 6.10(b), that looks more like a linear array than a tree, but has the same number of levels
and less muxes.
s 1
MUX a’ 1
s’ s=a’b+ab’
0 MUX
0
a
c
1 b a 1 s’
s’ MUX
MUX
0
a’ 0
s
c b
1
s’ 1 MUX
MUX 0
s 0
c d
s 1 1 1
MUX MUX MUX
s’ 0 0 0
1 E(a,b,c,d,e,f)
MUX
c d e 0
s’ 1 1 1
MUX MUX MUX
0 0 0
f
s
c d e
a’ 1
s=a’b+ab’
s 1
1
1 1 1
MUX MUX MUX MUX MUX
MUX
s’ 0 0 0 0 0
0 a
1 E(a,b,c,d,e,f)
MUX
c b c d e
d 0
s 1 a 1 1 1 1
MUX
s’
MUX MUX MUX MUX
s’ 0 f
a’ 0 0 0 0
c c
b d e
s’ 1
MUX (a) full multiplexer tree network (b) simplified network
s 0
Figure 6.10: Multiplexer network for Exercise 6.11 - part (b) - E (a; b; c; d; e; f ) = a b c d e f
A better multiplexer tree network is realized considering the implementation of the XOR and
XNOR functions by multiplexers (Exercise 6.9) and the associativity of the XOR function as follows:
a b c d e f = [(a b) (c d)] (e f )
The network for this case is presented in Figure 6.11. Observe that it has only 3 levels of multiplexers
in the critical path and 7 multiplexers. The previous implementation had 5 levels and used 9
multiplexers.
Solutions Manual - Introduction to Digital Design - November 2, 2000 103
1
a’ 1 a xor b MUX
MUX 0
1 E(a,b,c,d,e,f)
a 0
MUX
0
b 1
MUX 0
a’ 0
e’ 1
b MUX e xor f
e 0
c’ 1 c xor d
MUX
c 0 f
Figure 6.11: Implementation using XOR property to solve Exercise 6.11(b) - E (a; b; c; d; e; f ) =
abcdef
104 Solutions Manual - Introduction to Digital Design - November 2, 2000
Exercise 6.12 From Exercise 6.6, and considering that the input numbers are represented as
x = (x1; x0) and y = (y1; y0 ), we have the following expressions for the outputs x = y (E), x > y
(G) or x < y (S):
G(x1; x0; y1; y0) = x1y1 + x0 y1 y0 + x1 x0 y0
0 0 0 0
By decomposition we obtain:
G(x1; x0; 0; 0) = x1 + x0 + x1 x0 = x0 + x1 = MUX(x0; 1; x1) 0
G(x1; x0; 0; 1) = x1
G(x1; x0; 1; 0) = x1x0 = MUX(x0; 0; x1)
G(x1; x0; 1; 1) = 0
E (x1; x0; 0; 0) = x1x0 = MUX(x0; 0; x1)
0 0 0 0
S (x1; x0; 1; 0) = x1 0
x0 1 0 1
MUX MUX
0
0 x1 0
1 G
MUX
x1 y1
0
x0 1 1
MUX MUX y0
1 0 0
x1’ y1
x0 1 1
MUX MUX
0 0 0
1 E
MUX
x1’ y1
0
x0’ 1 1
MUX MUX y0
0 0 0
x1 y1
x0’ 1 1
MUX MUX
0 0 0
1 S
MUX
x1’ y1
0
x0’ 1 x1’ 1
MUX MUX y0
1 0 0 0
x1 y1
Chapter 7
Exercise 7.1
Input:
x(t) 2 fa; b; cg
Output:
z(t) 2 fp; q g
Function:
(
z(t) = q if number of a's in x(0; t 1) is even and number of b's is odd.
p otherwise
State:
s(t) = (sa (t); sb (t))
sa (t) = (number of a's) mod 2
sb (t) = (number of b's) mod 2
Initial state:
sa(0) = 0
sb(0) = 0
Transition function:
(
sa (t + 1) = sa (t)0 if x(t) = a
sa (t) otherwise
(
sb (t + 1) = sb (t)0 if x(t) = b
sb (t) otherwise
Output function: (
z(t) = q if s(t)=(0,1)
p otherwise
The state transition and output table is shown below. The state diagram for the system is
presented in Figure 7.1 on page 100.
Input
PS x=a x=b x=c
(0,0) (1,0) (0,1) (0,0) p
(0,1) (1,1) (0,0) (0,1) q
(1,0) (0,0) (1,1) (1,0) p
(1,1) (0,1) (1,0) (1,1) p
NS Output (z )
100 Solutions Manual - Introduction to Digital Design - November 2, 2000
c
c
b
(0,0)/p (0,1)/q
b
a
a a a
(1,0)/p (1,1)/p
b
c c
a/0 a/0
c/0
b/1
A B
c/1 b/1
b/1
c/1 c/1 C a/0
c/0 b/1
E
b/1 D
a/0
a/0
a a,c a
c
b,c
1/1 2/0 3/1
b
b
b c c
b
0/0 4/0
a a
0
0
0 1
1
15 0
1 1 2
14 0
0
1
1 0 1 3
1
1 0
13
0 0
1 0 1
4
1 0
12 1
0 0 5
1 0
1
11 1
6
0
1
10
0 7
9 8
y20 y20 0
2y2 1
0 0
2 2 y y20 y20 0 0 y
1
1 1 y12 y0
y
20 0
0 0 0
1
0 1 0 0
y1 y1
1
1 y1
0 0
1 0
1 1 0
1 0 0
1 0
Y2 x1 Y1 x1 Y0 x1
x0 x0 x0
y0 0 y0 y0 0 0
y00 00
0 0
y2
0 0
2 2 y
2
0 0 y
0
2 0
0 0 y
0
0
1 0
2 y
0
y1 0 0 0 0 y1 0 0 0 0 y1 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0
z2 x1 z1 x1 z0 x1
The expressions are:
Y2 = x1x0 y1 y00 + x1x00 y10 y0 + x01 y10 y00 y2 + x00y10 y00 y2 + x1 y10 y0y2
Solutions Manual - Introduction to Digital Design - November 2, 2000 111
Y1 = x01y1 + y1 y0 x0 + y1 y00 x00 + y0 x01 y20 + y10 y00 x0y20
Y0 = x01x00 y10 y20 + y00 y0y20 + x01x0y10 y0 y2 + y1 y0 + y0 x1x0 + y1 x1x0
z2 = x01x00 y10 y0 y20
z1 = x01x00 y20 y10 y00 + x01x00 y2 y10 y0
z0 = y10 y0 x1x0 y2 + y20 y10 y0 x01 + y10 y0x01x0
112 Solutions Manual - Introduction to Digital Design - November 2, 2000
Exercise 7.11
The time behavior of the module-p counter is given by the arithmetic expressions
t
X
z(t) = ( s(0) + x(t)) mod p
i=0
s(0) = SIN
where SIN 2 f0; 1; : : :; p 1g and x(t) 2 f0; 1g
Solutions Manual - Introduction to Digital Design - November 2, 2000 113
Exercise 7.12
The number of possible input sequences starting at time t1 = 5 and going up to t2 = 16 would
be:
216 5+1 = 212 possible input sequences
As it's possible to have the system in two dierent states at time t1 , S3 or S1 , for the same
input sequence it's possible to get two possible sequence pairs. So, the number of sequence pairs
needed to describe the system would be:
2 212 = 213
Calling the states by their number (e.g. S2 is called 2), three possible sequence pairs are:
t 5 6 7 8 9 10 11 12 13 14 15 16
x(t) 1 1 0 0 1 1 1 0 1 1 0 1
s(t) 3 3 3 1 2 2 2 2 0 1 3 1
z(t) c c c a b b b b a a c a
t 5 6 7 8 9 10 11 12 13 14 15 16
x(t) 1 1 0 1 1 0 1 1 0 0 1 0
s(t) 3 3 3 1 3 3 1 3 3 1 2 2
z(t) c c c a c c a c c a b b
t 5 6 7 8 9 10 11 12 13 14 15 16
x(t) 1 1 0 1 1 1 0 0 1 1 1 1
s(t) 1 3 3 1 3 3 3 1 2 2 2 2
z(t) a c c a c c c a b b b b
114 Solutions Manual - Introduction to Digital Design - November 2, 2000
Exercise 7.13
The state diagram of Figure 7.11(a) of the textbook results in the following state table:
Input
PS 0 1
Sinit S0; 0 S1; 0
S0 S00; 0 S01; 0
S1 S10; 0 S11; 0
S00 S00; 0 S01; 0
S01 S10; 0 S11; 0
S10 S00; 0 S01; 1
S11 S10; 0 S11; 0
NS; Output
From the table we get
P1 = (Sinit; S0; S1; S00; S01; S11)(S10)
To obtain P2 , we determine the group of states P1 to which the successors of each state belong.
group 1 group 2
(Sinit ; S0; S1; S00; S01; S11) (S10)
0 112122 1
1 111111 1
Consequently,
P2 = (Sinit; S0; S00)(S1; S01; S11)(S10)
To obtain P3 , we determine the group of states of P2 to which the successors of each state
belong.
group 1 group 2 group 3
(Sinit ; S0; S00) (S1; S01; S11) (S10)
0 111 333 1
1 222 222 2
Thus, P3 = P2 = P = (Sinit ; S0; S00)(S1; S01; S11)(S10) = (Sinit ; A; B )
Using this partition we construct the state table (from the original table):
Input
PS 0 1
Sinit Sinit; 0 A; 0
A B; 0 A; 0
B Sinit; 0 A; 1
NS; Output
The corresponding state diagram is equivalent to the one presented in Figure 7.11(b) of the
textbook, thus both diagrams represent the same system.
Solutions Manual - Introduction to Digital Design - November 2, 2000 115
Exercise 7.14
The loose description has eight states as follows:
s(t) = A if x(t 1) = a and # of a0 s is even
s(t) = B if x(t 1) = a and # of a0s is odd
s(t) = C if x(t 2; t 1) = ab and # of a0 s is even
s(t) = D if x(t 2; t 1) = ab and # of a0 s is odd
s(t) = E if x(t 3; t 1) = abc and # of a0 s is even
s(t) = F if x(t 3; t 1) = abc and # of a0 s is odd
s(t) = G if x(t 3; t 1) = other and # of a0 s is even
s(t) = H if x(t 3; t 1) = other and # of a0s is odd
The corresponding state table is
Input
PS x=a x=b x=c
A B; 0 C; 0 G; 0
B A; 0 D; 0 H; 0
C B; 0 G; 0 E; 0
D A; 0 H; 0 F; 0
E B; 0 G; 0 G; 0
F A; 1 H; 0 H; 0
G B; 0 G; 0 G; 0
H A; 0 H; 0 H; 0
NS; Output
From the table we get
P1 = (A; B; C; D; E; G; H )(F )
To obtain P2 , we determine the class of P1 to which each successor of the states belong.
1 2
(A; B; C; D; E; G; H ) (F )
a 1111111 1
b 1111111 1
c 1112111 1
Consequently,
P2 = (A; B; C; E; G; H )(D)(F )
To obtain P3 , we repeat the process
1 2 3
(A; B; C; E; G; H ) (D) (F )
a 111111 1 1
b 121111 1 1
c 111111 3 1
116 Solutions Manual - Introduction to Digital Design - November 2, 2000
Thus,
P3 = (A; C; E; G; H )(B)(D)(F )
And once more,
1 2 3
(A; C; E; G; H ) (B ) (D)
a 22221 1 1
b 11111 3 1
c 11111 1 4
So
P4 = (A; C; E; G)(H )(B)(D)(F )
Still not ready! Once more (hopefully the last)
1 2 3 4 5
(A; C; E; G) (B ) (D) (F ) (H )
a 2222 1 1 1 1
b 1111 3 5 5 5
c 1111 5 4 5 5
So, nally!
P = P5 = P4 = (A; C; E; G)(B)(D)(F )(H )
and the reduced table is
Input
PS x=a x=b x=c
A B; 0 A; 0 A; 0
B A; 0 D; 0 H; 0
D A; 0 H; 0 F; 0
F A; 1 A; 0 A; 0
H A; 0 H; 0 H; 0
NS; Output
Solutions Manual - Introduction to Digital Design - November 2, 2000 117
Exercise 7.15
From the state table we get
P1 = (a; b; c; e)(d; h)(f )(g )
To obtain P2 , we determine the class of P1 to which the successors of the states belong.
1 2 3 4
(a; b; c; e) (d; h) (f ) (g )
0 3232 44 3 4
1 1111 11 1 2
Thus,
P2 = (a; c)(b; e)(d; h)(f )(g)
To obtain P3 , we determine the group of states of P2 to which the successors of the state belong.
1 2 3 4 5
(a; c) (b; e) (d; h) (f ) (g )
0 44 33 55 4 5
1 22 11 11 2 3
Therefore, P = P3 = P2 = (a; c)(b; e)(d; h)(f )(g ) and the reduced table is
Input
PS x = 0 x = 1
a f; 0 b; 0
b d; 0 a; 0
d g; 1 a; 0
f f; 1 b; 1
g g; 0 d; 1
NS; Output
118 Solutions Manual - Introduction to Digital Design - November 2, 2000
Exercise 7.16
Based on the outputs for each state we get the rst partition P1 as:
P1 = (A; D; E )(B; F; G)(C; H )
Let's call (A,D,E) as group 1, (B,F,G) as group 2 and (C,H) as group 3.
We can construct a table representing the next group for each state transition:
group 1 group 2 group 3
A D E B F G C H
0 2 2 2 3 3 3 3 3
1 3 3 3 1 1 1 1 1
From the table we can see that the columns for each group of states are the same, and so, the
states in each group are also 2-equivalent. P2 = P1 . Renaming the states in group 1 as , the
states in group 2 as and in group 3 as
, we can represent the reduced sequential system as:
PS Input
x=0 x=1
; 0
; 0
; 1 ; 1
; 0 ; 1
Solutions Manual - Introduction to Digital Design - November 2, 2000 119
Exercise 7.17
Based on the outputs for each state we get the rst partition
P1 = (A; C; G; H )(B; D; E )(F )
To obtain P2 , we determine the class of P1 to which the successors of the states belong.
group 1 group 2 group 3
A C G H B D E F
a 2 2 2 2 1 1 1
b 1 1 1 1 3 3 3
c 2 2 2 2 2 2 2
d 2 3 3 3 2 2 2
Partition P2 is
group 1 group 2 group 3 group 4
A C G H B D E F
a 3 3 3 2 2 2
b 1 1 2 4 4 4
c 3 3 3 3 3 3
d 4 4 4 3 3 3
Partition P3 is
group 1 group 2 group 3 group 4 group 5
A C G H B D E F
a 4 4 2 2 2
b 1 1 5 5 5
c 4 4 4 4 4
d 5 5 4 4 4
STOP.
The equivalent states are: fAg, fB,D,Eg, fC,Gg, fFg, fHg
Minimal state transition table:
PS x = a x = b x = c x = d
A B=1 C=0 B=1 B=1
B C=0 F=1 B=1 B=0
C B=1 A=0 B=1 F=1
F C=1 F=1 B=0 H=0
H B=1 C=0 B=1 F=1
NS=output
120 Solutions Manual - Introduction to Digital Design - November 2, 2000
Exercise 7.18Based on the outputs for each state we get the rst partition
P1 = (N; O; Q; R; X; Z )(P; U; V; Y )(S; T; W )
To obtain P2 , we determine the class of P1 to which the successors of the states belong.
group 1 group 2 group 3
N O Q R X Z P U V Y S T W
a 3 3 3 3 3 3 2 2 2 2 1 1 1
b 1 2 2 2 1 1 1 1 1 1 2 2 2
Partition P2 is
group 1 group 2 group 3 group 4
N X Z O Q R P U V Y S T W
a 4 4 4 4 4 4 3 3 3 3 1 1 1
b 1 1 1 3 3 3 2 2 1 1 3 3 3
Partition P3 is
group 1 group 2 group 3 group 4 group 5
N X Z O Q R P U V Y S T W
a 5 5 5 5 5 5 4 4 3 3 1 1 1
b 1 1 1 4 4 4 2 2 1 1 4 4 3
Partition P4 is
group 1 group 2 group 3 group 4 group 5 group 6
N X Z O Q R P U V Y S T W
a 5 6 5 5 6 6 4 4 3 3 1 1
b 1 1 1 4 4 4 2 2 1 1 4 4
Partition P5 is
group 1 group 2 group 3 group 4 group 5 group 6 group 7 group 8
N Z X O Q R P U V Y S T W
a 7 7 8 8 6 6 5 5 1 1
b 1 1 6 6 4 4 1 1 6 6
STOP!
Equivalent states: fN,Zg, fOg, fP,Ug, fQ,Rg, fS,Tg, fV,Yg, fWg, fXg
Minimal state transition table:
PS input
x = a x = a0
N S=f N=e
O S=f V=e
P V=e Q=f
Q W=f V=e
S N=e V=e
V P=f N=f
W X=e P=e
X W=f N=e
NS=output
Solutions Manual - Introduction to Digital Design - November 2, 2000 121
Exercise 7.19
Input: x(t) 2 fa; b; c; dg
Output: z (t) 2 f0; 1g
State: Since the pattern to be recognized has four symbols, using the vector-state approach, we
represent the state as the vector
s = (s2; s1; s0 )
and the states are s(t) 2 f0; 1; 2; :::; 7g.
Function: The corresponding state transition and output functions are:
si(t + 1) = si 1 (t) 1 i 2
s0 (t + 1) = x(t)
(
z(t) = 1 if (s(t); x(t)) = abca
0 otherwise
For the minimum-number-of-states approach, we dene a state with the following four values:
s(t) = A if x(t 1) = a
s(t) = B if x(t 2; t 1) = ab
s(t) = C if x(t 3; t 1) = abc
s(t) = D if none of the above (Initial)
The state description is given by the state diagram shown in Figure 7.5and the following table:
Input
PS a b c d
A A; 0 B; 0 D; 0 D; 0
B A; 0 D:0 C; 0 D; 0
C A; 1 D; 0 D; 0 D; 0
D A; 0 D; 0 D; 0 D; 0
NS; z
The output sequence corresponding to the given input sequence is
x(t) a a b c a b c a d a a a b c a
s(t) D A A B C A B C A D A A A B C A
z(t) 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1
122 Solutions Manual - Introduction to Digital Design - November 2, 2000
b/0,c/0,d/0
a/0 a/0
D A
c/0,d/0
c/0
C B
a’/0 a/0
a/0
S0 S1
b/1,a’/0,b’/0
c,d/1 b,d/1
b,c,d/1 a/0
a/1
b,c,d/0 a/0 a/0
c,d/01 b,d/01
b,c,d/0
The second component is a modulo 5 counter. Consequently, the state has ve values which
we label with the integers 0; 1; 2; 3 and 4 to be able to write the state transition as the arithmetic
expression:
(
s2(t + 1) = (s2 (t) + 1) mod 5 if s1 (t) = B and x(t) = 8
s2 (t) otherwise
s2 (0) = 0
Finally, the output function is z (t) = s2 (t).
126 Solutions Manual - Introduction to Digital Design - November 2, 2000
Exercise 7.23
Following the hint given in the exercise, the sequential system is decomposed into two. System
A recognizes the pattern 0110, and system B recognizes the pattern 1001, as shown in Figure 7.8.
The output z (t) is dened as a function of the system A states (SA (t)) and system B states (SB (t))
as follows:
SA (t) SB (t) z(t)
f0; 1; 2; 3g { 0
4 f0; 1; 2; 3g 1
4 4 2
System A System B
1 0 0 1
0 1 1 0
0 1 2 0 1 2
0 1 1 0
1 0
4 3 4 3
0 1
-/A
-/N
1/R -/U
S 0 SB 1 S 2
B B
0/blank
Reset : 2 fT; F g
CoinType : 2 fN; D; Qg
StampType : 2 fS 1(20c); S2(40c); S3(50c)g
ReturnCoinRequest : 2 fT; F g
Outputs:
Reset RS1
RS2
Coin Type
RS3
Stamp Type Controller RC
RN
Return Coin Request
RD
D/
Select N/ N/ N/
S1,5c S1,10c S1,15c
S3/ S1/ S1
Q / RS1, RN D/
Q / RS1, RD
Wait
N / RS1; D / RS1,RN; Q / RC
N / RS2; D / RS2, RN; Q / RC
Q / RS2, RN
S2 Q/RS2 D/ D/
D/ D/
D/
N/ N/ N/ N/ N/ N/ N/
Select S2,5c S2,10c S2,15c S2,20c S2,25c S2,30c S2,35c
S2
D/
Q/
Q/
Select Stamp 2
Q/
Q / RS3, RN
Q / RS3
Select Q/
S3 D/ D/ D/ D/
N/ D/ D/ D/ D/
N/ N/ N/ N/ N/ N/ N/ N/
S3,5c S3,10c S3,15c S3,20c S3,25c S3,30c S3,35c S3,40c S3,45c
Q/ Q/
Q/ Q/
Note: We did not draw the transitions corresponding to inputs RESET and Return Coin Request.
Basically, for every state, its next state with the above inputs should be the same - go
back to State Wait. In the mean time, RC is true to return all coins deposited so far.
Chapter 8
Exercise 8.1 : A minimum clock width of 5 ns and a latch delay of 2 ns are considered in this
problem.
(a) The minimum delay of the combinational network (tp ) considered in this problem is obtained
by the following equation
tp + 2ns 5ns ! tp 3ns
(b) If the delay of the combinational network can decrease by 30% and the latch delay can
decrease by 10%, the maximum clock pulse width (Tmax ) is calculated by the following equation:
0:7tp + 0:9 2ns = 0:7 3 + 1:8 = Tmax ! Tmax = 3:9ns
120 Solutions Manual - Introduction to Digital Design - November 2, 2000
Exercise 8.2:
Using the notation given on Figure 8.15 of the textbook we obtain the following network pa-
rameters:
Combinational Networks' delays:
d1x = d1y = 4 tp (gate) = 2ns
d2 = 1 tp(gate) = 0:5ns
Network set-up time:
txsu (net) = tysu (net) = tsu (cell) + d1x = 1 + 2 = 3ns
Network hold time:
th (net) = th (cell) = 0:5ns
Network propagation delay:
tp (net) = tp (cell) + d2 = 3 + 0:5 = 3:5ns
Minimal period:
Tmin = max[(tin + txsu (net)); (tysu (net)+ tp (cell)); tp(net+ tout )] = max[2+3; 3+3; 3:5+2:5] = 6:0ns
Maximal frequency:
fmax = T 1 = 6:0 110 9 167MHz
min
Solutions Manual - Introduction to Digital Design - November 2, 2000 121
Exercise 8.3
(a) There are no races because of the nonoverlapping nature of the two clocks. This assures
that in each clock cycle only one state change occurs.
(b) The number of states depends on the mode of operation of the network. We consider two
modes.
i) The clock period of the system corresponds to one of the phases (say phase 1). In this case,
the gated latch loaded during the phase two clock acts just as a temporary buer to prevent
races. The state register corresponds to the register loaded during phase 1. Consequently,
the number of states is 2n . The division of the combinational network into two can, in some
cases, make sense because of implementation restrictions. For example, if the combinational
network is implemented using pass transistors, there is a limitation on the number of them
that can be connected in series; in such a case the division in two networks might help.
ii) The clock period is the time between both clocks (phase 1 and phase 2). This results in a
system that has a smaller period than that in (i) (and, therefore, in a faster system). In this
case each register stores part of the state and the number of potential states is 22n , but these
states cannot be utilized in general. The state can be described by two components s1 (stored
in register 1) and s2 (stored in register 2). Each component changes in alternate clock cycles.
The output is a combination of two components z1 and z2 expressed as:
z1 (t) = G1(s1 (t); x1(t))
z2 (t) = G2(s2 (t); x2(t))
(c) Using the rst model, the implementation of the system of Exercise 8.4 (Figure 8.40 of
the textbook) is straightforward if we only replace the D-type cells for two gated latches in a
master/slave conguration, as shown on page 203 of the textbook. Doing this modication, the
new design will behave the same way as the one shown in Exercise 8.4, with a slower clock. One
way to improve this design would be to split the combinational network, reducing the propagation
delay between latches, as shown in Figure 8.1. Observe that one more latch is used in this case.
x1
x0’ Y1 y1
x0
Y0 y0
x0’
phase 2
phase 1 z
Figure 8.1: Redesign of system in Exercise 8.4 using latches - Exercise 8.3
122 Solutions Manual - Introduction to Digital Design - November 2, 2000
Exercise 8.4
The transition and output functions are described by the following expressions:
Y1 = x00 x1 + x0 y1
Y0 = y0x00 + x0 y1
z = y0
PS Input (x1x0 )
y1 y0 00 01 10 11
00 00 00 10 00 0
01 01 00 11 00 1
10 00 11 10 11 0
11 01 11 11 11 1
NS(Y1 Y0 ) Output (z )
The corresponding state table is (for state assignments A = 00; B = 01; C = 10; D = 11 and
input coding a = 00; b = 01; c = 10; d = 11)
PS Inputs
x=a x=b x=c x=d
A A A C A 0
B B A D A 1
C A D C D 0
D B D D D 1
NS Output (z )
The diagram in Figure 8.2 shows the state transitions of this system. The following patterns
are recognized by the system (assuming that A is the initial state): cb; cbb; cbc; cd; cdc.
a,b,d c
A/0 a C/0
b,d b,d
c D/1
B/1 b,c,d
a
1/0 0/0
0/0
1/0
1/0
1/1
0/0 0101
1/0 0/0
1/0
010101 01010
0/0
State Sequence
S0 start
S1 0
S2 01
S3 010
S4 0101
S5 01010
S6 010101
The state and transition table is:
PS Input
y2y1 y0 x = 0 x = 1
S0 000 001,0 000,0
S1 001 001,0 010,0
S2 010 011,0 000,0
S3 011 001,0 100,0
S4 100 101,0 000,0
S5 101 001,0 110,0
S6 110 101,0 000,1
Y2 Y1Y0; z
124 Solutions Manual - Introduction to Digital Design - November 2, 2000
The switching expressions for the next state and output are:
Y2 = y2 y00 x0 + y2 y0 x + y1 y0 x
Y1 = y10 y0 x + y20 y1y00 x0
Y0 = x0
z = y2y1 x
These expressions are implemented by AND-OR networks and the state is stored in a 3-bit
register. The corresponding sequential network is shown in Figure 8.4.
x’
y0’
y2
x
y2 Y2 x
y0 y2 z
x Y1
y1 y1
y0
Y0 y0
x’
x
y1’
y0 CK
x’
y2’
y1
y0’
Y2 y2
z1
Combinational Y1 cells y1 Comb.
Network Y0 y0 Network z0
y1
y2’
y0
y2
y1’
y2
y1
y0’ y0’
y0
y2’
y1’
y0
CK
y1 z1
y0’ z0
0 1
1 1 1 0
S0/0 S1/0 S3/0 S4/0 S5/1
0
0,1 0 0
S1 - block of zeros of EVEN length
S2/0 S5 - block of zeros of ODD length
(after correct prefix)
y2
y0’
Y2
x’ x x’
y2
x
y1
y0
y2’ y2
z
y1’ Y1
y0 y1
x’
y2’ y0 y0’
y0
x
y2’
y1’
x CK
y1’ y2 y2’
Y0
y0
y1 y1 y1’
y0’
x’
y2
y0’
x’
y2
y0’
x’
y1
y0 Y2
y2
x
y2 Y1 y2’
y0 y1
x Y0 y1’
y2’ y0’ y0
y1’ y0’
y0’
x’
y2’ CK
y1’
y0
x’
y1
y0’
x y2
y2
y0’ y0
z1
x x
y1 y0
y0
x’
y1
y0
y2 z0
y0’
x
y0’
NOTBCD
MIN Y Mem. y
OR
Cells
CLK
x3
x2
x3
x1 NOTBCD
y3
y2
y3
y1
1 0 MIN slice
x3
x ei si
y y3
y3
m
s i-1
e i-1 y2
x2
y2 MIN slice y1
x1
y1 MIN slice y0
x0
y0 MIN slice
CLK
BINARY-to-GRAY
b
bi i+1
D Q
g
CLK i
c
i+1
INIT
bi
ci
D Q
CK
k
ai si
00,11,10
10
EQUAL GREATER
00,11 01 01
LEAST SIGNIFICANT BIT FIRST
10
SMALLER
00,11,01
10
EQUAL GREATER
00,11 01
MOST SIGNIFICANT BIT FIRST
SMALLER
Mem.
Cell
Y1 y1
y1
a(t)
b(t)
y0 Y0 y0
CK
8/01
8’/10
-/00 -/00
1N 2N 3N
-/10
d0
c1’
c0’ s2(t)
x3 d5 s2(t+1)
c1’ D Q
x2 c0
x1
c1 CLK s2(t)’
x0 d6 Q’
c0’
c1 c1’ c1 z2
CLK 1
Modulo-4 c0
Counter 0 c0 c0’
CNT
x3 d8 z1
x0
SR cell
J S Q’
Comb. SR
Circ. Cell
A Q
K R
SR cell
S Q’
T Comb. SR
Circ. Cell
A Q
R
0 0
1
S0/0 S1/1
1
1
1
S3/3 S2/2
0 0
Exercise 8.17
The expression for the
ip-
op inputs are
JA = xQC JB = Q0A JC = xQB
KA = xQ0B KB = QA KC = x0 Q0B
From the characteristic expressions of the JK
ip-
op we get the following expressions for the
transition functions:
QA(t + 1) = QA (t)(x0 + QB (t)) + xQ0A(t)QC (t)
QB (t + 1) = QB (t)Q0A(t) + Q0B (t)Q0A(t)
QC (t + 1) = QC (t)(QB (t) + x) + Q0C (t)xQB (t)
z = Q0C (t)
The corresponding transition table is
PS Input Input Output
QA QB QC x=0 x=1 x=0 x=1 z
000 00,10,01 01,10,00 010 010 1
001 00,10,01 11,10,00 010 111 0
010 00,10,00 00,10,10 010 011 1
011 00,10,00 10,10,10 011 111 0
100 00,01,01 01,01,00 100 000 1
101 00,01,01 11,01,00 100 001 0
110 00,01,00 00,01,10 100 101 1
111 00,01,00 10,01,10 101 101 0
JA KA; JB KB ; JC KC NS
To get a high-level description we dene the following code:
Solutions Manual - Introduction to Digital Design - November 2, 2000 145
QAQB QC state
000 S0
001 S1
010 S2
011 S3
100 S4
101 S5
110 S6
111 S7
The resulting state table is
PS Input Output
x=0 x=1 z
S0 S2 S2 1
S1 S2 S7 0
S2 S2 S3 1
S3 S3 S7 0
S4 S4 S0 1
S5 S4 S1 0
S6 S4 S5 1
S7 S5 S5 0
NS
The state diagram is shown in Figure 8.21.
A timing diagram can be obtained from the following input/output sequence pairs (the input
is arbitrary):
x(t) 0 1 0 1 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1
s(t) 0 2 3 3 7 5 4 4 0 2 3 7 5 4 0 2 2 2 3 7
z 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 1 1 0 1
146 Solutions Manual - Introduction to Digital Design - November 2, 2000
S0/1
0,1
1
S7/0 S1/0
S3/0 0
S5/0
0
1
S0/1
S0 S1 S2 S3
PS FF inputs NS Output
QA (t)QB (t)QC (t) JA(t)KA (t) JB (t)KB (t) JC (t)KC (t) QA (t + 1)QB (t + 1)QC (t + 1) z(t)
000 11 11 01 110 1
001 11 01 01 100 0
010 11 11 11 101 0
011 11 01 11 100 0
100 11 11 01 010 0
101 11 01 01 000 0
110 11 11 11 001 0
111 11 01 11 000 0
Let us dene the following encoding:
QAQB QC state
000 A
001 B
010 C
011 D
100 E
101 F
110 G
111 H
The resulting transition table is
PS NS z
A G 1
B E 0
C F 0
D E 0
E C 0
F A 0
G B 0
H A 0
Let us try to reduce the number of states:
P = 1
1
( ) A (
2
B; C; D; E; F; G; H )
2 2 2 2 2 1 2 1
Solutions Manual - Introduction to Digital Design - November 2, 2000 149
P2 = (A1 ) (
2
F; H ) (
3
B; C; D; E; G)
3 1 1 3 2 3 3 3
P3 = (A1) (F;2H ) (C3 ) (B; D;4 E; G)
4 1 1 2 4 4 3 4
P4 = (A1) (F;2H ) (C3 ) (E4 ) (B; D;5
G)
5 1 1 2 3 4 4 5
P5 = (A1 ) (F;2H ) (C3 ) (E4 ) (G5 ) (B;6D)
5 1 1 2 3 6 4 4
TA = QA + QB
TB = Q0A + QB
The transition table is
PS FF inputs NS
QA (t)QB (t) TA (t)TB (t) QA (t + 1)QB (t + 1)
00 01 01
01 11 10
10 10 00
11 11 00
Let us dene the following encoding:
QAQB
00 S0
01 S1
10 S2
11 S3
The resulting state table is
PS NS
S0 S1
S1 S2
S2 S0
S3 S0
The state diagram is shown in Figure 8.24. The network implements an autonomous modulo-3
counter.
S0 S1 S2 S3
0/1 0/1
S0 S1 S2
1/0 0/0
1/0 1/1
0/0
1/1
S3
0/1
1/0
0/1
1/0 0/0
S6 S5 S4
1/1
S
Q
D Q
R CK Q’
Q’
(a)
T Q
D Q
CK
Q’
Q’
(b)
Q
D Q
K
CK Q’
Q’
(c)
S2 : x(t 2) = x(t 1) = 1
S1 : Not S2 and x(t 1) = 1
S0 : None of the above
The corresponding state table is
PS Input
x=0 x=1
S0 S0 ; 0 S1 ; 0
S1 S0 ; 0 S2 ; 0
S2 S0 ; 1 S2 ; 0
NS,z
To implement these states we need at least two
ip-
ops. Let us dene the following state
assignment:
Q2 Q1
S0 00
S1 01
S2 10
The resulting state table is
PS Input
Q2Q1 x = 0 x = 1
00 00,0 01,0
01 00,0 10,0
10 00,1 10,0
NS,z
Since the excitation function of a JK
ip-
op is
PS NS
0 1
0 0- 1-
1 -1 -0
JK
the inputs J1 ; K1; J2 , and K2 to the JK
ip-
ops are
PS Input
Q2Q1 x = 0 x = 1
00 0-,0- 0-,1-
01 0-,-1 1-,-1
10 -1,0- -0,0-
J2 K2; J1 K1
156 Solutions Manual - Introduction to Digital Design - November 2, 2000
Switching expressions for these
ip-
op inputs are
J2 = Q1 x J1 = Q02x
K2 = x0 K1 = 1
An expression for the output is
z = Q2 x0
The sequential network is shown in Figure 8.27.
Q1
Q2
J Q J Q z
CK 1 CK 2
1 K Q’ K Q’
CK
x x’
Q0 Q1
X D Q D Q D Q
Q’ Q’ Q’
CK
Z
X J Q
CK CK
K Q’
Q2
S Q
CK CK
Q2’
R Q’
Q1
S Q
CK CK
Q1’
R Q’
a) To design a cyclic counter with the output sequence 0; 1; 3; 7; 6; 4; 0; 1; : : : we need six states.
In this rst part, we select the coding so that the output corresponds to the state. The state table
is
PS Input
x=0 x=1
000 000 001
001 001 011
011 011 111
100 100 000
110 110 100
111 111 110
NS = z
Since the excitation function of a JK
ip-
op is
PS NS
0 1
0 0- 1-
1 -1 -0
JK
we get the following
ip-
op inputs
PS Input
Q2Q1Q0 x=0 x=1
000 0- 0- 0- 0- 0- 1-
001 0- 0- -0 0- 1- -0
011 0- -0 -0 1- -0 -0
100 -0 0- 0- -1 0- 0-
110 -0 -0 0- -0 -1 0-
111 -0 -0 -0 -0 -0 -1
J2 K2 J1 K1 J0 K0
From K-maps we obtain
J2 = xQ1 K2 = xQ01
J1 = xQ0 K1 = xQ00
J0 = xQ02 K0 = xQ2
The sequential network is shown in Figure 8.31. Recall that the output z = (z2; z1; z0) corre-
sponds to the state vector (Q2 ; Q1; Q0).
b) In this second case, the state table is
Solutions Manual - Introduction to Digital Design - November 2, 2000 161
z2
z1
J Q J Q J Q z0
CK 0 CK 1 CK 2
K Q’ K Q’ K Q’
CK
x
PS Input
x=0 x=1
S0 S0 S1 0
S1 S1 S2 1
S2 S2 S3 3
S3 S3 S4 7
S4 S4 S5 6
S5 S5 S0 4
NS Output
with the following encoding for the state:
Q2 Q1 Q0
S0
000
S1
001
S2
010
S3
011
S4
100
S5
101
Using the previously given excitation function for a JK
ip-
op, the
ip-
ops inputs are
PS Input Output
Q2Q1Q0 x=0 x=1 z(t)
000 0- 0- 0- 0- 0- 1- 000
001 0- 0- -0 0- 1- -1 001
010 0- -0 0- 0- -0 1- 011
011 0- -0 -0 1- -1 -1 111
100 -0 0- 0- -0 0- 1- 110
101 -0 0- -0 -1 0- -1 100
J2 K2 J1 K1 J0 K0
From K-maps we obtain
J2 = xQ1Q0 K2 = xQ0
J1 = xQ02Q0 K1 = xQ0
J0 = x K0 = x
162 Solutions Manual - Introduction to Digital Design - November 2, 2000
For the output,
z2 = Q2 + Q1 Q0
z1 = Q1 + Q2 Q00
z0 = Q1 + Q02 Q0
The sequential network is shown in Figure 8.32.
J Q J Q J Q
CK 0 CK 1 CK 2
K Q’ K Q’ K Q’
CK
x
Q1 Q2 Q2’
Q0 z2 Q0’ Q0
z1 z0
Q2 Q1 Q1
c
Q1
Q
x
c
Q2 T2 Q2
Q T Q
x
c’ CK
Q1’
Q0’
x
c
Q0’
x
c Q1 T1 Q1
T Q
Q2 Q2
Q1 x
CK
Q0
c
Q2 T0 Q0
T Q
Q1
Q0
CK
x
(a) T-type FF implementation
Q1’
Q0’
c’
Q1’
Q0
D1
c Q1
x D Q
Q1
Q0
Q2 c’ x’ CK
Q0 Q2’ Q1
Q1
Q1 Q0’
Q0 c
c
Q2
Q1’
c D2 Q2
x D Q
Q2
Q1
c’ x’ CK
Q2’ Q2
Q1’
Q0’ Q2
c’ Q1’
Q0’
Q2’
Q0’
D0
c Q0
x D Q
Q1
Q0’
c’ x’ CK
Q0
S4 : x(t 3; t 1) = 011
S3 : x(t 3; t 1) = 010
S2 : x(t 2; t 1) = 01
S1 : Not S3 and x(t 1) = 0
S0 : None of the above
The corresponding state table is
PS Input
x=0 x=1
S0 S1 ; 0 S0 ; 0
S1 S1 ; 0 S2 ; 0
S2 S3 ; 0 S4 ; 0
S3 S1 ; 0 S2 ; 1
S4 S1 ; 1 S0 ; 0
NS,z
Assigning to each state the binary value of its subindex the resulting state table is
PS Input
Q2 Q1Q0 x = 0 x = 1
000 001,0 000,0
001 001,0 010,0
010 011,0 100,0
011 001,0 010,0
100 001,1 000,0
NS,z
Since the excitation function of a JK
ip-
op is
PS NS
0 1
0 0- 1-
1 -1 -0
JK
we determine the inputs J2 ; K2; J1; K1; J1, and K1 to be
PS Input
Q2Q1Q0 x=0 x=1
000 0- 0- 1- 0- 0- 0-
001 0- 0- -0 0- 1- -1
010 0- -0 1- 1- -1 0-
011 0- -1 -0 0- -0 -1
100 -1 0- 1- -1 0- 0-
J2K2 J1 K1 J0 K0
Solutions Manual - Introduction to Digital Design - November 2, 2000 167
Using K-maps we get the following switching expressions:
J2 = xQ1 Q00
K2 = 1
J1 = xQ0
K1 = xQ00 + x0 Q0
J0 = x0
K0 = x
The output expression is:
z = x0Q2 + xQ1Q0
The sequential network is shown in Figure 8.34
x
Q2
Q1 J Q
Q0’ x’
CK 2
x x’ "1" Q2’ z
K Q’
x
Q0
x Q1
J Q
Q0
x CK 1
Q0’ Q1’
K Q’
x’
Q0
x’ Q0
J Q
CK
CK 0
x Q0’
K Q’
x
Q1
Q0
D2 Q2
D Q
x’
Q2
Q2’
CK Q’
x
Q1’
Q0
D1 Q1
Q1 D Q
Q0’
Q1’
x’ CK Q’
Q1
x
Q2’
Q0’
D0 Q0
D Q
x’
Q0
Q0’
CK Q’
Q1 Q1
- -
- - - 0 1 0
J1 : x1 K1 : x1
x0 x0
- 1 0 0
- - - -
- - - -
Q
- - - - 0
Q
- 1 0 0
- - - - 0
Q1 Q1
- 10 0
-10
1
J0 : x1 K0 : x1
which result in the following expressions:
J1 = x1
k1 = x1 x0 Q00 + x00 Q0
J0 = x01
K0 = x01 + x00Q1
The gate network for this exercise is shown in Figure 8.36. This network has fewer gates than
that of Figure 8.29 of the text.
Solutions Manual - Introduction to Digital Design - November 2, 2000 171
x0 x0’
x1 x1’ Q0
x1 x1
J Q
x1 x0
x0 CK 1 Q1 z
Q0’ Q0’
K Q’ x0’
x0’ Q1’
Q0 Q0
x1’ J Q
CK CK 0
x0’ Q0’
K Q’
Q1
0 0 0
1 1
S0 S1 S2
1
y2
x Y0 y0
D Q
y0
FF0
Y1 y1 z0
y1
D Q
FF1
Y2 y2 z1
D Q
y2
FF2
CK
B
x NA A D
F
D Q x’
FF0 A
z0
C C
NB B x
D Q E
A FF1
C
NC C B
D Q z1
B FF2 D
x
E
F
ND D
D Q
C FF2
F
NE E
D Q
D FF2
A
NF F
D Q
E FF2
CK
x D Q D Q D Q D Q
FF0 FF0 FF0 FF0
CK
z
Chapter 9
Exercise 9.1 (a) Implement a 10 output (decimal) decoder for 2-out-of-5 code using NAND
gates. The 2-out-of-5 code represents decimal digits as shown in the following table:
i x4 x3x2 x1 x0
0 00011
1 11000
2 10100
3 01100
4 10010
5 01010
6 00110
7 10001
8 01001
9 00101
Each output zi of the decoder is activated when the input has the 2-out-of-5 code that represents
the value i in decimal and the enable input E = 1. The expressions for the outputs are:
z0 = x04 x03 x02x1 x0 E
z1 = x4 x3 x02x01x00 E
z2 = x4 x03 x2x01x00 E
z3 = x04x3 x2x01 x00 E
z4 = x4x03x02x1 x00E
z5 = x04 x3 x02x1 x00E
z6 = x04 x03 x2x1 x00E
z7 = x4 x03 x02x01 x0 E
z8 = x04 x3 x02x01 x0 E
z9 = x04 x03 x2x01x0 E
Part of the gate network for the circuit is shown in Figure 9.1.
x4 x4’ x4’
x3’
x2’ z0
x3 x3’ x1
x0
E
x2 x2’ x4
x3
x2’ z1
x1 x1’ x1’
x0’
E
x0 x0’
g2’
g1’ z0
g0’
g2’
g1’ z1
g0
g2’
g3’ g1 z2
g3 g0
g2’ g2’
g2 g1
g1’ g0’ z3
g1
g0’ g2
g0 g1 z4
g0’
g2
g1 z5
g0
g3’
g2
g1’ z6
g0
g3’
g2
g1’ z7
g0
g3 z8
g0’
g3
g0 z9
z1 = c03c02c01c0E
z2 = c03c02 c1c00E
z3 = c03c02 c1c0E
z4 = c03c2 c01c00E
z5 = c3c02 c1c0E
z6 = c3c2 c01c00E
z7 = c3c2 c01c0E
z8 = c3c2 c1c00E
z9 = c3c2 c1c0E
Part of the gate network that implements these expressions is shown in Figure 9.3.
166 Solutions Manual - Introduction to Digital Design - November 15, 2000
c3 c3’ c3’
c2’ z0
c1’
c2 c2’ c0’
E
c3’
c1 c1’ c2’ z1
c1’
c0
c0 c0’ E
0
1 y4
2 y5
3 y6 BCD: (x3,x2,x1,x0)
x0 0
Excess-3 4 y7 decoded outputs: yi
x1 1
dec 5 y8
x2 2
6 y9
x3 3
7
8
E 9
E
0 y0
0
Binary 1 y1
dec y2
1 2
3 y3
I1
0 I0
1 I1 I2
2 I2 I4
3 I3 I8 OP
4 I4
x3 I7
3 5 I5
x2 6 I6 I11
2 Dec. 7 I7 I13
x1 1 8 I8
9 I9
I14
x0 0 I0
10 I10
11 I11 I3
12 I12 I5
13 I13 EP
14 I14 I6
15 I15 I9
E
I10
I12
1 I15
x11 x10 x9 x8 x7 x6 x5 x4 x3 x2 x1 x0
3 2 1 0 3 2 1 0 3 2 1 0
E E Decoder E E Decoder E E Decoder
15 14 2 1 0 15 14 2 1 0 15 14 2 1 0
0 a
1
2 b
3
4 c
5
d
b0 0 6
b1 1 Binary 7
b2 2 decoder 8
e
b3 3 9
10
11
f
12
13
14 g
15
E
0
g0 0 0
1
1 1
2
2 2
3
3 3
4
4 4
5 g1
5 5
b0 0 6
b0 0 6 6 0 g0
b1 1 Binary 7
b1 1 Binary 7 7 Binary 1 g1
b2 2 decoder 8
b2 2 decoder 8 8 encoder 2 g2
b3 3 9
g2 b3 3 9 9 3 g3
10
10 10
11
11 11
12
12 12
13
13 13
14 g3
14 14
15
15 15
E
E E
1
1 1
0 c0 0 0
1 1 1
2 2 2
3 3 3
c1 4 4
4
5 5 5
b0 6 b0 0 6 6
0
b1 7 c2 b1 1 Binary 7 7
1 Binary
b2 8 b2 2 decoder 8 8
2 decoder
b3 9 b3 3 9 9
3
10 10 10
c3 11 11
11
12 12 12
13 13 13
c4 0 c0
14 14 14 Binary
1 c1
15 15 15 encoder
2 c2
E E 16
3 c3
17
1 4 c4
1 18
19
20
21
22
23
24
25
26
27
28
29
30
0
31 E
0 0
g2 2 1 1 2 b2
2 2
Binary Binary
g1 1 decoder 3 3
Encoder 1 b1
4 4
g0 0 5 5 0 b0
6 6
E 7 7 E
1 1
x1 -7
x2 -6
Left
x3 -5 1 x0 0
7-Shifter
x4 -4 x1 1
w0 E Right
x5 -3 0 0 1 x2 2
7-Shifter
1
x6 -2 1 1 x3 3
x7 -1 2 2 0 cin E
x4 4 0 0
x0 0 3 3 Priority 1
x5 5 1 1
x1 1 4 4 Encoder 2 z0
x6 6 2 2
x2
x3
2
3
5
6 w7
5
6
+ z1
z2
x7
x0
7
8
3
4
3
4 Encoder 2
0
Priority 1
x4 4 7 7 A x1 9 5 5
x5 5 x2 10 6 6
x6 6 x3 11 7 7 A
x7 7 x4 12
2 1 0 A
x5 13
x6 14
c0 2 1 0
c1 c2 c1 c0
c2
(b)
(a)
0 0
x2 2 1 1 2 y2
Binary 2 2 Binary
x1 1 decoder 3 3 Encoder 1 y1
4 4
x0 0 5 5 0 y0
6 6
E 7 7 E
1 1
(
wj = i mod 8 if xi = 1 for j = bi=8c
0 otherwise
and
(
Aj = 1 if xi = 1 for j = bi=8c
0 otherwise
In the second level, there are three OR gates with eight inputs each which produce (y2; y1 ; y0) and
an eight-input encoder to encode the A outputs of the rst level encoders and produce (y5; y4; y3 ).
The connection of the OR gates produces:
X
2
yj 2j = OR(w7; w6; :::; w0) = i mod 8
j =0
since all w's except one are 0.
Similarly, the output of the second-level encoder is
X
5
yj 2j = bi=8c
j =3
and, therefore,
X
5
y= yj 2j = bi=8c 23 + i mod 8 = i
j =0
and the network performs the encoding function.
180 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 9.13 The 256-input multiplexer has eight select inputs. Since each 4-input multiplexer
has two select inputs, the tree has four levels. The number of multiplexer in each level is:
rst level: 256
4 64= 64
second level: 4 = 16 (9:1)
third level: 164 = 4
fourth level: 44 = 1
A total of 85 multiplexers distributed in four levels are required to implement a 256-input
multiplexer.
Solutions Manual - Introduction to Digital Design - November 15, 2000 181
Exercise 9.14
The exercise asks for a multiplexer tree with r levels, and 2n inputs in the last level, with
n = rk. That means, each multiplexer has k selection lines and 2k inputs. Figure 9.13 shows a
block diagram of the rst and second level of the tree. We can see from the gure that from one level
to the next, the number of inputs is multiplied by p = 2k (the number of inputs of each individual
multiplexer module). For r levels, the total number of inputs in the last level is pr = 2rk = 2n .
2
p inputs
p inputs
Level 1
Level 2
j =0
182 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 9.15
d 0
d 1
d’ 2
0 3 f(a,b,c,d)
MUX
d 4
0 5
0 6
1 7
2 1 0
a b c
d 0
c
d 1 f(a,b,c,d)
MUX
d 2
c
3
1 0
a b
i0
i1
0
s2 2 1 i2
s1 Binary 2
1 decoder 3
4 i3
s0
0 5
z
6
E 7 i4
1 i5
i6
i7
x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 x 0 x -1
s
shift/no shift
SHIFTER E
d left/right
y7 y6 y5 y4 y3 y2 y1 y0
x
i-1 0
x yi
i 1
MUX
x
i+1
2
0
3
1 0
c1 c0
Figure 9.18: Circuit for each output of the 8-bit simple shifter
E E
1
1 1 1 1
1 0 0 1
s 10 0
1 s 10
1
c1 d c0 d
186 Solutions Manual - Introduction to Digital Design - November 15, 2000
that correspond to the following expressions:
c1 = E 0 + s 0
c0 = sd + E 0
x
i-3 0
x
i-2 1
x
i-1 2 y
x i
i 3
x
i+1 4 MUX
x
i+2 5
x
i+3 6
0 7
2 1 0
c2 c1 c0
Figure 9.19: Circuit for each output of the 8-bit bidirectional shifter
Eds 000 001 002 003 010 011 012 013 100 101 102 103 110 111 112 113
c2c1 c0 111 111 111 111 111 111 111 111 011 100 101 110 011 010 001 000
The values on the table are mapped into the following Kmaps, considering that s is represented
in binary code:
Solutions Manual - Introduction to Digital Design - November 15, 2000 187
s0 s0 s0
1
1
1 1 1 1
1 1
1 1 1 1
1 1 1 1
d 1 1 1 1
d
1 1 1 1
d
E
0 0 0 0
E 1 1
0 0
E
1 0 0 1
0 1 1 1
1 0
1 0 10 0
1
c2 s1 c1 s1 c0 s1
The switching expressions are:
c2 = E 0 + s1 d0 + s0 d0
c1 = E 0 + ds01 + Es1s0 + s01 s00
c0 = E 0 + s00
188 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 9.18 The module is obtained by renaming inputs and outputs of the shift register.
For the right 3-shifter we have the specication:
Inputs:
x = (xn+2 ; xn+1 ; xn ; xn 1 ; : : :; x1; x0), with xi 2 f0; 1g
s 2 f0; 1; 2; 3g
E 2 f0; 1g
Output: y = (yn 1 ; yn 2 ; : : :; y1; y0), yi 2 f0; 1g
Function:
(
yj = x0 j+s ifotherwise
E=1 (9:3)
And we would like to have a left 3-shifter, which is specied as:
Inputs:
w = (wn 1 ; wn 2; : : :; w1; w0; w 1; w 2; w 3), with wi 2 f0; 1g
s 2 f0; 1; 2; 3g
E 2 f0; 1g
Output: z = (zn 1 ; zn 2 ; : : :; z1; z0), zi 2 f0; 1g
Function:
(
zi = w0 i s otherwise
if E = 1 (9:4)
The mapping of the inputs is
xi = wk
with k = n 1 i. Renaming the output also, we have
yj = z t
with t = n 1 j . Replacing these values on Equation 9.3 we obtain:
(
zt = x0 n 1 t+s = wn 1 (n 1 t+s) = wt s ifotherwise
E=1 (9:5)
that corresponds to a left 3-shifter. So, only renaming the inputs we are able to obtain a left shifter
from a right shitfter.
Solutions Manual - Introduction to Digital Design - November 15, 2000 189
Exercise 9.19 A n-bit p-shifter has (n + 2p) input bits and n output bits. It can shift right or
left (direction input d) and the distance of shifting can vary from 0 to p.
The implementation of a 32-bit 3-shifter using four 8-bit 3-shifters is presented in Figure 9.20.
The circuit on the top is a 32-bit 3-shifter that shifts to the left only. The circuit on the bottom of
the gure is a bi-directional 32-bit 3-shifter. The input of the circuit was named i31 to i0, and the
output z31 to z0 .
i to i i to i i to i i to i
31 24 23 16 15 8 7 0
shift inputs
10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3
LEFT d d d d
distance s 8-bit 3-shifter s 8-bit 3-shifter s 8-bit 3-shifter s 8-bit 3-shifter
from 0 to 3 3 3 3 3
z to z z to z z to z z to z
31 24 23 16 15 8 7 0
10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3
LEFT/RIGHT d d d d
distance s 8-bit 3-shifter s 8-bit 3-shifter s 8-bit 3-shifter s 8-bit 3-shifter
from 0 to 3 3 3 3 3
z to z z to z z to z z to z
31 24 23 16 15 8 7 0
6 5 4 3 2 1 0 6 5 4 3 2 1 0 6 5 4 3 2 1 0
dist right 3-shifter E dist right 3-shifter E dist right 3-shifter E
3 2 1 0 3 2 1 0 3 2 1 0
d
E
where w is the output of the rst multiplexer. An expression for this output is:
w = a0b0c + bc0 + abc = ab + bc0 + a0b0 c
The gate network that implements the network in Figure 9.38 of the textbook is shown in Figure
9.22. The equality comparator that generates z is implemented using XOR and NOR gates (as
proposed in the hint). The gate network to generate w is implemented with AND and OR gates.
a
b
b w
c’
f
a’
b’ d z
c g
e
h
So, yi is the same as xi or is zero. This circuit is useful to allow the sharing of the single line
between Mux and Demux among all pairs of (input,output): (x0; y0), (x1 ; y1) ... and so on. It's
used in communication lines to divide the full capacity of the communication line among the many
transmitters and receivers. Each pair can communicate without interference of the other pairs.
194 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 9.24
From the network we obtain:
Y0 = x0 y10 S10 + x0y1 S1 + xy10 S3 + xy1 (S2 + S0 )
= x0 y10 (y20 y0 )0 + x0 y1 y20 y0 + xy10 y2 y0 + xy1 (y2y00 + y20 y00 )
= x0 y10 y2 + x0 y10 y00 + x0 y1 y20 y0 + xy10 y2 y0 + xy1 y00
Y1 = x0 y10 (S3 + S0 ) + x0 y1(S2 + S0) + xy10 S0 + xy1 (S3 + S2 )
= x0 y10 (y2y0 + y20 y00 ) + x0 y1 (y2y00 + y20 y00 ) + xy10 y20 y00 + xy1 (y2y0 + y2 y00 )
= x0 y10 y2 y0 + x0 y10 y20 y00 + x0 y1 y00 + xy10 y20 y00 + xy1 y2
Y2 = x0 y10 (S0 + S1 ) + x0 y1 S1 + xy10 S0 + xy1 (S1 + S0)
= x0 y10 (y20 y00 + y20 y0 ) + x0 y1 y20 y0 + xy10 y20 y00 + xy1 (y20 y00 + y20 y0 )
= x0 y10 y20 + x0 y1 y20 y0 + xy10 y20 y00 + xy1 y20
z = (y2 y0)y10 x = (y20 y0 + y2 y00 )y10 x = x(y20 y10 y0 + y2 y10 y00 )
From these expressions we following state transition and output table:
State PS Input
Number y2 y1 y0 x = 0 x = 1
0 000 111,0 110,0
1 001 100,0 000,1
2 010 010,0 101,0
3 011 101,0 100,0
4 100 001,0 000,1
5 101 011,0 001,0
6 110 010,0 011,0
7 111 000,0 010,0
NS (Y2Y1 Y0 ),z
To reduce the number of states we use the minimization procedure presented in Section 7.6 of the
textbook. The rst partition is:
#1 #2
x 1 4 0 2 3 5 6 7
0 1 1 2 2 2 2 2 2
1 2 2 2 2 1 1 2 2
Second partition:
#1 #2 #3
x 1 4 0 2 6 7 3 5
0 1 1 2 2 2 2 3 3
1 2 2 2 3 3 2 1 1
Third partition:
#1 #2 #3 #4
x 1 4 0 7 2 6 3 5
0 1 1 2 2 3 3 4 4
1 2 2 3 3 4 4 1 1
Solutions Manual - Introduction to Digital Design - November 15, 2000 195
No more new partitions! Stop. The reduced sequential system has only 4 states. We rename the
states as:
Sate number State name
1,4 A
0,7 B
2,6 C
3,5 D
and obtain the following state transition and output table:
PS Input
x=0 x=1
A A,0 B,1
B B,0 C,0
C C,0 D,0
D D,0 A,0
NS,z
A state diagram for the system is shown in Figure 9.23 and corresponds to a modulo-4 counter.
0/0 0/0
1/1
A B
1/0 1/0
1/0
D C
0/0 0/0
Y0 y0
x x z
Y1 y1
Exercise 9.25 From the circuit presented in the gure we can obtain the state diagram in
Figure 9.25. The binary decoder connected to the state register generates the signals Si , which is 1
when the sequential system is at state i. The system outputs correspond to the state signals, that
means, each output is active in one particular state. For this reason we used the output names as
state names to make the state diagram more meaningful. In each present state we identify which
input of the binary encoder is 1. This input determines the next state. For example, the origin
of arcs going into state S1 (check) are obtained by considering the input of the Binary Encoder
labeled 1, which is S0 for input GO, S2 (always, no condition), and S3 (always).
The state diagram shows the operation of a controller which starts to operate with a GO signal.
During operation it monitors two variables: dist and count and issues movement control signals
and counter control signals, until (dist 10) and (count = 3).
GO’
dist > 10
stop move count
up
p0
q0
p1 q1
p2
q2
0
1
0 2
1 3 MUX q3
4
5
1 6
0 7 2 1 0
p3 p2 p1
0 0
1 1
2 2
3 3
4 4
5 5
p0 0 6 6 0 q0
p1 1 Binary 7 7 Binary 1 q1
p2 2 decoder 8 8 encoder 2 q2
p3 3 9 9 3 q3
10 10
11 11
12 12
13 13
14 14
15 15
E E
1 1
Chapter 10
Exercise 10.1 Comparison of FA implementations
(a) using a two-level network (Fig. 10.3(a) of the textbook) the critical path for the circuit has
3 gates. The path connects the input xi (or yi or ci ) and output zi . The propagation delay of this
path is obtained as:
TpHL(xi ! zi ) = tpHL (NOT ) + tpLH (NAND 3) + tpHL (NAND 4)
TpHL(xi ! zi ) = 0:05 + 0:017 2 + 0:07 + 0:038 1 + 0:12 + 0:051L
TpHL(xi ! zi ) = 0:312 + 0:051L
TpLH (xi ! zi ) = tpLH (NOT ) + tpHL(NAND 3) + tpLH (NAND 4)
TpLH (xi ! zi ) = 0:02 + 0:038 2 + 0:09 + 0:039 1 + 0:10 + 0:037L
TpLH (xi ! zi ) = 0:325 + 0:037L
However, the delay of the path connecting the carry input to the carry output is also important
for carry ripple adders. This path has a worst case delay:
TpHL(ci ! ci+1 ) = tpLH (NAND 2) + tpHL (NAND 3)
TpHL(ci ! ci+1 ) = 0:05 + 0:038 + 0:09 + 0:039L
TpHL(ci ! ci+1 ) = 0:18 + 0:039L
TpLH (ci ! ci+1 ) = tpHL (NAND 2) + tpLH (NAND 3)
TpLH (ci ! ci+1 ) = 0:08 + 0:027 + 0:07 + 0:038L
TpLH (ci ! ci+1 ) = 0:18 + 0:038L
The number of equivalent gates is:
gate type number of gates equivalent gates
NOT 3 3 1 = 3
NAND-3 5 5 2=10
NAND-2 3 3 1=3
NAND-4 1 1 2 = 2
Total 18
(b) using HA (Fig. 10.3(b) of the textbook)
The critical path for this circuit has 3 gates: XOR-2, AND-2 and OR-2. The path connects the
input xi (or yi ) and output ci+1 . The propagation delay of this path is obtained as:
TpHL(xi ! ci+1 ) = tpHL (XOR 2) + tpHL(AND 2) + tpHL(OR 2)
TpHL(xi ! ci+1 ) = 0:3 + 0:021 3 + 0:16 + 0:017 + 0:2 + 0:019L
TpHL(xi ! ci+1 ) = 0:74 + 0:019L
TpLH (xi ! ci+1 ) = tpLH (XOR 2) + tpLH (AND 2) + tpLH (OR 2)
TpLH (xi ! ci+1 ) = 0:3 + 0:036 3 + 0:15 + 0:037 + 0:12 + 0:037L
TpLH (xi ! ci+1 ) = 0:72 + 0:037L
The number of equivalent gates is:
190 Solutions Manual - Introduction to Digital Design - November 15, 2000
gate type number of gates equivalent gates
XOR-2 2 2 3 = 6
AND-2 2 2 2=4
OR-2 1 1 2=2
Total 12
(c) using XOR and NAND gates (Fig. 10.3(c) of the textbook)
As the NAND gates have smaller propagation delays than XOR gates, the critical path for
this circuit is through the 2 XOR gates. The path connects the input xi (or yi ) and output zi .
Observe that when the rst XOR gate is connected to the input with higher load factor of the
second XOR gate, the delay of the second XOR gate is reduced. So, two cases must be considered.
The propagation delay of this path is obtained as:
From these equations we determine the network delay taking the largest values for LH and HL
transitions from both options:
tpLH (x0 ! c4) = 1:05 + 0:038L
tpHL(x0 ! c4) = 1:00 + 0:019L
From these gures we conclude that the CLA adder uses more gates than the ripple carry adder
but has a smaller propagation delay.
Solutions Manual - Introduction to Digital Design - November 15, 2000 193
Exercise 10.3 The BCD to Excess-3 converter using 4-bit binary adder is shown in Figure 10.1.
BCD
code 0011
Excess-3
Code
(
COUT = 0 if z 9 and C0 = 0
1 if z 10 or C0 = 1
The condition z 10 or C0 = 1 is described by the switching expression:
w = (z1 z3 + z2 z3 + C0 )
The circuit is shown in Figure 10.2.
Solutions Manual - Introduction to Digital Design - November 15, 2000 195
a
_ _
b
Binary cin =0
Adder
0 0
Binary 0
Adder
Cout s
_
_a b_
4 4
4
_z Excess-3 adder
Binary Adder
4
_s
x2 x1 x0 y2 y1 y0
Binary cin 0
ADDER
0 1 0
Binary cin 0
ADDER
z2 z1 z0
a1 0 1 a1 a1 1
0 0 1 1
0 1 1 0
Cout : b1 z1 : b1 z0 : b1
200 Solutions Manual - Introduction to Digital Design - November 15, 2000
Inputs Outputs
i Cin a1 a0 b1 b0 C out z1 z0
0 0 0 0 0 0 0 0 0
1 0 0 0 0 1 0 0 1
2 0 0 0 1 0 0 1 0
3 0 0 0 1 1 0 1 1
4 0 0 1 0 0 0 0 1
5 0 0 1 0 1 0 1 0
6 0 0 1 1 0 0 1 1
7 0 0 1 1 1 1 0 0
8 0 1 0 0 0 0 1 0
9 0 1 0 0 1 0 1 1
10 0 1 0 1 0 1 0 0
11 0 1 0 1 1 1 0 1
12 0 1 1 0 0 0 1 1
13 0 1 1 0 1 1 0 0
14 0 1 1 1 0 1 0 1
15 0 1 1 1 1 1 1 0
16 1 0 0 0 0 0 0 1
17 1 0 0 0 1 0 1 0
18 1 0 0 1 0 0 1 1
19 1 0 0 1 1 1 0 0
20 1 0 1 0 0 0 1 0
21 1 0 1 0 1 0 1 1
22 1 0 1 1 0 1 0 0
23 1 0 1 1 1 1 0 1
24 1 1 0 0 0 0 1 1
25 1 1 0 0 1 1 0 0
26 1 1 0 1 0 1 0 1
27 1 1 0 1 1 1 1 0
28 1 1 1 0 0 1 0 0
29 1 1 1 0 1 1 0 1
30 1 1 1 1 0 1 1 0
31 1 1 1 1 1 1 1 1
a1 1
0
1
1
1 a1 a1 0
1
1
1 0 0 1
Cout : b1 z1 : b1 z0 : b1
The following logic expressions are obtained from the K-maps.
Cout = (a1 b1 + a1 a0 b0 + a0b1 b0)c0in + (a1 b1 + a0b1 + a1 b0 + b1b0 + a1a0 )cin
z1 = (b1b00a01 + a01a00 b1 + a1 a0b1 b0 + a01 a0 b01b0 + a1 a00b01 + a1 b01b00)c0in
+(a01 a00 b1b00 + a1 a00b01b00 + a1 b1b0 + a1 a0 b1 + a01 a0 b01 + a01b01 b0)cin
z0 = (a00 b0 + a0 b00)c0in + (a0b0 + a00 b00)cin
From the equations, we count 26 NAND gates, with a maximum fan-in of 12 inputs. We assume
that NOT gates are used to obtain the complement of the input variables, so 5 NOT gates are also
used in the network. The network has one level of NOT gates, and two levels of NAND gates.
Internally, all NAND gates in the intermediate level are connected to only one input of the next
level, all loads are 1. The loads of the input signals and their complements (generated by the NOT
gates) are:
Signal Load
a1 11
a01 6
b1 11
b01 6
a0 11
a00 6
b0 11
b00 6
c 11
c0 6
202 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 10.8 Design of a 6-bit CLA adder using gates with a maximum of 4 inputs. The
section that generates propagate and generate signals doesn't need gates with more than 2 inputs.
The same for the last layer of XOR gates that generates the nal sum. The highest fan-in is required
by the gates inside the CLG module. The expressions for the CLG outputs are:
c6 = g5 + p5 g4 + p5p4 g3 + p5p4 p3 g2 + p5 p4 p3p2 g1 + p5p4 p3 p2p1 g0 + p5p4 p3p2 p1 p0c0
c5 = g4 + p4g3 + p4p3 g2 + p4p3 p2 g1 + p4p3p2p1 g0 + p4p3 p2 p1p0 c0
c4 = g3 + p3g2 + p3p2 g1 + p3p2 p1 g0 + p3p2p1p0 c0
c3 = g2 + p2 g1 + p2p1 g0 + p2p1 p0 c0
c2 = g1 + p1g0 + p1p0 c0
c1 = g0 + p0 c0
P = p5p4p3p2 p1p0
G = g5 + p5g4 + p5p4 g3 + p5p4 p3 g2 + p5 p4 p3p2 g1 + p5p4 p3 p2p1 g0
From these expressions we observe that AND and OR gates with 5, 6 and 7 inputs are required.
We decompose these gates into three gates. The implementation of the 6-bit CLA is shown in
Figure 10.5. From the Figure we count 66 gates distributed in 6 levels.
x5 x4 x3 x2 x1 x0
y5 y4 y3 y2 y1 y0
g5 p5 g4 p4 g3 p3 g2 p2 g1 p1 g0 p0
c0
p0
c0
p2 c2 p1 c1
p3 c3
P s3 s2 s1 s0
c6 p5 c5 p4 c4
G
s5 s4
Figure 10.5: 6-bit CLA using gates of at most 4 inputs - Exercise 10.8
Solutions Manual - Introduction to Digital Design - November 15, 2000 203
Exercise 10.9 Design of 64-bit adders.
a) a Ripple Carry Adder (RCA) using 4-bit adder modules is shown in Figure 10.6. This
implementation of a 64-bit adder needs 16 adder modules (CLA-4). The delay is:
TCRA = CLA xy c4 + 14 CLA c0 c4 + maxfCLA c0 c4 ; CLA c0 s3 g
where CLA xy c4 is the delay to propagate the signal from input to the carry output of the 4-bit
CLA, and CLA c0 c4 and CLA c0 s3 are the delays from the input c0 to the carry out c4 and the
sum output bit s3 , respectively.
y_ _x y_ x_ y_ x_
15 15 1 1 0 0
4 4 4 4 4 4
cout cin
4-bit adder 4-bit adder 4-bit adder
15 1 0
4 4 4
_z15 _z _z 0
1
c60 c56 c52 c48 c44 c40 c36 c32 c28 c24 c20 c16 c12 c8 c4
y15 x- 15 y14 x- 14 y13 x- 13 y12 x- 12 y11 x- 11 y10 x- 10 y 9 x- 9 y 8 x- 8 y 7 x- 7 y 6 x- 6 y 5 x- 5 y 4 x- 4 y 3 x- 3 y 2 x- 2 y 1 x- 1 y 0 x- 0 cin
- - - - - - - - - - - - - - - -
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4
2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4
_z15 _z14 _z13 _z12 _z11 _z10 _z 9 _z 8 _z 7 _z 6 _z 5 _z 4 _z 3 _z 2 _z 1 _z 0
CLG-4 CLG-4 CLG-4 CLG-4
c64 c60 c56 c52 c48 c44 c40 c36 c32 c28 c24 c20 c16 c12 c8 c4
c60 c56 c52 c48 c44 c40 c36 c32 c28 c24 c20 c16 c12 c8 c4
y15 x- 15 y14 x- 14 y13 x- 13 y12 x- 12 y11 x- 11 y10 x- 10 y 9 x- 9 y 8 x- 8 y 7 x- 7 y 6 x- 6 y 5 x- 5 y 4 x- 4 y 3 x- 3 y 2 x- 2 y 1 x- 1 y 0 x- 0 cin
- - - - - - - - - - - - - - - -
4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4 CLA-4
2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4 2 4
_z15 _z14 _z13 _z12 _z11 _z10 _z 9 _z 8 _z 7 _z 6 _z 5 _z 4 _z 3 _z 2 _z 1 _z 0
CLG-4 CLG-4 CLG-4 CLG-4
c48 c32 c16
2 2 2 2
c60 c56 c52 c44 c40 c36 c28 c24 c20 c12 c8 c4
CLG-4
Consequently, if wn = 0, the result is equal to wR, and if wn = 1 the result is obtained discarding
wn (subtracting 2n ) and adding 1. Note that case (2) produces a result vector (1; 1; : : :; 1), which
is correct since this is another representation of 0 in the one's complement system.
(b) To verify that the operation of the adder with the carry output connected to the carry-in
is combinational we consider the following cases:
there is a combination 00 or 11 for one particular bit position. In that case the carry chain
is broken by this combination. No active loop.
there is no combination 00 or 11, that means, all bit positions have the combination 01. In
that case, there is an active loop. To have a stable result all carries have to be reset to zero
before the operation starts.
Figure 10.9 shows examples of both cases.
Figure 10.9: Example of carry chains for One's complement adder - Exercise 10.13 (part b)
210 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 10.14: Implementation of addition in Sign-and-magnitude with 8 bits (including the
sign bit).
The algorithm for addition z = a + b in sign-and-magnitude representation is as follows:
Input: a represented by (as ; am ), b represented by (bs; bm).
Output: z represented by (zs ; zm ).
Algorithm:
IF as = bs THEN zm = am + bm
zm = am
ELSE
IF (am bm ) THEN zm = am bm ;zs = as ;
ELSE zm = bm am ; zs = bs;
(a) the design using a subtractor of magnitudes, one adder/subtractor, two-muxes and gates is
shown in Figure 10.10. The dierence in sign between the operands is detected by the XOR gate,
that controls the adder/subtractor. The magnitude subtractor is used to compare the operands,
performing the operation (a b). The comparison result is obtained from the borrow output.
When the borrow output is 1, a < b. Using the result of this comparison, the larger magnitude
operand is routed to the rst input of the adder/subtractor, and the smaller one to the second input
(subtraend). The output of the adder/subtractor corresponds to the magnitude part of the result.
The sign must be selected, and it must be the sign of the number with the largest absolute value.
This operation is accomplished by a multiplexer controlled by the borrow output of the magnitude
subtractor, as shown in the Figure.
x y
sign(x) 8 8
sign(y)
7 7 bout =1 if a<b
a b
0 1 1 0 bout bin
Mux Mux Mag. Subtractor
1-sub
Adder/subtractor sign(y) sign(x)
0-add
1 0
Mux
sign(x+y)
x+y
The complementer and incrementer shown in the Figure are controlled by the sign bit of the numbers
being converted.
x y
sign(x) 8 sign(y) 8
0 7 0 7
Incrementer Incrementer
Adder 0
sign 8
7
Bit complementer
Incrementer
7
8
x+y
x y
sign(x) 8 sign(y) 8
0 7 0 7
Bit complementer Bit complementer
8 8
dif
Adder dif
sign 8
Bit complementer
7
Incrementer
8
x+y
Consequently, zR = Cz Cx + xr .
From the denition of Cz and Cx we get:
Cz Cx = 2m 2n
and the value of the extended range zR should be:
zR = 2m 2n + xR
From this last equation we get the following vector:
(1; 1; : : :; 1; xn 1; : : :; x0)
with (m n) 1s to the left of vector x, which shows the correctness of the algorithm.
Solutions Manual - Introduction to Digital Design - November 15, 2000 215
Exercise 10.17: A 4-bit ALU for ADD and NAND operations is shown in Figure 10.13. A
carry-ripple adder was implemented. By the use of a multiplexer, the output of the adder, or the
NAND gate is selected as circuit output.
xi yi
M
x3 y3 x2 y2 x1 y1 x0 y0
cin cin
cout
M M M M
f=ADD/NAND
1 0 ADD/NAND z3 z2 z1 z0
Mux
cout
zi
a n-1 b n-1 a 1 b 1 a 0 b 0
0
carry-out
carry-out
carry-out
carry-in
carry-in
carry-in
Iterative Iterative Iterative COMPARATOR
Bit Bit Bit OUTPUT
0 Comparator Comparator Comparator
a b
A B 0 1 0 1
s s
Comparator MUX MUX
A>B A=B A<B
SEL
z1 z0
(7) (7) (6) (6) (5) (5) (4) (4) (3) (3) (2) (2) (1) (1) (0) (0)
A B A B A B A B A B A B A B A B
A B A B A B A B A B A B A B A B
4-bit comparator 4-bit comparator 4-bit comparator 4-bit comparator 4-bit comparator 4-bit comparator 4-bit comparator 4-bit comparator
G E S G E S G E S G E S G E S G E S G E S G E S
G signals G signals
S signals S signals
A B A B
4-bit comparator 4-bit comparator
G E S G E S
0 0 0 0
cin inputs are zeroes
A B
for all modules
4-bit comparator
G E S
0 0 0 0
0 1 1 0
1 2 2 1
0
DEMUX
0 3 3
MUX
g 1
1 4 4 0
1 5 5 0
0
0 6 6
0
1 7 7
2 1 0 2 1 0
0 1 0
d e f
0 (high) 1
carry_out ADDER carry-in
1
2
a 0
ENCODER
PRIORITY
2
3 b 1
1
4 c 0
0
5
6
1 1 1
7
c_out c_out 0 0 1
Half Half 1 1 0 0 1 1 1 1 0 0 1 1 1
Adder Adder c_in 0 0 y1 =0
OR
sum_out sum_out MH MF MH
0 0 MF 0 MF 0 MF MF 0
MF 0
0 0
Figure 10.18: Exercise 10.23
Module MH
1 0 0 1 1 0 1 1 0 1 0 0 1 0 1 1
x_bit 0 0 0 0 0 0 0 0 y 2 =0
sum_in y_bit (a)
MF MF 0 MF MF 0 MF 0
MF 0 MF MH
0 0 0 0
c_out 1 0 0 0 1 1 1 0 0 1 0 1 1 0 1 0
Full 1
1 1 1 1 1 1 1 y 3 =1
Adder c_in
sum_out 0 MF 0 MF 1 MF 1 MF 0 MF 1 MF 1
MF 0 MH
Module MF
1 1 0 1 0 1 0 0 1 0 0 1 0 1
1 1
1 1 1 1 1 1 1 1 y 4 =1
1 MF 1 MF 1 MF 0 MF 0 MF 0
MF 0 MF 0 MH
1 0 0 0 1 0 1 0 0 0 1 1 1 1 1
1
1 1 1 1 1 1 1 1 y5 =1
1 MF 0 MF 0 MF 0 MF 0 MF 0 MF 1 MF 1 MH
0 0 1 1 1 1 1 0
p13 p 12 p 11 p10 p9 p8 p7 p6 p5 p4 p3 p2 p1 p0
(b)
223
224 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 10.24 The implementation of the 84-bit multiplier is shown in Figure 10.19.
y7 y6 y5 y4 y3 y2 y1 y0
x0
y7 y6 y5 y4 y3 y2 y1 y0
x1
a3 a2 a1 a0 b3 b2 b1 b0 a3 a2 a1 a0 b3 b2 b1 b0
cout cin cout cin 0
4-bit Binary adder 4-bit Binary adder
s3 s2 s1 s0 s3 s2 s1 s0
y7 y6 y5 y4 y3 y2 y1 y0
x2
a3 a2 a1 a0 b3 b2 b1 b0 a3 a2 a1 a0 b3 b2 b1 b0
cout cout cin 0
4-bit Binary adder cin 4-bit Binary adder
s3 s2 s1 s0 s3 s2 s1 s0
y7 y6 y5 y4 y3 y2 y1 y0
x3
a3 a2 a1 a0 b3 b2 b1 b0 a3 a2 a1 a0 b3 b2 b1 b0
cout cin cout cin 0
4-bit Binary adder 4-bit Binary adder
s3 s2 s1 s0 s3 s2 s1 s0
z11 z10 z9 z8 z7 z6 z5 z4 z3 z2 z1 z0
Chapter 11
Exercise 11.1 The register requires the load (LD), clear (CLR), and data inputs that are not
available in the SR
ip
op. We need to design a combinational network to generate the correct
SR inputs as shown in the next table:
x LD CLR S R
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 0 1
1 0 0 0 0
1 0 1 0 1
1 1 0 1 0
1 1 1 0 1
From the table we obtain:
S = x:LD:CLR0
CLR
0 1
1 1
x 0 1 1 0
R: LD
R = CLR + LD:x0
The circuit for the 4-bit register using SR
ip
ops is shown in Figure 11.1.
x3
M M q3
x x2
S Q q2
CK M
LD
R x1
CLR q1
M
x0
CK M q0
LD
CLR
Q3 Q2 Q1 Q0
Ir Q3 Q2 Q1 Q0
Ir
Shift Right Shift Parallel In/out RSR
Shift Left LOAD
CK
I3 I2 I1 I0
IL
b
a 16
16 1 parallel input Load
shift reg. CK
Load parallel input 1
CK shift reg.
Shift
Shift
CK
Modulo-16 TC cin
CLR counter
cout FA
4
1
D Q
CK
shift reg.
subtract parallel output CK
zero 16
Shift
s
last_bit
x input
3-bit Shift Register
CK
CK
K0
K1
K2
K3
si
c i+1
shift reg 1000 1100 0110 1011 1101 1110 0111 1011 0101 0010 0001 0000 0000
FF in
FF out
xi>yi
equal
xi>yi xi>yi
EQUAL GREATER EQUAL GREATER
equal
xi<yi xi<yi equal
xi<yi
xi>yi
SMALLER SMALLER
xi<yi
equal
Figure 11.6: State Diagrams for Serial Binary Magnitude Comparators - Exercise 11.6
(a) The system implementation for the comparison starting with the least signicant bit is
shown in Figure 11.7. A one-hot state encoding is used. The expressions for the next state in this
case are:
E (t + 1) = E (t):(x = y )
G(t + 1) = G(t):(x = y ) + (x > y )
S (t + 1) = S (t):(x = y ) + (x < y )
The initialize input clears the
ip-
ops and the counter such that initially E = 1, G = S = 0,
and the counter state is 0. The counter monitors the number of clock cycles while the signal compare
is active. After 32 clock cycles the Done signal becomes active for one clock cycle. Load signal
is used to store the parallel input values into the shift register. The system must be reset to start
another operation.
(b) The implementation of the serial comparator starting with the most-signicant bit is shown
in Figure 11.8. The expressions for the next state in this case are:
E (t + 1) = E (t):(x = y )
G(t + 1) = G(t) + E (t):(x > y )
S (t + 1) = S (t) + E (t):(x < y )
The counter has the same function as the one used in part (a).
Solutions Manual - Introduction to Digital Design - November 15, 2000 223
G
D Q
x
x>y
initialize CLR I4 I3 I2 I1 I0
Load Compare CNT Done
x=y E Mod-32 Counter TC
Shift Register D Q CK
CK LD q4 q3 q2 q1 q0
Load x<y 0
Shift Register S
CK D Q
y initialize
CK
Figure 11.7: Serial Binary Magnitude Comparator - LS bit rst - Exercise 11.6
G
D Q
x
x>y
initialize CLR I4 I3 I2 I1 I0
Load
E Compare CNTMod-32 Counter TC Done
Shift Register x=y D Q
CK CK LD q4 q3 q2 q1 q0
Load x<y 0
Shift Register S
CK D Q
y initialize
CK
Figure 11.8: Serial Binary Magnitude Comparator - MS bit rst - Exercise 11.6
224 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 11.7:
(a) The implementation of the serial change of sign module (complementer) for a 32-bit number
in two's complement system is shown in Figure 11.9. After the clear signal the counter is in state
0 and the NOR gate connected to its output forces a 1 input into the half-adder (HA). The other
input of the HA is connected to the complemented serial output of the shift register. The bits are
shifted out least-signicant bit rst and stored back into the same register. The carry bit of each
bit addition is delayed and inserted back into the HA, as done in serial addition.
clear CLR I4 I3 I2 I1 I0
complement CNT Mod-32 Counter TC Done
CK q4 q3 q2 q1 q0
LD
X
32
In out
Shift Register
CK
HA
CK FF
Figure 11.9: Serial change of sign (two's complement system) - Exercise 11.7
(b) When the adder receives two bits each clock cycle, it is necessary to use two shift registers.
One stores the bits of X in even positions, Xeven = (x30; x28; : : :; x2; x0). The other stores the bits
in odd positions, Xodd = (x31; x29; : : :; x3; x1). The output is stored back into the registers with
the same organization. Two HAs with extra logic are used to increment X 0. Since 2 bits per clock
cycle are processed, a modulo-16 counter is enough. This design is shown in Figure 11.10.
Solutions Manual - Introduction to Digital Design - November 15, 2000 225
clear CLR I3 I2 I1 I0
complement CNT Mod-16 Counter TC Done
X even CK LD q3 q2 q1 q0
16
In out
Shift Register 0
X CK
32 X odd
16
In out
Shift Register
CK
HA HA
CK FF
L2 2 0 1 2 3 4 5 6 7
L1 1 MUX E 1
L0 0
m m
Compl
I3 I2 I1 I0
Incrementer 1 CNT Modulo-16 LOAD
CK counter TC z
Q3 Q2 Q1 Q0
I3 I2 I1 I0
LOAD
1 CNT Modulo-16
CK counter TC z
Q3 Q2 Q1 Q0
state 14
(a) (b)
CK Register
0 1
Binary ADDER 0
0 1 0 0
clear CLR I3 I2 I1 I0
x CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
TC
0 0 0 0
clear CLR I3 I2 I1 I0
x CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
TC
0 1 2 3 4 5
counter loads
the value
15 14 11 10 9 8
counter loads
the value
1 Q1 0
clear CLR I3 I2 I1 I0
x CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
Q1 Q0
Q3
Q2’
Q1 Q2 Q2’
Q0 Q3 Q3’
Q3’ LOAD
Q2
Q0
Q3
x
Q3 Q0 Q2
Q0
T Q Q1 T Q
Q2
Q1 3 x 2
Q3’
Q0 CK Q’ CK Q’
Q3’ Q1 Q0
x
Q0 T Q T Q
x 1 0
CK Q’ CK Q’
1 0Q00 0 Q0
0 0 0 0
0 0 0 0 0 1 1 1
Q2 Q2
- - - - - - - -
Q3 Q3
0 1 - 1 1
0 - 0
I3: Q1 I2: Q1
Solutions Manual - Introduction to Digital Design - November 15, 2000 235
I1 = (Q01Q00 + Q1Q0):countdown
I0 = (Q2Q00 + Q3 Q00 + Q1Q00):countdown
Since when countup = 1 we must have countdown = 0, the value loaded when counting up (at
state count = 10) is I = 0, which is correct.
The network that implements the counter is shown in Figure 11.19. Black boxes were used to
represent the gate networks that implement I3 ; I2; I1; and I0.
countdown
Q
_
4 4 4 4
CLEAR I3 I2 I1 I0
clr
CNT Modulo-16 counter
CK L Q3 Q2 Q1 Q0
countdown Q
_
4
Q3
LOAD
Q1
countup where CCi means
combinational circuit
for function I
i
0 1 0 1
clear CLR I3 I2 I1 I0 Q4
x J Q
CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0 CK
Q4
K
Q3
Q0
Q3 Q2 Q1 Q0
z z
S3 S2 S1 S0 CLR S3 S2 S1 S0 CLR
1 1 0 1 0 0
CLK
z
first
counter
z
second
counter
When the value of the LOAD input is not active, the counter goes to the next state ((s(t) +
1) mod 8). The circuit is presented in Figure 11.23.
240 Solutions Manual - Introduction to Digital Design - November 15, 2000
1
1
1
0 0 1 1 0 0
S0/0 S1/0 S2/0 S3/0 S4/0 S5/1 S6/0
1 0 0
0 1
Q2 x
Q2 x’ Q1
Q1
clear 0 Q1
x 0
1
x
2
x’ 3 CLR I3 I2 I1 I0
x’ 4 CNT
MUX Modulo-16
x 5 CK CK Counter
x 6 LD
7 Q3 Q2 Q1 Q0
1
2 1 0
Q2 Q1 Q0
Q2 Q1 Q0
GO’ 0 E 0 I2 0 I0
A+B 1
A I0 0 2 clear CLR I3 I2 I1 I0
Q0 Q1 1 3 CNT
Q2 Mod-16 Counter TC
1 4 MUX CK LD q3 q2 q1 q0
I2
Q1 1 5
1 6
Q2 Q1 Q0
1 7
2 1 0
Q2 Q1 Q0 (b) implementation 2
1 1
GO 0 E 0 I2 0 I0 GO’ 0 E 0 I2 0 I0
C 1 A+B 1
1 2 clear CLR I3 I2 I1 I0 0 2 clear CLR I3 I2 I1 I0
0 3 CNT Mod-16 Counter TC 1 3 1 CNT Mod-16 Counter TC
0 4 MUX CK LD q3 q2 q1 q0 1 4 MUX CK LD q3 q2 q1 q0
0 5 1 5
0 6 1 6
Q2 Q1 Q0 Q2 Q1 Q0
0 7 1 7
2 1 0 2 1 0
I2 = Q01 Q0
I1 = 0
I0 = Q1 + Q2 + Q0 A
The gate networks for Ij are shown in Figure 11.24 for implementation 1 only, but it is the
same for all other implementations.
244 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 11.19:
We use up-counting for (s(t)+1) mod 10 function. Since the counter is module-16, it is necessary
to detect when the counter state is 9 and load a 0. Similarly, the count-down feature is used for
(s(t) 1) mod 8. For this case the value 7 has to be loaded whenever the counter state is 0, and
the value 0 is loaded whenever the count is 9 (since (9 1) mod 8 = 0). Consequently, if LOAD
overrides the count signals, we get:
(
(x = 1)
Count up = 10 ifotherwise (11:4)
(
Count down = 1 if (x = 2) (11:5)
0 otherwise
(
LOAD = 1 if ((x = 1 or x = 2) and s(t) = 9) or (x = 2 and s(t) = 0) (11:6)
0 otherwise
The value to be loaded is 8
>
<0 if s(t) = 9
i=> 7 if s(t) = 0 (11:7)
: don't care otherwise
For the binary implementation it is necessary to encode x into binary variables. We choose a binary
enconding such that x = 2x1 + x0 . This results in
Count up = x0
Count down = x1
LOAD = Q3Q0 (x1 + x0) + x1Q03 Q02 Q01Q00
I3 = 0
I2 = I1 = I0 = Q03
The corresponding network is presented in Figure 11.25.
Q3
clear 0
Q3
Q0
x1
CLR I3 I2 I1 I0
Q3 x1 DOWN
Q0 Modulo-16
CK CK
x0 Counter
Q3’ x0 UP LD Q3 Q2 Q1 Q0
Q2’
Q1’
Q0’
x1
Q3 Q2 Q1 Q0
0/
0/0
0/ 0/
Ae Be Ce 1/ 1/ De
1/
1/ 1/
1/
0/ 0/ 1/
Ao Bo Co 1/ Do
0/1
0/ when the output is not shown
2 or 3 can be used as output
Q0
Q1
Q0
Q2
x 0 0
Q0
x CLR I3 I2 I1 I0
Q1 CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
x’
Q1’
Q0’ Q2 Q1 Q0
6 11 5 4
2 10
9 13
0 8 12 14 15
1 3 7
5 2 9 4 10
11 6 13
0 8 12 14
1 3 7 15
0 0 0 0 0 0 0 0
0 0 0 0 modulo-8
counter
clear CLR I3 I2 I1 I0
x CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
T1
T0
E2 TC
E1 E2 E1 E0
E0
0 0 0 0
modulo-3
counter
CLR I3 I2 I1 I0
CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
T1 T0
(b) an 11-to-29 counter. A total of 19 states are needed. The cascade implementation of this
counter is shown in Figure 11.32. Observe that state 29 (11101) is detected and generates a load
signal. The value loaded corresponds to state 11 (1011).
0 0 0 0 1 0 1 1
The parallel implementation of this counter uses a modulo-30 parallel counter that is obtained
combining a modulo-5 and a modulo-6 counter. The state sequence, assuming that the state is
composed by (E; T ), where E = (E2E1E0 ) is the state of the modulo-5 counter and T = (T2T1T0)
is the state code of the modulo-6 counter, is presented (in decimal) in the following table:
252 Solutions Manual - Introduction to Digital Design - November 15, 2000
state E T state E T
0 0 0 15 0 3
1 1 1 16 1 4
2 2 2 17 2 5
3 3 3 18 3 0
4 4 4 19 4 1
5 0 5 20 0 2
6 1 0 21 1 3
7 2 1 22 2 4
8 3 2 23 3 5
9 4 3 24 4 0
10 0 4 25 0 1
11 1 5 26 1 2
12 2 0 27 2 3
13 3 1 28 3 4
14 4 2 29 4 5
Thus, to obtain the 11-to-29 counter we need to detect state 29 (4; 5) and load state 11 (1; 5).
The network is shown in Figure 11.33.
modulo-5
0 0 0 counter
clear CLR I3 I2 I1 I0
x CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
E2 E1 E0
0 0 modulo-6
counter
CLR I3 I2 I1 I0
CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
E2
T2 T1 T0
TC
0 0 0 0 0 0 0 0
clear
CLR I3 I2 I1 I0 CLR I3 I2 I1 I0
CNT Mod-16 Counter TC x CNT Mod-16 Counter TC
CK q3 q2 q1 q0 CK q3 q2 q1 q0
LD LD
Q4
Q3 TC z
Q1
Q4 Q3 Q2 Q1 Q0
detects
state 26
network shown in Figure 11.35 shows the parallel implementation of this frequency divider. The
circuit output corresponds to the load signal (TC).
modulo-7
0 0 0 0 counter
clear CLR I3 I2 I1 I0
x CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
T2 T1 T0
0 0 0 0
CLR I3 I2 I1 I0
CNT Mod-16 Counter TC
CK LD q3 q2 q1 q0
E1
E0’ TC E1 E0
T2
T1’
T0 z
0 0 0 0
CLR I3 I2 I1 I0
CNT
Modulo-16 TC
CK CK Counter
LD Q3 Q2 Q1 Q0
state
clear 14
CLR I3 I2 I1 I0
1 CNT
Modulo-16 TC
CK CK Counter
LD Q3 Q2 Q1 Q0
Q3 Q2 Q1 Q0
1 T Q T Q T Q T Q T Q Q4
Q0 Q1 Q2 Q3
0 1 2 3 4
CK
Q4 S 23
Q2 z
Q1
Q0
z
D Q D Q D Q D Q D Q
1 2 3 4 12
Q Q Q Q Q
CK
0 0 0 0 0 0 0 0
0
z
A A A A A C C C B B B B
Init A1 A2 A3 A4 A5 C1 C2 C3 B1 B2 B3 B4
B,C B,C B,C A,B
B,C B,C A,B A,B A,C A,C A,C A,C
Error
A,B,C
Figure 11.40: State Diagram for the electronic lock - Exercise 11.27
period, each time the user press them. A network for this task is shown in Figure 11.41 together
with the network that implements the lock controller. When a correct sequence is inserted (state
is B4) the output z = 1 is generated, and the controller goes back to the initial state. When a
wrong sequence is inserted the RED output is activated by the condition B 40 END (END = 1
when 12 characters were inserted). The output GREEN is 1 when the controller is at state INIT .
The Y ELLOW is 1 while the sequence is being inserted, that means, the sequence started to be
inserted and the RED or z output were not generated yet. When z = 0 the top counter goes to
state 15 (ERROR), and the bottom one stays at state 12. Only a reset signal R will remove the
counters from these states, if the wrong sequence is inserted. When z = 1 both counters load the
value 0 and they are ready to start another operation.
260 Solutions Manual - Introduction to Digital Design - November 15, 2000
A 0
A 1
A 2
A 3
A 4
C 5
C 6
C 7
B 8 MUX
B 9
B 10
B 11
0 12
0 13 R CLR I3 I2 I1 I0 push button
0 14 CNT Mod-16 Counter TC D Q
0 15 CK
3210 LD q3 q2 q1 q0
CK Q
B4
circuit used to obtain A, B, and C
0 0 0 0
A
R CLR I3 I2 I1 I0
B
C CNT Mod-16 Counter TC z
CK LD q3 q2 q1 q0
RED
z e
GREEN
YELLOW
NEQ
S Q c0
CK
R
S Q c1
CK
R
c2
S Q
CK
R
c3
S Q
CK
R
serial x
Left-shift Register input
CK
A3 A2 A1 A0 B3 B2 B1 B0
4-bit comparator
A>B A=B A<B
Chapter 12
Exercise 12.1:
The controller has 6 states, and we are going to use the one-
ip-
op per state appoach for the
design. The inputs are:
Input condition
GO
A DIST > 10
B (DIST 10) and (COUNT = 3)
C (DIST 10) and (COUNT 6= 3)
Calling the inputs of the
ip
ops for each state as NS , we generate the following expressions:
i
NS0 = S0 :GO 0
NS1 = S0 :GO + S3
NS2 = S1 :C
NS3 = S2 + S4
NS4 = S1 :A
NS5 = S1 :B + S5
These expressions are implemented in a PSA as shown in Figure 12.1.
250 Solutions Manual - Introduction to Digital Design - November 15, 2000
S0 S1 S2 S3 S4 S5 GO A B C
OR Array
-- connection made
S0 S1 S2 S3 S4 S5
Y2 = y2x + (y2 y1 + y2 y0 + y2 y1 y0 )x = y2 x + y2 y1 x + y2 y0 x + y2 y1 y0 x
0 0 0 0 0 0 0 0
Y1 = y1x + (y1 y0 + y3 y1 y0 )x = y1 x + y1 y0 x + y3 y1 y0 x
0 0 0 0 0 0
Y0 = y0x + (y1 y0 + y3 y0 )x = y0 x + y1 y0 x + y3 y0 x
0 0 0 0 0 0 0 0 0 0
TC = y3 y1 x
The implementation of these equations using a PSA is shown in Figure 12.2.
252 Solutions Manual - Introduction to Digital Design - November 15, 2000
y3 y2 y1 y0 x
OR Array
10
11
12
13
14
AND Array
Y3 Y2 Y1 Y0 TC
-- connection made
y3 y2 y1 y0
ROM
0 0 0 1 1
1 0 1 0 0
2 0 1 0 1
3 0 1 1 0
4 0 1 1 1
5 1 0 0 0
b0 0 6 1 0 0 1
b1 1 7 1 0 1 0
b2 2 decoder 8 1 0 1 1
b3 3 9 1 1 0 0
10 - - - -
11 - - - -
12 - - - -
13 - - - -
14 - - - -
15 - - - -
q2 q0
q3 q1
ROM
0 000000
1 000001
2 000010
a0 0 3 000011
a1 1
a2 2
a3
3
b0 4
decoder
b1 5
b2 6
b3 7
c0 8
c1 9
c2 10
c3 11
4095 1 0 1 1 0 1
s4 s2 s0
s5 s3 s1
Function:
(
S = A A+B +c if A + B + c < 10
in in
+ B + c 10 if A + B + c 10
in in
(
c = 0 if A + B + c < 10
in
out
1 if A + B + c 10
in
Calling a, b and s the integers obtained from the Excess-3 representation we get:
a = A+3
b = B +3
s = S+3
b + c 13 if a + b + c 6 10
in
in in
(
c = 0 if a + b + c in 6 < 10
out
1 if a + b + c in 6 10
The ROM implementation of a single digit Excess-3 adder requires 9 addressing lines (512
words). Four bits are used by each Excess-3 digit a or b (represented by a and b), and one bit is
used for carry input (c ). Each word needs to have 5 bits: four bits for the output digit in Excess-3
in
(s) and one bit for carry output (c ). We dene the address vector as x = (a; b; c ), which is the
out in
binary representation of x = 32a + 2b + c and the contents of each word as w = (c ; s), which
in out
corresponds to w = 16c + s. The value in each word position x of the ROM is given as:
out
(
w = aa + + b + c 3 if a + b + c < 16
in
b + c + 3 if a + b + c 16
in
in in
A block diagram for the ROM showing some words' contents is presented in Figure 12.5. Address
102, for example, corresponds to the addition of A = 0 and B = 0 in Excess-3 (a = b = 3), and
c = 0.
in
Solutions Manual - Introduction to Digital Design - November 15, 2000 257
ROM
0 -----
1 -----
2 -----
3 -----
c in 0
a0 1 102 00011
a1 2 103 00100
decoder
a2 3 104 00100
a3 4 105 00101
b0 5 106 00101
b1 6 107 00110
b2 7
b3 8
408 1 1 0 1 1
409 1 1 1 0 0
511 1 1 1 1 1
cout s 2 s 0
s3 s1
a b
1 0
decoder
0 1 2 3
f0 f1 f2 f3
Figure 12.6: Implementation of switching function using one decoder and ROM- Ex. 12.7
1 1 1 1
f0 f1 f2 f3
Figure 12.7: Implementation of switching function using ROM and MUX - Ex. 12.7
260 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 12.8:
Since the number of products used by each output is not known, we need to assume the worst
case situation, when most of them are used by a single output, and 1 (or none) is used by the other
outputs. The PLA provides only 128 product terms, thus, we need to use two PLAs to obtain 256
product terms, combining their outputs with OR gates. The number of inputs is also larger than
the number of inputs in each PLA device, thus, a binary decoder is used to select among 4 dierent
PLA banks, each bank consisting of a pair of PLAs with ORed outputs. The design is shown in
Figure 12.8.
(x11,x10,...,x1,x0)
PLA bank
0
x12 0
binary 1
En Input En Input x13 1
dec 2
3
PLA PLA E
outputs outputs 1 PLA Bank PLA Bank PLA Bank PLA Bank
0 1 2 3
z0 z1 z2 z3
ROM
0 00010
1 00100
2 00110
3 01000
4 01010
5 01100
6 01110
0 7 10000
decoder
1 8 10010
2 9 00001
3 10 -----
11 -----
12 -----
13 -----
14 -----
15 -----
TC
CNT
LD
CK Register
Q3 Q2 Q1 Q0
system
inputs
address
active MUX
in each ROM
state
Present
address
State CLK
ROM
outputs
(d) For a Mealy system, with the same conditions of the one considered in part (c), a 210 11
ROM, a network of muxes to select the input (same as in part (c)), and a 9-bit register are
used. The ROM stores both the next state bits and the output values.
(e) Since the system in part (c) is implemented as a Moore machine, the output doesn't depend
on the input values, and for this reason, this question doesn't make sense. If we apply this
idea to the system in part (d), then the output should be generated by a separate ROM with
11 addressing lines and 2-bit words. The generation of the next state would be done by a
210 9 ROM. The network of muxes to select the inputs would be used, and a 9-bit register
would store the state bits.
264 Solutions Manual - Introduction to Digital Design - November 15, 2000
Exercise 12.12:
From Figure 12.18 of the text we obtain the following state transition and output table:
PS Input z
y2 y1 y0 x = 0 x = 1
000 000 100 1
001 010 110 0
010 000 100 0
011 011 111 0
100 001 101 1
101 000 100 0
110 011 111 0
111 001 101 1
NS
Using the name S for state i we obtain the following high level description of the sequential
i
system:
Input: x 2 f0; 1g
Output: z 2 f0; 1g
States: S , with 0 i 7
i
0
0
0 0
S0/1 S1/0 S2/0 1 S3/0
1 1
1
0
0
0 0
1 1
S7/1 S6/0 S5/0 S4/1
1
1
Next Present
1 1 ROM state Reg State
a 0 E E 0 01110 Y2 y2
c 1 1 00100
a 2 2 01100 Y1 y1
b x
3 MUX 3 3 00100
b 4 y2 2 4 10000 Y0 y0
5 y1 1 5 xxxxx
6 y0 0 6 xxxxx CK
7 2 1 0 7 xxxxx
8 00101
y2 y1 y0 9 01001
10 10001
(present state) 11 00000
12 01111
13 xxxxx
14 xxxxx
15 xxxxx
z0
z1
Y2Y1Y0
(next State)
T1 ROM
s
8 words s=0
T2
System
CK T3
s=1
s=2
3 s=3
Q2Q1Q0
4
s 4 D Q most significant
s=4 Q2Q1Q0 T1T2T3 L
address bits 0 0 1 0 1 1 0
CK 0 1 0 1 1 0 0
ce s=5 0 1 1 1 1 1 0
1 0 0 1 0 0 0
1 0 1 1 0 1 0
L 1 1 0 0 0 0 0
1 1 1 0 0 1 0
0 0 0 0 0 0 1
s=15
3 3
Q2Q1Q0
L
T1T2T3
ROM
0 000100000
1 000100000
2 001100000
3 001100000
4 010010000
5 101010000
6 100010000
7 100010000
8 011001000
9 011001000
10 --------
GO 0 11 --------
DIST>10 1 12 001000100
0 2 COUNT=3 13 001000100
0 3 0 decoder 14 --------
0 4 MUX 1 15 --------
0 5 2 16 011000010
0 6 3 17 011000010
Reg.
0 7 4 18 --------
CK
19 --------
2 1 0 20 101000001
21 101000001
22 --------
23 --------
24 --------
25 --------
26 --------
27 --------
28 --------
29 --------
30 --------
31 --------
STOP
MOVE
COUNTUP
TURNLEFT90
CHECK
CLEAR
address
ROM
TC
CLK
0 0 0 0
1 0 0 0
2 0 0 0
3 0 0 0 0 0 0
4 0 0 0 1 0 0
5 - - - 2 0 0
x 20 6 - - - 3 - - 0 0
0
x 21 7 - - - 4 0 0 x 00 0 1 0
1
x 22 8 0 0 0 5 0 1 y 00 1 2 0
2 x 10 0
y 20 9 0 0 1 6 1 0 3 1
3 x 11 1
y 21 10 0 1 0 7 - -
4 y 10 2
y 22 11 0 1 1 8 0 0
5 y 11 3
12 1 0 0 9 1 0 z 00
13 - - - 10 0 1
14 - - - 11 - -
15 - - - 12 - -
13 - -
14 - -
40 - - - 15 - -
z 11 z 10
63 - - -
z22 z 21z 20
PLA. If more inputs and products are available in the component, functions z1 and z00 could also
i
be implemented in the same PLA. A total of 21 products were listed in the expressions above,
however, it is possible to reduce this number of products to 20. Using ESPRESSO we were able to
reduce the number of products to generate z2 from 16 to 15 (the others cannot be reduced). One
possible solution is to combine m2 (9) and m2 (25) on the generation of z20 and obtain the single
product term y22 y20x22 x21x20. ESPRESSO also reduces the number of literals in each product
0 0 0
Y1 = Q1Q0 + Q1Q0
0 0
Y0 = Q3Q0
0 0
A pair of these functions can be implemented by a CLB (two 3-input functions). When we
add the inputs CNT, LD, and parallel input, to the variable Y (in order to generate the actual
i
value that is loaded as each state bit), we get a function of 4 inputs, that requires 1 CLB for
each state bit. Thus the total number of CLBs is 6. The required
ip
ops are available on
the CLBs used for combinational logic.
an 8-bit two's complement adder. A Carry Ripple adder will require 8 Full Adders. Each
CLB can implement 1 FA, thus, the total number of CLBs in this implementation is 8.
a 4 2 multiplier (positive integers). To generate the partial products 4 CLBs are used (2
product bits per CLB). These bits are summed in a 5-bit adder, which, based on the result
given in the previous item, will require 5 CLBs. Thus, the total number of CLBs required to
implement the multiplier is 9. The reader may also try to reduce this number by creating a
optmized mapping of the the product generation and addition funtions for the least signicant
bits.
267
Chapter 13
Exercise 13.1
Graphs for cases (a) and (b) are shown in Figure 13.1.
f0 f0
OR
f1 f3
OR OR
f2
f1 f2 Group 1
T AND
f4
T
F f4
f3 F
f5 f6 Group 2
f5
AND
f7
f6
f8
f7
f8
Exercise 13.2
Trace of variable's values for the VHDL description shown in Example 13.6, with xin = 5 and
yin = 9 is given as follows:
- Before the loop: a = 5, and w = 9
- Inside the loop:
+ rst iteration: a = 6 and w = 8
+ second iteration: a = 7 and w = 7
+ loop stops
- zout = 28
Exercise 13.3
The algorithm presented in Example 13.7 is based on the recurrence:
zi+1 = zi (2 xzi)
The algorithm stops when jzix 1j < 0:5.
When the inputs for the algorithm are:
x = 23 and = 10 5
each variable will have the values shown in the next table:
step j zj Error
0 1
1 1.3333333 0.111111
2 1.4814814 0.001234
3 1.4997714 0.000015
4 1.4999999 2 10 8
After 4 iterations, the result has an error that is smaller than 5 10 6 .
Exercise 13.4
When the input x = 1=3 is applied to the algorithm presented in Example 13.7, considering an
error = 10 5 we obtain the following execution sequence:
step j zj Error
0 1
1 1.6666666 0.444444
2 2.4074074 0.197530
3 2.8829447 0.039018
4 2.9954327 0.001522
5 2.9999930 0.000002
From this trace we can see that the algorithm will converge even with the input being out of
range (x should be in the range [1=2; 1]). A wrong estimate of the error however can happen, since
the condition zk 1=x < is equivalent to 2(zk x 1) < only when x 1=2. Another problem
happen if x is out of range, and is also too small, resulting in a reciprocal with too many integer
bits, while the circuit is designed to handle at most two integer bits.
The algorithm will not converge when x 2.
Solutions Manual - Introduction to Digital Design - May 29, 2001 269
Using prescaling, input x is multiplied by 2 until 2k x is in the proper range. The scaled value
2k x isused as input for the algorithm. For example:
x = 13 ! 2x = 32
which is in the correct range, and corresponds to the input given in Exercise 13.3. So, the algorithm
input should be 2x.
The output generated by the algorithm (z ) must be corrected by multiplying it by the same
scaling factor 2k used to prescale the input x. Based on the previous example: z = 1:5, and 2z = 3,
which corresponds to the correct result.
Exercise 13.5
p
We want to compute z = a using the recurrence equation:
zi+1 = 21 (zi + za )
i
Since z 2 = a, the stop condition is dened as z 2 a < , where is the maximum error in the
nal result. The execution graph is presented in Figure 13.2.
Input
a, error
z=1
w=z*z
Y
jw aj < error
N
a 1
output z z = (z + )
z 2
ENTITY sqroot IS
PORT (a_in: IN REAL RANGE 0.5 TO 1.0;
Error: IN REAL RANGE 0.0 TO 0.1;
z_out: OUT REAL RANGE 0.7 TO 1.0;
CLK: IN BIT);
END sqroot;
i 11 10 9 8 7 6 5 4 3 2
2 inputs
* * * level i
a=6*5 b=4*3
AND
c=a*b
* * level 2
c*2
* level 1
Input n
r=1, f=1
r<n Y r= r+1
Output f f=f*r
Exercise 13.7
Execution graph of the algorithm that obtains the maximum value among n positive integers.
All n integers are stored in a vector V . The vector is scanned from position 0 to position n 1. In
this process, the maximal value is obtained. The computation graph is shown in Figure 13.6.
Input
V,N
MAX = V(0)
I=1
N
I<N
Y
Y
Output MAX < V(I) MAX = V(I)
MAX
N
I=I+1
Exercise 13.8
The degree 9 polynomial is represented as:
9
X
P9 (x) = ai x i
i=0
The sequential and concurrent execution graphs for the polynomial computation are shown in
Figure 13.7. Using similar organization of Figure 13.5 and 13.6 of the textbook we obtain the
organizations presented in Figure 13.8.
Begin
Begin
Y
i>0 i=i-1 P9(x)=N*A+M
END END
Exercise 13.9
The networks generated for each case is shown in Figure 13.9.
274 Solutions Manual - Introduction to Digital Design - May 29, 2001
x a9 a7 a5 a3 a1
M M M M M M
Step4
a8 a6 a4 a2 a0
Step3
F Control Step2
+ + + + + Step1
A B C D E
M M M
L x J x L
x F B x D x x N
+ + I I I I I I I I I I I I
11 21 11 21 11 21 11 21 11 21 11 21
x F a9 F a7 F a5 L a3 L a1 A
I 12 I 22 I 12 I 22 I 12 I 22 I 12 I 22 I 12 I 22 I 12 I 22
J K 0 0 a8 C a6 E a4 K a2 0 a0 M
I 13 I 23 I 13 I 23 I 13 I 23 I 13 I 23 I 13 I 23 I 13 I 23
M M O O O O O O O O O O O O
1 2 1 2 1 2 1 2 1 2 1 2
N F L A J B K C M D N E P9(x)
M +
M
+
P9(x)
Exercise 13.10
The state diagrams corresponding to the VHDL descriptions on this Exercise are shown in
Figure 13.10.
Exercise 13.11
The state diagram for the system operation is shown in Figure 13.11.
For N = 5 the trace of the computation is shown in the following table:
entity p13_12a is
port (X: in BIT_VECTOR (0 to 7);
clk,sel,ldW: in bit;
W: out BIT_VECTOR (0 to 7));
end p13_12a;
architecture arch of p13_12a is
-- process description - Exercise 13.12(a)
BEGIN
PROCESS (CLK)
variable WIN: BIT_VECTOR (0 TO 7);
BEGIN
IF (CLK'event AND CLK='1') THEN
IF (sel = '1')
THEN WIN := X;
ELSE WIN := NOT(X);
END IF;
IF (ldw = '1')
THEN W <= WIN;
END if;
END IF;
END PROCESS;
END arch;
276 Solutions Manual - Introduction to Digital Design - May 29, 2001
entity p13_12b is
port (W,Z: in BIT_VECTOR (0 TO 15);
clk,ldXY: in BIT;
X,Y: out BIT_VECTOR (0 TO 15));
end p13_12b;
Architecture arch of p13_12b is
-- process description - Exercise 13.12(b)
begin
PROCESS (CLK)
variable XIN,YIN: BIT_VECTOR (0 TO 15);
BEGIN
IF (CLK'event AND CLK='1') THEN
IF (W>Z)
THEN XIN := W;
YIN := Z;
ELSE XIN := Z;
YIN := W;
END IF;
IF (ldxy = '1')
THEN X <= XIN;
Y <= YIN;
END IF;
END IF;
END PROCESS;
END arch;
Exercise 13.13
Control: Assume that E is connected to CNT input, and ldk is connected to the LOAD input
of the mod-4 counter. Based on these assumptions and the networks presented in Figure 13.31 of
the text we obtain the following expressions:
E = (ldk)0
ldK = (A 7:S 1) + (c out:S 2)
ldC = clrB = c out:S 2
ldA = K 10 :K 00
S1 = K 10 :K 0
S2 = K 1:K 00
ldB = K 1:K 0
The value of ldK for all possible outputs of the counter is given by the following table. This
signal will force the counter to load a zero value.
Solutions Manual - Introduction to Digital Design - May 29, 2001 277
counter state ldK
0 0
1 A7
2 c out
3 0
Observe that the counter will be forced to zero in state 1 if A 7=1, or in state 2 if c out=1.
The state diagram for the control part is shown in Figure 13.12.
278 Solutions Manual - Introduction to Digital Design - May 29, 2001
The high-level description of the system in VHDL follows. The signals A, B , and C represent
the output of each register.
LIBRARY ieee;
USE ieee.std_logic_arith.all;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
entity p13_13 is
port (X: in STD_LOGIC_VECTOR (7 downto 0);
CLK: in STD_LOGIC;
Y: out STD_LOGIC_VECTOR (7 downto 0));
end p13_13;
architecture arch of p13_13 is
-- process description - Exercise 13.13
SIGNAL A,B,C: STD_LOGIC_VECTOR (7 downto 0):=(OTHERS=>'0');
SIGNAL state: NATURAL RANGE 0 TO 3 := 0;
SIGNAL c_out: STD_LOGIC := '0';
SIGNAL adder_out: STD_LOGIC_VECTOR (8 downto 0);
begin
adder_out <= ('0'&A) + ('0'&B);
c_out <= adder_out(8);
CTR:PROCESS (CLK)
BEGIN
IF (CLK'event AND CLK='1') THEN
CASE state is
WHEN 0 => A <= X; state <= 1;
WHEN 1 => IF (A(7) ='1')
THEN state <= 0;
ELSE state <= 2;
END IF;
WHEN 2 => IF (c_out='1')
THEN C <= B;
B <= "00000000";
state <= 0;
ELSE state <= 3;
END IF;
WHEN 3 => B <= adder_out(7 downto 0);
state <= 0;
END CASE;
Y <= C;
END IF;
END PROCESS;
end arch;
The system accumulates all entries with values less than 128, until the accumulated value cannot
absorb another input X < 128 without over
owing. In this case, the internal accumulator value is
registered as output and the internal state is reset. The trace of the system operation for a chosen
Solutions Manual - Introduction to Digital Design - May 29, 2001 279
sequence of inputs is shown in Figure 13.13.
280 Solutions Manual - Introduction to Digital Design - May 29, 2001
Exercise 13.14
The high-level specication for the two's complement multiplier is:
Inputs: x; y 2 f (2n 1 1); : : :; 1; 0; 1; : : :; (2n 1 1)g
Output: z 2 f (2n 1 1); : : :; 1; 0; 1; : : :; (2n 1 1)g
Function: z = x y
For a 32 32 bit multiplier we have n = 5.
Considering that the inputs and output are represented in two's complement number system,
their bit-vector representations are:
x = (xn 1; : : :; x1; x0); y = (yn 1 ; : : :; y1; y0); z = (z2n 1 ; : : :; z1; z0)
P P
where x = xn 1 2n 1 + ni=02 xi 2i , y = yn 1 2n 1 + ni=02 yi 2i , and z = z2n 1 22n 1 + 2i=0
P n 2 z 2i .
i
The computation is based on the recurrence:
(
zi+1 = 11==2( 2(zi + (x 2n )yi ) if i < n 1
zi (x 2n )yi) if i = n 1
which represents the case when the most signicant bit of the multiplier is 1 (negative number).
The general architecture of the multiplier is shown in Figure 13.14.
The behavioral description of the multiplier is shown next:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
ENTITY multiplierTC IS
GENERIC (n: NATURAL := 32); -- number of bits in the operands
PORT (start: IN BIT;
xin,yin: IN SIGNED (n-1 downto 0);
clk: IN BIT;
zout: OUT SIGNED (2*n-1 downto 0);
done_out: OUT BIT);
END multiplierTC;
A numerical example of the multiplier operation is shown in the following table for the values
X = 125 = (10000011)2 and Y = 37 = (11011011)2.
clk state count X Y Z
0 0 x xxxxxxxx xxxxxxxx xxxxxxxxxxxxxxxx
1 1 x xxxxxxxx xxxxxxxx 0000000000000000
2 2 x 10000011 11011011 0000000000000000
3 2 1 10000011 01101101 1100000110000000
4 2 2 10000011 00110110 1010001001000000
5 2 3 10000011 00011011 1101000100100000
6 2 4 10000011 00001101 1010101000010000
7 2 5 10000011 00000110 1001011010001000
8 2 6 10000011 00000011 1100101101000100
9 2 7 10000011 00000001 1010011100100010
10 2 0 10000011 00000000 0001001000010001
Exercise 13.15
The high-level specication of the 3232 serial-parallel multiplier for positive integers is given
as follows, for n = log232 = 5 bits:
Input: x; y 2 f0; 1; 2; : : :; 2n 1g
Output: z 2 f0; 1; 2; : : :; 22n 2n+1 + 1g
Function: z = x y
A block diagram of the data path for the multiplier is shown in Figure 13.16. The left multiplexer
is used to select among the 4 multiples of X , that means: 0, X , 2X , and 3X . To enable the
generation of the 3X value using the same adder used during the algorithms iterations, some gates
were inserted in the path of the selection signals of this multiplexer to force the X value as an
output. Another multiplexer was placed at the other input of the adder to receive the 2X value.
After the value 3X is generated, the iterations will be executed.
The VHDL specication of the radix-4 multiplication algorithms is given next:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
USE ieee.std_logic_unsigned.all;
ENTITY radix4_multiplier IS
GENERIC (n: NATURAL := 8); -- number of bits in the operands
PORT (start: IN BIT;
xin,yin: IN UNSIGNED (n-1 downto 0);
clk: IN BIT;
zout: OUT UNSIGNED (2*n-1 downto 0);
done_out: OUT BIT);
END radix4_multiplier;
A trace of this code execution for two arbitrary inputs is shown in Figure 13.17. The values are
284 Solutions Manual - Introduction to Digital Design - May 29, 2001
represented in octal.
For a 88 case, with the operand values x = 135 and y = 115, this is the result of the algorithm
execution:
clk state count X Y 3X Z
0 idle x xxxxxxxx xxxxxxxx xxxxxxxxxx xxxxxxxxxxxxxxxx
1 setup x xxxxxxxx xxxxxxxx xxxxxxxxxx xxxxxxxxxxxxxxxx
2 gen3x 0 10000111 01110011 xxxxxxxxxx 0000000000000000
3 active 0 10000111 01110011 0110010101 0000000000000000
4 active 2 10000111 00011100 0110010101 0110010101000000
5 active 4 10000111 00000111 0110010101 0001100101010000
6 active 6 10000111 00000001 0110010101 0110101110010100
7 done 6 10000111 00000000 0110010101 0011110010100101
Exercise 13.16
A recongurable CS/CR adder is shown in Figure 13.18. When the control signal c = 0, the
FA's input comes from the external input, and the network implements the CSA. When c = 1, the
carry out bits of each FA is connected to one of the inputs of the neighboring module, creating
the carry ripple chain required to reduce the carry vector and sum vector. Only the sum output
of the FAs presents the addition result in this case. The delay of the recongurable adder has one
multiplexer delay longer than the simple CS adder.
The critical path of the multiplier is:
T = Tadd + TRsetup + TRprop
where Tadd is the delay of the adder (CS or CR), TRsetup and TRprop are the setup and propagation
delays of the register (Z ). The number of cycles required for multiplication is n + 1.
Assuming that the multiplexer delay (tmux ) is similar to the delay of the register (treg ), the
number of cycles for nal addition using the recongurable adder would be:
n(tFA + tmux ) n cycles
tFA + tmux + treg
giving a total of 2n +1 cycles for the multiplier using CSA. However, the cycle time of the multiplier
using CRA is ntFA + treg , while the cycle time for the multiplier using CSA is only tFA + tmux + treg .
Thus
TCRA = (n + 1)(ntFA + treg )
TCSA = (2n + 1)(tFA + tmux + treg ) = (2n + 1)(tFA + 2treg )
and it is not dicult to see that the CSA implementation is faster than the CRA implementation
for even small values of n.
A modied controller to operate with the recongurable adder is presented next:
ENTITY multctrl IS
GENERIC(n: NATURAL := 16;
-- number of bits
m: NATURAL := 16);
-- number of clock cycles for ****
-- conversion (m less equal n)****
PORT (strt : IN BIT; -- control input
ldX,ldY,ldZ: OUT BIT; -- control signals
Solutions Manual - Introduction to Digital Design - May 29, 2001 285
shY, clrZ : OUT BIT; -- control signals
CRA_ctr : OUT BIT; -- control signal ****
done : OUT BIT; -- control output
clk : IN BIT);
END multctrl;
Lines marked with four asterisks were modied or inserted in the original VHDL code for the
286 Solutions Manual - Introduction to Digital Design - May 29, 2001
multiplier control section (as shown in the text). A new control signal CRA ctr was included in the
controller interface. This signal is 1 when we want the carry bit to propagate on the adder. Two
other states were also included: convert and store. During the convert state, CRA ctr is activated
for a given number of cycles m n (m is dened based on the delay of the carry propagation
through the adder when the carry ripples). In the convert state, there is no shift in the Y register,
and no load on the Z register. Once the controller waited enough for the carry to propagate, it
moves to state store, where the ldZ control signal is activated to store the non-redundant addition
result into the Z register. The Z register for a CS representation of the partial product is composed
of two sub-registers: PS (sum vector) and C (carry vector). The non-redundant result will be
available on the PS register only.
Solutions Manual - Introduction to Digital Design - May 29, 2001 287
a b c
A B
Comparator
A<B A=B A>B
0 1 0 1
MUX MUX
a b
Part (a)
16 temp count
0 1
Decrementer MUX
1
15
NOT temp
least significant
bit 15
AND
c count-1=1
Part (b)
a b
b a
+ d
0 1 0 1
c c
MUX MUX
c d
0 1 0 1
MUX MUX
c
d
c d
Part (c)
start N<>0
(a)
start C=1 N=0
1 2 3 4
C=0
start
end 4
5
start
(c)
start
0 1 2 3
done
done 4
6 5
odd(X)/X=5X+1,
I=I-1
/X=N,
I=3 I>0/
0 1 2 I=0/
odd(X)/X=X/2,
I=I-1
0/ldA 1/
A_7=1/
c_out=1/ldC,
clrB A_7=0
c_out=0/
3/ldB 2/
0 500 1 us 1500
Entity:p13_13 Architecture:arch Date: Mon Nov 22 16:45:36 PST 1999 Row: 1 Page: 1
/multipliertc/start
/multipliertc/xin 1001
/multipliertc/yin 1101
/multipliertc/clk
/multipliertc/zout UUUUUUUU 00000000 11001000 11100100 10111010 00010101
/multipliertc/done_out
/multipliertc/state idle setup active done idle
/multipliertc/x UUUU 1001
/multipliertc/y UUUU 1101
/multipliertc/z UUUUUUUU 00000000 11001000 11100100 10111010 00010101
Entity:multipliertc Architecture:behav Date: Sun Nov 21 20:30:24 PST 1999 Row: 1 Page: 1
Figure 13.15: Trace of execution of a 4-bit Two's complement multiplier - Exercise 13.14
Solutions Manual - Introduction to Digital Design - May 29, 2001 291
Adder 0
n+2
(b) system’s block diagram
(a) Data path
Figure 13.16: Block Diagram for the Data path of the radix-4 multiplier
/radix4_multiplier/start
/radix4_multiplier/xin 262
/radix4_multiplier/yin 330
/radix4_multiplier/clk
/radix4_multiplier/zout XXXXXX 000000 054400 041300 113060
/radix4_multiplier/done_out
/radix4_multiplier/state idle setup gen3x active done
/radix4_multiplier/x XXX 262
/radix4_multiplier/y XXX 330
/radix4_multiplier/z XXXXXX 000000 054400 041300 113060
/radix4_multiplier/xxx XXXX 1026
Entity:radix4_multiplier Architecture:behav Date: Sun Nov 21 20:24:21 PST 1999 Row: 1 Page: 1
c c c c
FA FA FA FA
Chapter 14
Exercise 14.1 The design of the 2-read/1-write register le can be implemented with registers
with 2 tristate outputs (A and B ), as shown in Figure 14.1. We call these registers: RF Registers.
Besides the two tristate outputs, they have one input din, a write enable input EWi, and two
\enable output" inputs: EOA and EOB to control each of the register tristate outputs. The
design of this component based on a conventional register and tristate buers is also shown. The
interconnection of all the A outputs of the RF registers forms the RBUSA (read bus A). Similarly
for the B outputs. All the RF register inputs are also interconnected, forming the write bus WBUS.
The binary decoders are used to generate the control signals for writing and reading the register
le.
IN
WBUS
8 8 8 RF Reg.
din din din
EW0 EW1 EW15 EW LD din
RF RF RF REG.
CLK
Reg Reg Reg
EOA0 EOA1 EOA15
0 1 15
EOB0 A B EOB1 EOB15
8 8 RBUS B
RBUS A EOA
clock EOB
A B
8
IN
4 WR
4 RA Register
4 RB File
A B
8 8
data_in
n
Address
CLK
Rd SAM
ACK
Wr
data_out
m
PACKAGE sam_pkg IS
CONSTANT N: NATURAL := 4; -- number of address bits
CONSTANT M: NATURAL := 4; -- number of bits per word
SUBTYPE word is BIT_VECTOR (M-1 DOWNTO 0);
TYPE mem_array IS ARRAY (2**N-1 DOWNTO 0) OF word;
SUBTYPE addressT IS NATURAL RANGE 0 TO 2**N-1;
END sam_pkg;
USE work.sam_pkg.ALL;
ENTITY sam IS
PORT ( data_in: IN word;
address: IN addressT;
Rd,Wr: IN BIT;
CLK: IN BIT;
data_out: OUT word;
ack: OUT BIT);
Solutions Manual - Introduction to Digital Design - May 29, 2001 291
END sam;
ELSE
ack <= '0';shift <= '0';
END IF;
END IF;
IF (CLK'event and (CLK='1') )
THEN
IF ((Wr='1') and (ready='1'))
THEN data(address) <= data_in;ack <= '1' after 2 ns;
ELSE
IF ((Rd='1') and (ready='1'))
THEN ack<='1' after 2 ns;
ELSE ack<='0' after 2 ns;
END IF;
END IF;
END IF;
END PROCESS;
END high_level;
/sam/address 4 6 8 4
/sam/rd
/sam/wr
/sam/clk
/sam/data_out 0000 1101 0000 0110 0000 1101
/sam/ack
/sam/shift
/sam/ready
/sam/data
/sam/access_adr 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4
(b) The data path that supports the computation described in the VHDL code is shown in
Figure 14.4. The following table list the control points and conditions for the data path:
Solutions Manual - Introduction to Digital Design - May 29, 2001 293
data_in
shift m
SHIFT data_in
ready
data_in
m m m m m
0 m 0 m 0 m 0 m 0
m m m m m
1 1 1 1
1 m
Reg. Reg. Reg. Reg. m
2
m
3
Reg.
shift
CLK
data_out
load_data
circular shift register (5 positions)
Signal Description
load data control signal - loads the data in into the current (accessible)
position of the circular shift register.
shift control signal - forces the circular register to shift the infor-
mation while the current address (access addr) is dierent
than the requested address.
data in data input and output for the circular shift register.
data out
ready condition signal - when 1 indicates that the requested position
in the circular shift register was reached.
294 Solutions Manual - Introduction to Digital Design - May 29, 2001
Exercise 14.3
(a)
2n 1
X
T= (dC1 + C2 )p(d)
d=0
where p(d) is the probability of distance d. As distances are uniformly distributed, we get:
p(d) = 21n
Based on the previous equations we obtain:
n 1
2X n
T = (dC1 + C2 ) 21n = 21n 2n C2 + C1 22 (2n 1)
d=0
n
T = C2 + C1(22 1)
(b) when (
p(d) = 1 if d = 1 (14:1)
0 otherwise
the average time becomes:
2n 1
X
T= (dC1 + C2)p(d) = C1 + C2
d=0
(c) Block access. Time to access a block of k words is kC1 + C2 (when assuming pipelined
execution C2 is absorbed in intermediate steps). The average time to go from block position i to
block at position j , and access k consecutive positions is given as:
2n 1
X
T Block = (dC1 + (k 1)C1 + C2)p(d)
d=0
n
= 21n 22 (2n 1)C1 + 2n ((k 1)C1 + C2)
n
= (2 1) C1 + (k 1)C1 + C2
2
(2
1 n 1)
= k 2 C 1 + (k 1)C 1 + C 2
Exercise 14.4
Direct-access memory: address A = (Ar ; As ), where Ar = A=M is a random access and As =
A mod M is a sequential address.
(a) design of direct-access memory with 16K words (14-bit address). Each word has 8 bits.
The random address selects one among 210 = 1K sequential memory blocks of M = 16 words. A
block diagram of the circuit is shown in Figure 14.5. Each SAM module is designed as described
in Exercise 14.2. All SAM modules receive the same address, read, clock, and data input signals.
Depending on Ar , one of the modules are selected by the signal selm<i>. When a module is selected, a
write or read cycle may be performed. When reading, all modules will start accessing the requested
address position, but only the module that is selected will generate the acknowledgement signal
Solutions Manual - Introduction to Digital Design - May 29, 2001 295
4
As addr
data_in 8 data 8
in 16-word
Write Read SAM
Rd
Wrm0 M0 selm0
selm0 Wr
ack
clock
4 selm0
As addr
data_in 8 data
in 16-word 8 8 data_out
Read Rd SAM
Wrm1 Wr M1 selm1
selm1 ack
clock
selm1
4
As addr
data_in 8 selm0
data 8
in 16-word 10
selm1
Read SAM Ar Binary
Rd
Wrm15 M1023 selm15 decoder
selm1023 Wr
ack selm1023
clock
(ACK) and the output data. When writing, only the selected module will search the correct address
position and perform the storage of the data input.
(b) average access time. The time to access a position from the direct-access memory will
depend on the time to access the SAM. The access time for a SAM with 1K words is given as:
T = C1((j i) mod 24) + C2
where i is the current address, j is the requested address, C1 and C2 are implementation-dependent
constants.
case (a) distance between addresses of consecutive accesses is uniformly distributed:
X
24 1
T= (dC1 + C2)p(d)
d=0
where p(d) is the probability of distance d. As distances are uniformly distributed, we get:
p(d) = 214
296 Solutions Manual - Introduction to Digital Design - May 29, 2001
T = C2 + C1 (22 1)
4
case (b) when the distance between addresses is given by the function:
(
d=1
p(d) = 10 ifotherwise (14:2)
= (2 2 1) C1 + (k 1)C1 + C2
4
" 4 #
= 1 (2 1) C1 + (k 1)C1 + C2
k 2
Exercise 14.5
R3 <= R1; LP1 <= R2; RP1 <= R1; R1 <= P1;
LP2 <= R3; RP2 <= R4; R4 <= P2;
R2 <= R4; LP1 <= R2; RP1 <= R1; R1 <= P1;
LP2 <= R2; RP2 <= R3; R2 <= P2
R1 R2 R3 R4
P1 P2
S A(7)=0 A=A+1
0 1 2 3 4
B=X A=A+B A=A
A=Y
A(7)=1
5 6 C=A+B
B=B+1
where src1 2 fR1; R2; R3; R4; R5; R7g and OP = fadd; sub; incl; AND; XORg.
Exercise 14.7 A state diagram for the control subsystem is shown in Figure 14.7.
(a) execution of the computation for X = 00101110 and Y = 11100010.
state A B C
0/1 xxxxxxxx xxxxxxxx xxxxxxxx
2 11100010 00101110 xxxxxxxx
5 00010000 00101110 xxxxxxxx
6 00010000 00101111 xxxxxxxx
0 00010000 00101111 00111111
Observe that the value of A(7) tested in state 2, corresponds to the present value of the variable
A (1110010), not the value that is going to be valid when the machine leaves state 2 (00010000).
(b) The data section that is required by the system is shown in Figure 14.8.
(c) The state diagram that describes the control behavior and the control signals activation is
shown in Figure 14.9. For convenience, we replace the s input by start.
The implementation of the control circuit using a counter, multiplexer, a decoder, and gates is
shown in Figure 14.10.
298 Solutions Manual - Introduction to Digital Design - May 29, 2001
Y X
8 8
selA 0 1 selB 0 1
ldA ldB
clk Reg A clk Reg B
A(7)
8 8
A B 2
Operator OP
8
ldC
clk Reg C OP={add,incrA,incrB,notA}
8
start’
start A(7)=0
0 1 2 3 4
OP={notA} OP={incrA}
ldA OP={+}
ldA ldA
ldB ldA
A(7)=1
5 6
ldB ldC
OP={incrB} OP={+}
Figure 14.9: State diagram for the control section - Exercise 14.7
The parallel load of the counter is dened as:
8
>
< 0 if S0 or S6
I = > 5 if S2 (14:3)
: 6 if S4
A table that represents these values in a table is:
state code I
S0 000 000
S1 001 - - -
S2 010 101
S3 011 - - -
S4 100 110
S5 101 - - -
S6 110 000
S7 111 - - -
Minimal expressions are obtained with the following Kmaps:
Solutions Manual - Introduction to Digital Design - May 29, 2001 299
S2 S1’ S2’ S1
S1
S2 ldA
S3
S4
S5 ldB
start 0
S6 ldC
1 1
not A(7) 2 S2 {+}
1 3 MUX cnt I2 I1 I0 S6
0 4 ld counter
1 5 CK Q2 Q1 Q0 S3 notA
0 6 S4 incrA
d.c. 7 S5 incrB
decoder
01234567
S0 ..... S7
I2 = s02 s1 + s2s01 = s2 s1
I1 = s2 s01
I0 = s02 s1
The counter enable input is activated according to the expression:
CNT = start:S0 + S1 + S2 A(7)0 + S3 + S5
and
LD = CNT 0
Another implementation of the control system using one FF per state approach is shown in
Figure 14.11.
300 Solutions Manual - Introduction to Digital Design - May 29, 2001
start’
S1
S2 ldA
S3
CK S4
S0
S5 ldB
start S6 ldC
S2 {+}
S6
CK
S1
S3 notA
CK S4 incrA
S2
A(7)’ A(7) S5 incrB
CK CK
S3 S5
CK
S4
CK
S6
Figure 14.11: One- ip- op-per-state implementation of control system - Exercise 14.7
Exercise 14.8 The data section of the system is shown in Figure 14.12.
A state diagram for the control part is shown in Figure 14.13. In this diagram we used the
signal names presented in the data section block diagram.
The implementation of the control section using PLA is based on the following expressions:
ldmax = newmax:delimiter0 + S1
ldmin = newmin:delimiter0 + S1
end = delimiter:S0
ecnt = S0:delimiter0 + S1
nextstate = S0:delimiter = end
where S0 corresponds to state = 0, and S1 corresponds to state = 1. The network for this implemen-
tation of the control section is shown in Figure 14.14. The one-
ip-
op-per-state implementation
is given in Figure 14.15.
Solutions Manual - Introduction to Digital Design - May 29, 2001 301
X
7
127
7
A B A B A B
Comparator Comparator Comparator
A<B A<B A=B
newmax newmin 0
X delimiter 6
Figure 14.13: State Diagram for the Control Section - Exercise 14.8
302 Solutions Manual - Introduction to Digital Design - May 29, 2001
state
D Q
ldmax ldmin ecnt end
Exercise 14.9 The datapath for the system is shown in Figure 14.16.
The state diagram that describes the control section is shown in Figure 14.17. We consider that
the system has a start input that indicates when another calculation must begin.
(a) implementation of the control section using D-type FFs. The states are encoded as:
state y1 y0
S0 00
S1 01
S2 10
From these state codes we determine the binary transition table as follows:
ecnt
delimiter
D Q
S0
CK
end
D Q newmax ldmax
S1
CK
newmin ldmin
delimiter
Figure 14.15: Control section implementation using one--per-state approach - Exercise 14.8
Solutions Manual - Introduction to Digital Design - May 29, 2001 303
C
Reg, MUL
CK
root**2
eps
DIV DIV
C
-1 Reg,
CK
ADD ADD
1.0
ABS
A MUX
A B
B Compare
Reg, A<B
CK serror
ROOT
serror
Input (start/serror)
y1 y0 00 01 11 10
00 00,000 00,000 01,000 01,000
01 10,111 10,111 10,111 10,111
10 10,010 00,010 00,010 10,010
NS(Y1 Y0 ; ABC )
These are minimal expressions for the next state and output signals:
Y1 = y1 serror0 + y0
Y0 = y10 y00 start
A = y0 = C
B = y1 + y0
The gate network for the control section is shown in Figure 14.18.
(b) implementation of the control section using PLA. For this case we use the same expressions
obtained for solution (a). The implementation is presented in Figure 14.19.
304 Solutions Manual - Introduction to Digital Design - May 29, 2001
Y1 Y0 y0 A,C
y1 D Q
D Q
1 start 0
serror y1’ y0’
CK CK
y1 y0 serror start
y0
D Q
Y1 Y0 A,C B CK
y1
D Q
CK
Exercise 14.10
(a) two counters and one shift register. With these components we have a better datapath for
testing the bit value (using the shift register), counting the number of bits already tested in the
input vector and counting the number of ones in the input vector (counters), when compared the
the original data section. The data section of the system is presented in Figure 14.20(a). The
control sequence for the control section is described in VHDL as follows:
PROCESS (clk)
TYPE stateT IS (idle,loadval,count);
VARIABLE state: stateT := idle;
BEGIN
IF (clk'event and clk='1') THEN
CASE state IS
WHEN idle => load <= '0'; shift <= '0';
IF (start='0') THEN state := loadval;
ELSE state := idle;
END IF;
WHEN loadval => load <= '1'; state := count;
Solutions Manual - Introduction to Digital Design - May 29, 2001 305
X
8
load
shift Shift Reg.
clk 0
clear 4
cnt
ld Counter.
clk
4 num_ones
0
clear
cnt
ld Counter.
clk
end
(MSBit)
The implementation of a microprogrammed control circuit is shown in Figure 14.21. Since the
datapath is so especialized, the control circuit becomes very simple. There is no need for two
instruction formats. The instruction format and the sequence of instructions in the microprogram
is as follows:
address shift load cond branch address
0 0 0 01 0
1 0 1 00 {
2 1 0 10 2
3 0 0 00 0
The COND eld (cond) uses the codes: 00 for \no condition", 01 for start = 0, and 10 for
end = 0. It would be better to use a simple sequential circuit to generate the control signals based
on the data part conditions.
(b) Using one counter and a shift register. Dierently from part (a), this design needs the
function provided by the original datapath. The shift register is used the same way as in part (a).
The counter can be used to count the number of ones in the input X , or to control the number of
bits already tested. In the rst case, we need to use the ALU to keep track of the number of bits
tested. In the second approach, the ALU is used to test the end condition. We are going to use
the rst solution. The data path for the system is shown in Figure 14.22 together with the state
diagram for the control subsystem.
306 Solutions Manual - Introduction to Digital Design - May 29, 2001
+1
0
Adr Ctr. shift
Mux ROM
Reg. Reg. load
1
0 0
Branch address
start’ 1
Mux
end’ 2
d.c. 3
cond
The approach requires some modications on the instruction format presented in example 14.3
of the text:
need to add one extra condition bit to test the bitval and end values. The conditions are:
start - 00, bitval - 01, end - 10, and unconditional branch - 11.
need to add the two control bits load and shift for the shift register and counter.
The following is the micro-program for the unit:
Adr Mode ALU-op FLD ldRF ldR sel s d r d load shift Note
A B C in out R in
0 0 sub=01 0 0 0 1 - 0 0 - - 0 0 R0 0
1 1 (start,0)=000 1
2 0 add=00 0 0 7 1 - 0 0 - - 1 0 R7 0
3 1 (bitval,0)=010 5
4 0 inc=11 7 0 7 1 - 0 0 - - 0 0
5 0 nop x x x 0 - 0 0 - - 0 1
6 1 (end,0)=100 3
7 0 add=00 7 0 7 1 - 1 0 - - 0 0 Rout R7
8 1 (unconditional,0)=110 1
(c) just one counter. This situation forces the shifting of bits in the ALU. The counter is used
to monitor the number of bits already scanned. The modications on the original program are:
merge instructions at addresses 4 and 2 (remove R3 <= 1)
change instruction at address 8 to test the end signal (coming from the counter)
the instruction format must include a counter increment signal, which is activated in instruc-
tion at address 5.
Exercise 14.11
(a) R0 maxfR0; R1; : : :; R7g, R8 and R9 don't need to be preserved, fR1; R2; : : :; R7g
should be preserved.
Solutions Manual - Introduction to Digital Design - May 29, 2001 307
X
8
load start’
shift Shift Reg.
Data portion CLK bitval=1/ R7=R7+1,
start/ load, test1
of example idle shift
R7=0
14.3 bitval bitval=0/
0 shift
4 end=0
cnt
ld Counter end=1/ Rout=R7 test2
CLK
4
end
(msbit)
(a) data section (b) state diagram for control section behavior
Figure 14.22: Datapath and control sequence for the system Exercise 14.10b
Considering that the values are already in the registers, the control signals S; L1; : : :; and L7
will have a value zero all the time. Since there is no \compare" operation, the comparison between
two values x and y must be made by add/sub operation. When the operation x y is executed,
the carry out bit (cy ) is 0 only for the case y x.
The RTL description of the computation is as follows:
R9 <- R0
R8 <- R0 - R0 -- R8=0
R0 <- R1 - R9
if cy=0 R9 <- R1
R0 <- R2 - R9
if cy=0 R9 <- R2
.
.
.
R0 <- R7 - R9
if cy=0 R9 <- R7
R0 <- R9 + R8 -- R0=R9
If the registers were mapped to an array, we would be able to index each register, and this way
use the FOR ... LOOP structure.
(b) micro-instructions (horizontal/ implicit addressing)
We use a two-format instruction. The condition eld is dened as: 000-add, 001-sub, 010-incl,
011-xor, 100-and. The instruction formats and the instruction sequence is shown in the next table.
Since the values of S and L1 to L7 are always zero, we don't show these signals in the microcode.
Since there is only one condition to be tested, basically, the (cy; 0) eld could be eliminated. We
kept the condition in the instruction to keep the format similar to the one shown in the text.
308 Solutions Manual - Introduction to Digital Design - May 29, 2001
0
ld1 8
cnt1
up 8
0 8
counter AD ADR 8
clk dout
1
clk RAM lda ldb
n-1 ea Reg A eb Reg B
ld2 8 s din
ldad
EN
cnt2
down 8
equal ew
counter Compare 8
clk
A B
upcountone compare
Equals1 A<B
test
control
ROM signals
adr. reg,
branch cond
1
0 sequence
0 0
1 equal
2
3 test
upcountone
The microprogram that implements the operations shown in the state diagram is stored in the
ROM of a microcontroller, and is given in the following table. The explicit instruction format has
both the branch (used when the condition tested is true) and the regular sequence address. The
test conditions are represented by the codes: 00 - no branch, 01 - equal = 1, 10 - test = 1, 11 -
upcountone = 1.
adr. ld1 cnt1 ld2 cnt2 ldad lda ea ldb eb ew s cond branch seq.
0 0 0 1 0 0 0 0 0 0 0 0 00 { 1
1 1 0 0 0 0 0 0 0 0 0 0 00 { 2
2 0 1 0 0 1 1 0 0 0 0 0 00 { 3
3 0 0 0 0 0 0 1 1 0 0 0 10 6 4
4 0 0 0 0 0 0 1 0 0 1 0 00 { 5
5 0 0 0 0 0 0 0 0 1 1 1 00 { 6
6 0 0 0 0 0 0 0 0 0 0 0 01 7 2
7 0 0 0 1 0 0 0 0 0 0 0 11 stop 1
310 Solutions Manual - Introduction to Digital Design - May 29, 2001
/ld2 /ld1
/ldad,cnt1,lda
test’/
test/ea,ldb
upcountone’/cnt2
/ew,ea
/ew,eb,s
equal’/
upcountone equal/
Figure 14.24: State diagram for the control section - Exercise 14.12
X
16
0 0
16 16
0
16 16
0
16 16
Reg Reg Reg Z
1 1 1
n-1 1 0
LD LD LD
shift
clk
w1 w0
w
n-1
Figure 14.25: Data section for the FIFO memory - Exercise 14.13
Wr Full
w D Q Rd
n-1
FF dir=1 -> right shift
clk
Ir shift dir Il
reset
Bidirectional Shift Register
Rd clk
Empty shift Empty
reset
w
0
Wr
Full
wn-1 wn-2 wn-3 w1 w0
Figure 14.26: Control section for the FIFO memory - Exercise 14.13
312 Solutions Manual - Introduction to Digital Design - May 29, 2001
X
16
0 0
16 16
0
16 16
0
16 16
Reg Reg Reg Z
1 1 1
n-1 1 0
LD LD LD
dir
clk
shift
Figure 14.27: Data section for the LIFO memory - Exercise 14.14
The control section must generate the signals shift and dir to control the data section, based
on the LIFO memory control inputs Rd and Wr. It also must generate the status signals for Full
and Empty conditions. The network that implements the control section for the LIFO is shown
in Figure 14.28. Since there is no pointer required to the address the TOP of the stack, a counter
is used to monitor the number of elements in the stack. In order to have n elements in the stack,
a k = dlog2(n)e-bit counter is required. The shift and dir control signals are easily obtained from
the Wrlifo and Rdlifo signals. A clear signal is necessary to reset the counter before the LIFO is
used.
Solutions Manual - Introduction to Digital Design - May 29, 2001 313
clear k=log2(n)
0 n Wrlifo dir
Wr
shift
Rdlifo
A B A B
compare compare Rd
A=B A=B
Full
Empty
Figure 14.28: Control section for the LIFO memory - Exercise 14.14
313
Chapter 15
Exercise 15.1
Addr
Enable
5ns 30ns
Rd 10ns
50ns
Data
Rdy
t=0 t=65ns
Rdy becomes active at time t = 55 ns. The enable signal may become low at time t = 65 ns.
For a sequence of read operations, one read may follow the other keeping enable = 1 and issuing
one Rd pulse for each new access. Addr may change after Rdy = 1, so the timing diagram presented
in Figure 15.2 is possible. The cycle time for this case is 55 ns and the number of memory accesses
per second is given as:
1 18:2 106 memory accesses/sec
55 10 9
Addr
5ns 30ns
Rd
50ns
Data
Rdy
t=0
Exercise 15.2 The format for the three instructions used in this exercise is shown in Figure 15.3.
31 25 20 15 10 0
add Opcode RT RA RB ----
31 25 20 15 0
ldw Opcode RT RA D
31 25 20 15 0
brn Opcode --- --- D
Exercise 15.4 The sequence of branches to branch-on-negative a distance 220 from the present
instruction location is given as:
Address A: brn D
.
.
.
Address A'=A+D+4: br D
.
.
.
Address A''=A'+D+4: br D
.
.
.
After the instruction brn D, the PC value is adjusted to PC := PC + D +4. After the execution
of n branches with the same displacement value D, the PC value is:
PC := A + n(D + 4)
For this exercise it is required that the last PC value be A + 220, thus:
A + n(D + 4) = A + 220
D = 2 n 4n
20
Using the maximum positive value for D (signed integer using 16 bits), which is 215 1, it is
possible to calculate the number of branch instructions as n = 2215 = 25 = 32. As a result:
20
D = 2 32 2 = 32764
20 7
Thus, a set of 32 branch instructions with the same displacement D will result in the movement
of the program counter 220 locations from the address of the rst branch instruction. This solution
does not depend on the location A.
316 Solutions Manual - Introduction to Digital Design - May 29, 2001
Exercise 15.5 Assembly code to add an array of 105 integers stored consecutively starting at
location 1000. The result is stored in location 2000.
-- R0
- pointer to the elements in the array
-- R1
- number of elements already read
-- R2
- accumulator
-- R3
- value to add in each program iteration
xor R0,R0,R0 -- R0=0
adi R1,R0,105 -- R1=105
xor R2,R2,R2 -- R2=0
A: ldw R4,1000(R0) -- load R4 with integer value located at R0+1000
add R2,R2,R4 -- add R4 to accumulator (R2)
adi R0,R0,4 -- adjust pointer to reference next integer
sbi R1,R1,1 -- decrement number of integers to be added
A+16: bnz -20 -- branch to location A if there are more integers
stw R2,1580(R0) -- store accumulator in location 2000
The value of the displacement (D1) for the bnz instruction was obtained using the relation:
A + 16 + 4 + D1 = A, which results in 20. The displacement (D2)for the stw instruction
was calculated using the information that R0 = 105 4 = 420, then to reach location 2000,
D2 = 2000 420 = 1580.
The binary code for this program is:
xor 011000 00000 00000 00000 00000000000
adi 010001 00001 00000 00000 00001101001
xor 011000 00010 00010 00010 00000000000
ldw 100001 00100 00000 00000 01111101000
add 010000 00010 00010 00100 00000000000
adi 010001 00000 00000 00000 00000000100
sbi 010011 00001 00001 00000 00000000001
bnz 110010 00000 00000 11111 11111101100
stw 100011 00010 00000 00000 11000101100
Solutions Manual - Introduction to Digital Design - May 29, 2001 317
Exercise 15.6 Simulation of XMC instructions. Figures 15.4 and 15.5 shows the simulation results
of the instructions given in Exercise 15.2.
/computer/reset
/computer/clk
/computer/memaddr 000000 000004 000008
/computer/memlength
/computer/memrd
/computer/memwr
/computer/memenable
/computer/memrdy
/computer/memdata 00000000 40A74800 84E804B0
/computer/ioaddr XXX
/computer/iolength
/computer/iord
/computer/iowr
/computer/ioenable
/computer/iordy
/computer/iodata XXXXXXXX
/computer/status undef p_reset fetch execute fetch execute
/computer/u3/p2/ng
/computer/u3/p1/gpr/gpr(5) 00000000 000000A5
/computer/u3/p1/gpr/gpr(7) 00000000
/computer/u3/p1/gpr/gpr(8) 00000000 00000017
/computer/u3/p1/gpr/gpr(9) 00000000 000000A5
0 200 400
Entity:computer Architecture:structural Date: Tue Dec 21 18:38:17 PST 1999 Row: 1 Page: 1
For the simulation the clock cycle time was set to 100ns to make it easier to read the memory
data information. Recall that a minimum cycle time of 17.5ns would be possible, based on the
318 Solutions Manual - Introduction to Digital Design - May 29, 2001
/computer/reset
/computer/clk
/computer/memaddr 000008 0004C7 000008 00000C 0003F4 0003F8
/computer/memlength
/computer/memrd
/computer/memwr
/computer/memenable
/computer/memrdy
/computer/memdata 00000000 C40003E8 00000000
/computer/ioaddr XXX
/computer/iolength
/computer/iord
/computer/iowr
/computer/ioenable
/computer/iordy
/computer/iodata XXXXXXXX
/computer/status execute memop fetch execute fetch execute
/computer/u3/p2/ng
/computer/u3/p1/gpr/gpr(5) 000000A5
/computer/u3/p1/gpr/gpr(7) 00000000
/computer/u3/p1/gpr/gpr(8) 00000017
/computer/u3/p1/gpr/gpr(9) 000000A5
600 800 1 us
Entity:computer Architecture:structural Date: Tue Dec 21 18:39:12 PST 1999 Row: 1 Page: 1
calculations done in the text (Example 15.1). The values in registers 8 and 9 were forced to
R(8) = (17)16 and R(9) = (A5)16. After the instruction add R5,R7,R9 is executed, the value in
R(5) becomes a copy of the R(9) (time 350ns). The next instruction: ldw R7,1200(R8), at address
4 access the location R8 + (4B 0)16 = (4C 7)16 to read the value that is stored in R7. The contents
of this memory location is zero, so there is no change in R7.
The instruction at location 8 (brn 1000) should test the condition for negative result (signal ng ),
which is zero, indicating that the last operation on the ALU resulted in a positive value. However,
the branch was taken, showing that there is a mistake in the processor's VHDL description. The
target address for the branch is correct: 03E 8+0008+0004 = 03F 4 (values in hexadecimal), where
the rst value is the displacement in the branch instruction (D), the second is the location of the
brn instruction, and the last value is the automatic increment of the PC value during the fetch
state.
Solutions Manual - Introduction to Digital Design - May 29, 2001 319
Exercise 15.7 The new instruction ldwa automaticaly increments by 4 the index register used to
compute the eective address. Let us dene the instruction assembly as:
ldwa RT; D(RA)
Its execution results in RT (31 downto 0) := Mem(RA + D; 4); and RA := RA + 4.
The modication of the VHDL code given on page 453 of the text adds the following condition
to the Opcode test:
CASE Opcode IS
...
...
WHEN ``ldwa opcode'' => -- ldwa
Phase <= MemOp;
Status <= MemOp;
tMemAddr <= RA_data + D; -- mem. address
GPR(RA_addr) <= RA_data + 4; -- increment index register
WAIT until MemRdy='1';
WHEN ...
...
Exercise 15.8 Figure 15.10 in the text shows a 16MB memory. A 4 times bigger memory is asked
in this Exercise. Assuming that the 4MB modules are available (4 of these modules were used to
design the 16MB memory in the text), 16 of them are required for this memory design, as shown
in Figure 15.6. Each row of modules has 16MB. A row is selected by the two most signicant bits
of the address vector. The two least signicant address bits are used to select one of the bytes that
compose a word. The remaining bits are used to address a byte inside a 4MB module.
Exercise 15.9 PC=1500 for all cases
(a) add R7,R5,R8
instruction is read form the memory and the program counter is incremented by 4. The
instruction value (signal instr) is sent to the control subsystem for decoding.
{ path is set: sin sout=0, ALU PC=1, PC RA=0
after decoding, the signals that control the data subsystem are activated to implement the
requested operation (addition):
{ indicates the source and destination of the operation: AddrA=R5, AddrB=R8, Ad-
drC=R7
{ path control: Mem ALU=0, sin sout=0, PC RA=1, IR RB=1
Rd MRdy
Wr controller
Enable
Adr(25:0) Adr(23:2)
controls 4MB
module
Byte 3 Byte 2 Byte 1 Byte 0
Adr(23:2)
Adr(23:2)
Adr(23:2)
Adr(25:24)
2
8 8 8 8
2
Selector/Distributor
Adr(1:0)
32
data
Exercise 15.10 The signals that are active during the execution (no fetch cycle) of both instruc-
tions are shown in Figure 15.7.
clk
instr branch instruction
SE_ZE sign extension
IR_RB
PC_RA
ALUop addition
WrC
WrCR
WrPC
ALU_PC
ALUdata
(b) br D
Figure 15.7: Timing diagram for signals in data subsystem - Exercise 15.10
322 Solutions Manual - Introduction to Digital Design - May 29, 2001
Exercise 15.11 Based on the VHDL description on page 474 of the text we obtain the state-
transition diagram and one-hot implementation of the control subsystem as shown in Figure 15.8.
The state change from ffetch; execute; memopg states to p reset is not synchronous, for this reason
we are indicating the transition with dashed lines.
reset
reset
reset load/store
P_reset Fetch Execute Memop
others
Memop
reset
Execute
P Q P_reset R Q fetch D R Q R Q
0 D D D
P_reset Fetch Exec. Memop
clk
load/store
Opcode[5:2]=1000
Figure 15.8: Control subsystem for Exercise 15.11 (without the output)
The generation of control signals (control subsystem outputs) is based on the VHDL description
on pages 476 and 477 of the text, and the control signal table Ctrl Table shown on page 475. The
table is implemented in hardware by a ROM. A row of the table, addressed by the opcode value, is
referenced in this exercise as ROMline = ROM (Opcode). Each line is composed of several control
signals, and it is represented as: ROMline[< controlsignal >]. The expressions for the control
signals are:
IR RB = ROMline[IR RB]
WrCR = ROMline[WrCR]:fetch0
WrC = ROMline[WrC ]:(ROMline[Memop]0:execute + memop)
ALUop = (\111000):fetch + ROMline[ALUop]:fetch0
MemRd = fetch + ROMline[WrMem]0:memop footnote 1 ****
MemWr = ROMline[WrMem]:memop
MemEnable = fetch + memop
MemLength = fetch + Opcode(0):memop
IORd = 0
IOWr = 0
IOEnable = 0
IOLength = 0
ALU PC = fetch + execute
sin sout = ROMline[WrMem]:MemRdy0:memop
PC RA = ROMline[WrPC ]0:fetch0
Solutions Manual - Introduction to Digital Design - May 29, 2001 323
WrIR = fetch
WrPC = fetch + ROMline[WrPC ]:condition ****** NOT DONE IN uVHDL
****** Error in page 477 of the text
Mem ALU = ROMline[WrMem]
ZE SE = ROMline[ZE SE ]
AddrA = instr(20 : 16)
AddrB = instr(25 : 21):(RS RB =0 00) + instr(15 : 11):(RS RB =0 10)
AddrC = instr(25 : 21)
where the condition value is computed from the condition signals from the ALU and the value to
be tested, which is specied in the conditional branch opcode.
The network that implements the generation of the control signals is shown in Figure 15.9.
Values of the control signals for the instructions in Exercise 15.2 are shown in the following
table, for each processor state. Recall that the binary code for these instructions are:
add = 01000000101001110100100000000000
ldw = 10000100111010000000010010110000
brn = 11000100000000000000001111101000
Signal add ldw brn
Fetch Exec Fetch Exec Memop Fetch Exec
IR RB - 1 - 0 0 - 0
WrCR 0 1 0 0 0 0 0
WrC 0 1 0 0 1 0 0
ALUop 1110 0001 1110 0001 10001 1110 0001
MemRd 1 0 1 0 1 1 0
MemWr 0 0 0 0 0 0 0
MemEnable 1 0 1 0 1 1 0
MemLength 1 0 1 0 1 1 0
IORd 0 0 0 0 0 0 0
IOWr 0 0 0 0 0 0 0
IOEnable 0 0 0 0 0 0 0
IOLength 0 0 0 0 0 0 0
ALU PC 1 1 1 1 0 1 1
sin sout 0 0 0 0 0 0 0
PC RA 0 1 0 1 1 0 0
WrIR 1 0 1 0 0 1 0
WrPC 1 0 1 0 0 1 condition
Mem ALU - 0 - 0 0 - 0
ZE SE - 0 - 1 1 - 1
AddrA - 00111 - 01000 01000 - 00000
AddrB - 01001 - 00111 00111 - 00000
AddrC - 00101 - 00111 00111 - 00000
1
Both MemRd and MemWr signals should be implemented as pulses, according to the VHDL description. The
solution for this exercise simplies this aspect, making the signals active for a complete clock cycle.
324 Solutions Manual - Introduction to Digital Design - May 29, 2001
memop
Opcode ROMline execute
ROM WrC
6 12 1
Romline[Memop]
1
Romline[WrMem]
1
Romline[RS_RB] IR_RB
1
Romline[IR_RB]
1
Romline[WrC]
1 PC_RA
Romline[WrPC]
1 fetch’
Romline[WrCR]
1
Romline[ZE_SE] WrPC
4 condition
Romline[ALUop]
ZE_SE
fetch
MemEnable
memop
ROMline[ALUop] Memlength
0 opcode(0)
4
ALUop
1110 1
MemRd
fetch MemWr
instr(25:2) 0
5 ALU_PC
AddrB execute
instr(15:11) 1
MemRdy
Sin_Sout
ROMline[RS_RB]
Mem_ALU
Figure 15.9: Network used for control signal generation - Exercise 15.11.
The d.c.'s on the table represent information that is based on the instruction bits, and is valid
only after the fetch state. The condition included in the table (signal WrPC) is given by the test
of the ALU cond signal, based on the conditional branch opcode. For example, for the branch on
zero instruction (brz): condition = 1 if (Opcode = 110011 and Z = 1).
Solutions Manual - Introduction to Digital Design - May 29, 2001 325
Exercise 15.12 Cycle time (based on Example 15.1 in the text)
tR = 2ns
tRF = 4ns
tALU = 4ns
tmux = 0:5ns
tZSE = 0:5ns
tsw = 0:5ns
tctl = 0:5ns
tdec = 3ns
tmem = 10ns
texecute = tR + tctl + tRF + tmux + tALU + tmux + tRF = 2 + 0:5 + 4 + 0:5 + 4 + 0:5 + 4 = 15:5ns
tmemop = tR + tctl + tmem + tsw + tmux + tRF = 2 + 0:5 + 10 + 0:5 + 0:5 + 4 = 17:5ns
Based on these values, the critical path is in the memop state. The clock cycle is 17.5ns, limiting
the clock frequency to 57MHz, same as the system in Example 15.1 in the text.
Exercise 15.13 Modication to XMC architecture to have only two instruction formats with 2
bytes (F1) and 4 bytes (F2).
(a) The format for the instruction groups are:
Group Operation type Number of bits (actual) Format
Unary RT := op(RA) 16 F1
Binary RT := RAopRB 20 F2
RT := RAopSI 32 F2
RT := RAopUI 32 F2
Memory RT := M [RA + D] 32 F2
M [RA + D] := RS 32 F2
I/O RT := IO[PN ] 27 F2
IO[PN ] := RS 27 F2
Branch PC := PC + 4 + D 22 F2
(indirect) PC := RA 11 F1
NOP 6 F1
(b) One possible solution to modify the opcode is to use opcodes with the msbit = 1 for the
2-byte instructions and opcodes with the msbit = 0 for the 4-byte instructions. The opcodes used
for the load/store/I/O operations and unary/nop/branchindirect operations could be exchanged,
such that their opcode values would be:
load=store = 00xxxx; I=O = 00xxx; unary=nop=branchindirect = 10xxxx
326 Solutions Manual - Introduction to Digital Design - May 29, 2001
The instruction format would be detected testing the most signicant bit of the opcode.
(c) With two instruction formats there is a problem with instruction alignment. The memory
is byte addressed but the processor reads words (4 bytes). Thus, an instruction may start in the
middle of a word and go over the next word. This problem is dicult to solve and to simplify the
solution of this exercise lets consider that instructions in the F2 format are always aligned. Thus,
it is the responsibility of the compiler to insert NOP instructions when necessary to create groups
with an even number of F1 format instructions, this way aligning instructions in the F2 format. It
is also the case that the processor does not need to read an instruction from memory every fetch
cycle, it may be available in a word already read from memory in the previous cycle. The processor
doesn't read another instruction word from the memory when the present instruction is in the F1
format and its address has bit 1 is 0 (that means, the half-word instruction is aligned with the word
address).
The modication in the IR register part is shown in 15.10. The 16-shift register enables the
data section to send to the control section the rst or second half word in the instruction register.
from memory
WrIR clk
32-bit register
reset
32 16-shift register
ls half word 16 0
ms half 16
16
word
0 1 0 1
Mux Mux
selhalfword
32
to control section
DataB
DataA from extender
module
Mux3
to Mux1 ALUdata
2 4
2 0 1 2 3
sel24D Mux5
Adder
selPC
Mux4
WrPC
clk
Reset PC
ALU_PC
Exercise 15.14 If it is not possible to read the register le (RF) during the execution state, the
delay computed in Example 15.1 of the text would be slightly modied. Instruction decoding and
RF reading couldn't be done in parallel (as presented in Example 15.1), and the RF read will need
to wait for the decoding phase to nish. Thus, the delay for the exec state would be:
texec = tR + maxftctl ; tdec g + tRF + tmux + tALU + tmux + tRF
texec = 2 + 3 + 4 + 0:5 + 6 + 0:5 + 4 = 20:5ns
The computation of tmemop doesn't change. The execution time gets worse for this situation,
when compared to the case analyzed in Example 15.1. Again exec is the critical state. It imposes
a minimum clock cycle time of 20.5ns, and a maximum clock frequency of 48.7MHz.
Exercise 15.15 Introduce a register at the ALU output. To avoid an increase in the number of
cycles for the PC update also, we introduce the register in the path between the ALU and mux1,
after the PC input. This way, the PC value continues to be updated in one clock cycle. Now there
are two execute states:
execute1: terminates when the ALU output (result) is ready.
328 Solutions Manual - Introduction to Digital Design - May 29, 2001
execute2: the result generated by the ALU is stored back into the register le.
(a) cycle time:
texec1 = tR + tctl + tRF + tmux + tALU = 2 + 0:5 + 4 + 0:5 + 6 = 13ns
texec2 = tR + tmux + tRF = 2 + 0:5 + 4 = 6:5ns
The time to execute a memory operation and perform an instruction fetch are still the same
and are given at Example 15.1 as: tfetch = 11:5ns and tmemop = 15ns. The memory operation will
limit the minimum clock cycle time to 15 ns.
(b)
Number of cycles per instruction type
Instruction cycles
Unary (one operand - register) 3
Binary (two operands - registers) 3
Memory 3
I/O 3
Branch 2
NOP 2
(c) Following the same calculation done in Example 15.1, the execution time for register and
memory operations is 3 15 = 45ns. There was an improvement in the memory operations, but
the register operations was degraded. The average execution time is 45 ns, which is worse than the
case shown in Example 15.1.
Exercise 15.16: Spliting the memory operation cycle.
(a) Insert a register after the switch, before mux1, isolating the access delay to the register le.
The new memory cycles are:
tmemop1 = tR + tctl + tmem + tsw = 2 + 0:5 + 8 + 0:5 = 11ns
tmemop2 = tR + tmux + tRF = 2 + 0:5 + 4 = 6:5ns
For this modication, the minimum clock cycle is given by the exec1 cycle time (13 ns, computed
in Exercise 15.15).
(b)
Number of cycles per instruction type
Instruction cycles
Unary (one operand - register) 3
Binary (two operands - registers) 3
Memory 4/3
I/O 4/3
Branch 2
NOP 2
where the two number x/y represent the number of cycles for reading data into a register (x) and
number of cycles for writing data to the memory (y).
Solutions Manual - Introduction to Digital Design - May 29, 2001 329
(c) Execution time: Following the same calculation done in Example 15.1, the execution time
for register and memory write operations is 3 13 = 39ns, and for memory read operations is
4 13 = 52ns. There was an improvement in the register and memory write operations compared
to Exercise 15.15. However, memory read operations present a worse execution time. Keeping
the same proportion of memory and register operations in a given program mix, the same used
in Example 15.1, and also considering that half of the memory operations are read operations, we
obtain the average instruction execution time of:
0:9 39 + 0:1 52 = 40:3ns
Thus, the average instruction execution for this alternative is worse than the one presented in
Example 15.1, and better than the alternative analyzed in Exercise 15.15.
Exercise 15.17 Using instruction and data caches. The access time to caches depends on the
availability of the requested data. For this exercise, we are assuming that the data being accessed
is in the cache. The time to read an instruction from the instruction cache is: tim = 6ns, and the
time to read data from the data cache is: tdm = 8ns. Since only the time to fetch an instruction is
aected (the access time for data continues the same as tmem ), we get:
tfetch = tR + tctl + tmux + tim + tsw = 2 + 0:5 + 0:5 + 6 + 0:5 = 9:5ns
Thus, although the alternative reduces the instruction fetch time, it is not going to improve
the clock cycle time, since the clock period is determined by the memop state time (provided in
Example 15.1 and Exercise 15.15) and the execution state time (evaluated in Exercise 15.16).