12
CSE 140 Midterm 2 version A Tajana Simunic Rosing Spring 2015 Name of the person on your left: ________________________________ Name of the person on your right: ________________________________ 1. 9 points 2. 16 points 3. 15 points 4. 20 points 5. 20 points 6. 20 points Total (100 pts.) Do not start the exam until you are told. Write your name and PID at the top of every page. Write the names of people on your left and right on the first page. Turn off and put away all your electronics. This is a closedbook, closednotes. You may only refer to one 8 ½ x 11” page of your handwritten notes. By turning in this exam for grading you are stating that you have followed the UCSD’s academic honesty policies. Do not look at anyone else’s exam or talk to anyone but an exam proctor. If you have a question, raise your hand and an

CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

CSE 140 Midterm 2 version A

Tajana Simunic Rosing

Spring 2015

Name of the person on your left: ________________________________ Name of the person on your right: ________________________________

1. 9 points

2. 16 points

3. 15 points

4. 20 points

5. 20 points

6. 20 points

Total (100 pts.)

Do not start the exam until you are told. Write your name and PID at the top of every

page. Write the names of people on your left and right on the first page.

Turn off and put away all your electronics. This is a closed­book, closed­notes. You may only refer to one 8 ½ x 11” page of your handwritten notes.

By turning in this exam for grading you are stating that you have followed the UCSD’s academic honesty policies. Do not look at anyone else’s exam or talk to anyone but an exam proctor.

If you have a question, raise your hand and an

Page 2: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

exam proctor will come to you. You have 80 minutes to finish the exam.

When the time is finished, you must stop writing.

Write your answers in the space provided. To get the most partial credit, clearly show all the steps of your work. Full credit may not be given for correct answers with no work shown.

Page 3: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

Problem 1 (9pts) Consider the following flip­flop constructed using a D flip flop:

a. Write the next­state equation for the above flip flop Q(t+1) = f(Q(t), X).

Q(t+1) = Q(t) ⊕ X 4pts

b. Plot the output(Q) waveform for the following clock and input sequence. Assume initial state is Q = 0.

Page 4: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

Solution:

5pts

Page 5: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

Problem 2 (16pts) Design an arithmetic unit (AU) which takes in two 4­bit binary number that are already in 2s complement, A (a3a2a1a0 ) and B (b3b2b1b0). For example, A=1101 when A is ­3 in decimal, or A=0011 when A is 3 in decimal. AU’s block diagram and the functional table are given below. M0 is the operation selection input of the AU.

M0 Function Name F(A,B)

0 Decrement A by 2 A ­ 2

1 Add A and 2*B and 1

A + 2*B + 1

Specify your design of the Operation Selection Unit by defining what y3,y2,y1,y0 should be as a function of the inputs A & B and selector M0. Cell entries in the table below should use 0s, 1s or input variable bits : ai ,ai’ ,bi ,bi’ ; (0 ≤ i ≤ 3); e.g. a2.

M0 y3 y2 y1 y0

0

1

Page 6: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

Solution:

M0 y3 y2 y1 y0

0 1 1 1 0

1 b2 b1 b0 1

2 pts per each correct answer in the table

Page 7: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

Problem 3 (15pts) The timing characteristics of the components of the circuit shown in figure below are:

Flip­flop: clock­to­Q maximum delay (propagation delay) 50ps, clock­to­Q minimum delay (contamination delay) 20ps, setup time 25ps, hold time 30ps

Logic gate (each AND, OR, XOR): propagation delay 25ps, contamination delay 15ps. Zero clock skew

a. What is the maximum clock frequency of this circuit?

tpcq + tpd + tsetup < T c 0ps 5 × 25ps 25ps5 + + < T c

5GHzf ≤ 1T c =

1200ps =

• 2pts for the correct formula; • 1pts for correctly substituting tpcq and tsetup into formula; • 2pts for correctly substituting tpd into formula; • 3pts for obtaining the correct final solution.

b. How much clock skew can the circuit tolerate before it experiences a hold time violation?

ttccq + tcd > tskew + hold

0ps 5ps 0ps pstskew < 2 + 1 − 3 = 5 • 2pts for the correct formula; • 1pts for correctly substituting tccq and thold into formula; • 1pts for correctly substituting tcd into formula;

Page 8: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

• 3pts for obtaining the correct final solution. Problem 4 (20pts) Answer the following questions for the FSM shown in the figure.

a. Circle if it is Mealy or Moore Moore machine 1 point b. Fill in the state transition table:

Q1Q0 \ a 0 1

00 01, 1 00,0

01 01, 1 10, 1

10 11,0 11, 0

11 00, 0 00 ,0

8 points (­1 for each element) (Note: the output is not required here. You won’t lose any point if you didn’t write down or you had incorrect output) (Note: if you wrote output instead of the next state, ­6 points) c. Fill in the excitation table

Q1 Q0 a D1 D0 y(current state) y(next state)

0 0 0 0 1 0 1

0 0 1 0 0 0 0

0 1 0 0 1 1 1

0 1 1 1 0 1 1

1 0 0 1 1 1 0

1 0 1 1 1 1 0

1 1 0 0 0 0 0

1 1 1 0 0 0 0

Page 9: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

8 points (­1 for each row) (Note: for the output, conventionally we use the output of the current state, but you won’t lose points if you use the output of the next state) d. Write the Boolean equation for the next state of MSB: D1 = kmap and equation for D1 D1 = Q1*Q0’ + Q1’*Q0*a

Q1 \ Q0 a 00 01 11 10

0 0 0 1 0

1 1 1 0 0

3 points (­1 for each error)

Page 10: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

Problem 5 (20pts) A sequential circuit has two inputs w1 and w2, and an output, z. Its function is to compare the input sequences of the two inputs. If w1=w2 during any four consecutive clock cycles, the circuit produces z=1; otherwise, z=0. For example w1:0110111000110 w2:1110101000111 z:0000100001110 Draw the state diagram using the minimum number of states. Solution X = w1 XOR w2

Grading: For each state: +1 for each correct transition = 2 total per state +2 for each correct output = 2 total per state Total for every state = 4 Max 4*5 = 20 If more than 5 states are used, but the logic is correct: +10 for the entire answer Full credits for any other possible solution using 5 states. NOTE: input labeled as (w1=w2), (w1==w2), (w1 XOR w2), 00,11 and similar also OK NOTE: The solution here uses moore machine. You can also use mealy machine. For mealy machine, only 4 states are enough. If you use 5 states we don’t deduct points.

Page 11: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

Problem 6 (20pts) For the sequential circuit shown in the figure do the following: a. Fill in the excitation table

Q1Q0A Q1(t+1) Q0(t+1) Y

000 0 0 0

001 0 0 0

010 0 1 1

011 0 1 1

100 0 0 1

101 1 0 1

110 0 1 1

111 1 1 1

8 pts b. Write down Boolean equations for next state and output Q0(t+1) = (Q0A + Q0’A’) XOR (Q0A + Q0’A’) XOR Q0 = Q0 (simplified) Q1(t+1) = AQ1 + A’0 = AQ1 + 0 = AQ1 Y = Q0 + Q1 6 pts c. Draw the state diagram representing this FSM

Page 12: CSE 140 Midterm 2 version A Tajana Simunic Rosing · 2015. 5. 26. · Design an arithmetic unit (AU) which takes in two 4bit binary number that are already in 2s complement, A (a

6 (1.5 per state; 0.5 per each transition, 0.5 output)