Sei sulla pagina 1di 21

# 1

## FINAL EXAMINATION FALL 2008 (December2008)

STUDENT NAME McGILL I.D. NUMBER

Time: 2:00 pm

INSTRUCTIONS:

## SEE NEXT PAGE.

McGILL UNIVERSITY
Electrical and Computer Engineering Department ECSE-323 Fall 2008

FINAL EXAM

Final Exam

Fall 2008

Question 1 :Boolean Logic Theory (15 points) The following function, F(A,B,C,D), is given by its k-map representation. K-MAP OF FUNCTION F(A,B,C,D) AB CD 00 01 11 10 00 1 1 1 0 01 1 0 0 0 11 1 1 1 0 10 0 0 1 0 There are two minimal sum-of-products forms of F. (5 points) a) Give the two minimal sum-of-products forms of F, showing the answer on the given k-maps. (5 points) b) Using the Quine-McCluskey method, determine the set of prime implicants of F. (5 points) c) Using the covering table method and the corresponding Petrick function, find the two minimal sum-of-products forms of F. ____________________________________________________________________________

## ANSWER FIRST MINIMAL FORM OF F

AB CD 00 01 11 10 00 1 1 1 0 01 1 0 1 0 11 1 0 1 1 10 0 0 0 0

## SECOND MINIMAL FORM OF F

AB CD 00 01 11 10 00 1 1 1 0 01 1 0 1 0 11 1 0 1 1 10 0 0 0 0

## F min = ABC + A C D + BCD + A B C

F min = ACD + A B D + A BD + B C D

b) ID 0 1 4 3 12 7 14 15

A BCD 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 1 1 1

First and only reduction Prime implicant GROUP A B C D P1 (0,1) 0 0 0 P2 (0,4) 0 - 0 0 P3 (1,3) 0 0 - 1 P4 (4,12) - 1 0 0 P5 (3,7) 0 - 1 1 P6 (12,14) 1 1 - 0 P7 (7,15) - 1 1 1 P8 (14,15) 1 1 1 -

Final Exam

Fall 2008

The prime implicants of F are Prime implicants A B C D 0 0 0 - ABC 0 - 0 0 ACD 0 0 - 1 AB D - 1 0 0 BCD 0 - 1 1 A C D 1 1 - 0 A BD - 1 1 1 BCD 1 1 1 ABC

P1 P2 P3 P4 P5 P6 P7 P8 c)

## COVERING TABLE Minterms 3 4 7 12 14 15

Prime implicant P1 P2 P3 P4 P5 P6 P7 P8

## GROUP (0,1) (0,4) (1,3) (4,12) (3,7) (12,14) (7,15) (14,15)

A BCD 0 1 0 0 0 - 0 - 0 0 0 0 - 1 - 1 0 0 0 - 1 1 1 1 - 0 - 1 1 1 1 1 1 -

Petrick function : P = (P1 + P2) (P1 + P3) (P3 + P5) (P2 + P4)(P5 + P7) (P4 + P6) (P6 + P8)(P7 + P8) P = (P1 + P2P3)(P5 + P3P7)(P4 + P2P6)(P8 +P6P7) P = P1P5P4P8 + P2P3P6P7 The two minimal sum-of-products forms are F min = ABC + A C D + BCD + A B C

Final Exam

Fall 2008

F min = ACD + A B D + A BD + B C D

Final Exam

Fall 2008

Question 2 : CMOS Technology (10 points) Using only Transmission Gates (TGs) and one inverter draw the circuit of a 1-bit decoder. A 1-bit decoder is a logic circuit that has one input, I, and two outputs, A, B. Each output assumes the value 1 for each one of the binary values of the input. Thus, for each value of the input, there is only one output equal to 1, and the other output equals to 0. The truth table of the 1-bit decoder is shown below
INPUT I 0 1 OUTPUTS A B 1 0 0 1

Marking scheme: 5 points for a correct solution. 5 extra points for a solution containing ________________________________________________________________________ ANSWER For each value of I, either 0 or 1 should be passed onto the output variables A and B according to the truth table of the 1-bit decoder and in such a way that both outputs are always assigned. In other words, none of the ouputs should be left flowting. The resulting circuit is shown below

ECSE-323-Digital Systems Design Your name: ANSWER KEY Question 3: VHDL (20 points)

Final Exam

Fall 2008

(10 points) a) Write the Architecture body (only) for a description of the following Boolean function: f = AB + CxorD + CD. Use only component statements and assume that all required components have already been defined (i.e. you only have to do the component instantiations).

## Continue Question 3b on the next page.

Final Exam

Fall 2008

Question 3 : VHDL (20 points) (Continued) (10 points) b) Write a complete VHDL description of a 4-bit counter circuit that counts in increments of X-Y, where X and Y are two 4-bit inputs, and wraps around to zero when the count would otherwise be greater than X. No incrementing should be done if X < Y. For example, if X=7 and Y=5 the count sequence should be {0,2,4,6,0,2}. The circuit should have an asynchronous RESET input as well as a synchronous COUNT_ENABLE input.

Final Exam

Fall 2008

O AB B A

DONOR AB B

k-map of function F

Final Exam

Fall 2008 10

## Question 4 : Combinational Circuit Synthesis (15 points)(continued) b)

c) F = xy +w z + x y z + y wz = f1 + f2, where f1 (x, y,z) = xy + x y z f2 (w,y,z ) =w z +y wz xyz 000 001 010 011 10 0 10 1 110 111 f1 1 1 0 0 0 0 0 1 wyz 000 001 010 011 10 0 10 1 110 111 f2 0 1 0 1 1 0 0 0 a f1 f2 000 001 010 011 10 0 10 1 110 111 F 0 1 1 1 X X X X

Final Exam

Fall 2008 11

Question 5 : Testing of Combinational Circuits (15 points) Given the following circuit
A B !A C B C i j F

## (5 points) (5 points) (5 points)

Find a test vector that detects the fault k stuck-at-0. Find a test vector that detects the fault k stuck-at-1. Is the circuit fully testable for all the single stuck-at fault? If not, then explain why and modify the circuit to be completely testable without changing the function.. ______________________________________________________________________________ ANSWER a) b) k/0 k/0 A B C F F F F A B C F Fk/1 F Fk/1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 1 0 0 0 0 0 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 0 1 0 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 No vector exists to test k s-at-0 Test vectors for k s-at-1 are {000,010,100,101}

a) b) c)

c) The circuit is not fully testable because k is not testable for s-at-0 fault. The term BC is redundant. One possibility of a modified fully testable circuit is F = B(A+C) + A B. Another one is F = A B +A C.

Final Exam

Fall 2008 12

Question 6: Sequential circuits (15 points) Given a D-type flip-flop, convert it into a JK-type flip-flop. Proceed as follows (5 points) a) Draw the corresponding Mealy-type state transition diagrams for the D-type and JK-type flip-flops. (5 points) b) Derive the input D of the D-type flip-flop in terms of the inputs J and K. (5 points) c) Draw the circuit realization, using AND, OR NOT gates, of the JK-type flipflop using the given D-type flipflop. _____________________________________________________________________________ ANSWER a) b)
1/1 1/1 0/0 A 0/0 B

## 11/1 10/1 00/0 01/0 10/1 00/1

Q 0 0 1 1

Q+ 0 1 0 1

J 0 1 X X

K X X 1 0

D 0 1 0 1

A 01/0 11/0

c) JK Q 0 1 00 0 1 01 0 0 11 1 0 10 1 1

D = Q J + K Q

Final Exam

Fall 2008 13

Question 7: Register and Counter Design (15 points) Using the programmable counter shown in the figure below, produce the circuit of a multiplesequence counter that counts in different sequences depending on the values of the control signals x, y. The counter counts according to the following table: Control signals x y 0 0 0 1 1 0 1 1 Counting Mode Reset counter Counter modulo 12 Counter modulo 10 Not used

(8 points) a) Draw the complete circuit using 4 x 1 multiplexers and gates as needed (7 points) b) Is your counter self-starting? If not, add whatever is needed to make it self-starting. Explain your result. Hint: A modulo-N counter is a counter that follows N different states, and not necessarily following the ascendeing or descending order of the natural sequence. _____________________________________________________________________________ a) For the counter modulo-12 and modulo-10 we use the RCO signal to activate the LOAD reseting the counter to the corresponding initial state of its counting sequence, namely, 4 in the case of modulo-12 and 6 in the case of modulo-10 counter.

b) The counter is self starting because what ever the initial state, when RCO is reached, the counter will follow the selected counting mode.

Final Exam

Fall 2008 14

Question 8: Circuit Implementation Strategies/Logic arrays (15 points) Given the function F(A,B,C,D) = m(0,2,3,7,9,10,11,14), if (A,D) = AD + A D, (5 points) a) Find F1 such that F (A,B,C,D) = F1[ (A,D) ,B,C] (5 points) b) Program the given PAL schematic to produce F. (5 points) c) Draw a gate logic circuit (using NAND, EXOR, NOT gates) that will produce the function F. ___________________________________________________________________ a) AB CD 00 01 11 10 00 1 0 0 0 01 0 0 0 1 11 1 1 0 1 10 1 0 1 1 F(A,B,C,D) = B C + ABD +A C D + A CD + AB D The Shannon expansion with respect to B, C produces the following expression F(A,B,C,D) = BC [ AD + A D] + B C[ 1 ] + BC[ 0 ] + B C[A D + AD ] F(A,B,C,D) = BC [ (A,D)] + B C + B C [ (A,D)] F(A,B,C,D) = C +B , where (A,D) = AD + A D.

Final Exam

Fall 2008 15

## Question 8: Circuit Implementation Strategies/Logic arrays (Continued) b) A B C X X X X X X D X X F

c)

Final Exam

Fall 2008 16

Question 9: Finite State Machine Design (15 points) Design a Mealy-type finite state machine that has one input X and one output Z. The output Z = 1 if and only if 4 consecutive 1s have been received at input X, and Z = 0 otherwise. a) Give the state transition diagram of this machine using a minimum number of states.(Four states are sufficient) (5 points) b) Give the state transition table of the FSM . (5 points) c) Give the minimal two-level NAND-NAND implementation of the FSM using D-type edge-trigger flip-flops. ____________________________________________________________________ ANSWER a) (5 points)

Z = X y1 y2

Final Exam

Fall 2008 17

## Question 9: Finite State Machine Design (Continued)

D Q > !Q

Y1 Z

D Q > !Q

Y2

Final Exam

Fall 2008 18

Question 10 : Design of Sequential Systems(20 points) Design a datapath/controller system that computes the following continued fraction approximation of log(1+z): x log(1 + x) = x 1+ x 2+ 3+ x Let x be the input to the system, and let y be the output of the system (which should be equal to the approximation to log(1+x)). Let the presence of a new input value be signalled by the rising edge of an external input signal START. Set a signal called DONE to high when the computation is finished. Assume that only one datapath module of each type is available (e.g. one divider, one adder, etc). Provide an asynchronous reset. a) (8 points) Draw the datapath. b) (4 points) List all of the controller inputs and outputs. c) (8 points) Draw the state transition diagram for the controller (use a Moore machine approach). _____________________________________________________________________________

Final Exam

Fall 2008 19

Final Exam

Fall 2008 20

## Question 11: Optimization of Finite State Machines (15 points)

Simplify the following state table Present state 1 2 3 4 5 6 7 (8 points) Next state X=0 X=1 5 3 3 1 2 7 7 1 6 2 5 4 4 7 Outputs Z1 Z2 0 0 0 0 0 0 0 0 1 0 0 0 0 0

a) Give the result obtained at each step of the application of the partition method to the given state table. (7 points) b) Give the minimal state table. ________________________________________________________________________ ANSWER a) Initial sate group: (1 2 3 4 5 6 7) 1st partition: different outputs : (1 2 3 6 7) (5) 2nd partition: (1) (2 3 4 6 7)(5) 3rd partition: (1)(2 3 4 7) (5) (6) 4th partition: (1) (2,4) (3,7) (5) (6) 5th and final partition is equal to 4th partition, therefore the result is (1) (2,4) (3,7) (5) (6). b) Replacing (1) for A, (2,4) for B, (3,7) for C, (5) for D, and (6) for E, we obtain the following minimal state table Present Next state Outputs state X=0 X=1 Z1 Z2 A D C 0 0 B C A 0 0 C B C 0 0 D E B 1 0 E D B 0 0