Final April 25, 2015  Name ____________________________________  Student ID __________________


1. Below is a state machine code and the corresponding state diagram 1. Modify the code to implement a state machine corresponding to the state diagram 2. Write your modified code to the right of the original code: #ifdef VARIANT_1 #include "fsm_code_2.v" #endif #ifdef VARIANT_2 #include "fsm_code_3.v" #endif #ifdef VARIANT_3 #include "fsm_code_4.v" #endif #ifdef VARIANT_4 #include "fsm_code_5.v" #endif #ifdef VARIANT_5 #include "fsm_code_6.v" #endif #ifdef VARIANT_6 #include "fsm_code_7.v" #endif #ifdef VARIANT_7 #include "fsm_code_6.v" #endif
State diagram 1: #ifdef VARIANT_1 #endif #ifdef VARIANT_2 #endif #ifdef VARIANT_3 #endif #ifdef VARIANT_4 #endif #ifdef VARIANT_5 #endif #ifdef VARIANT_6 #endif #ifdef VARIANT_7 #endif
State diagram 2: #ifdef VARIANT_1 #endif #ifdef VARIANT_2 #endif #ifdef VARIANT_3 #endif #ifdef VARIANT_4 #endif #ifdef VARIANT_5 #endif #ifdef VARIANT_6 #endif #ifdef VARIANT_7 #endif
The code below contains three modules implementing the same functionality, calculating the power of five of a given number. Analyze the code and answer the following questions: #ifdef VARIANT_1 #include "pow_5_rtl_comb_pipe_seq.v" #endif #ifdef VARIANT_2 #include "pow_5_rtl_comb_seq_pipe.v" #endif #ifdef VARIANT_3 #include "pow_5_rtl_pipe_comb_seq.v" #endif #ifdef VARIANT_4 #include "pow_5_rtl_pipe_seq_comb.v" #endif #ifdef VARIANT_5 #include "pow_5_rtl_seq_comb_pipe.v" #endif #ifdef VARIANT_6 #include "pow_5_rtl_seq_pipe_comb.v" #endif #ifdef VARIANT_7 #include "pow_5_rtl_seq_pipe_comb.v" #endif
2. Which implementation is purely combinational? a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3 d) pow_5_implementation_1 and pow_5_implementation_2 e) pow_5_implementation_1 and pow_5_implementation_3 f) pow_5_implementation_2 and pow_5_implementation_3 g) all of them h) none of them
3. Which implementation is sequential? a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3 d) pow_5_implementation_1 and pow_5_implementation_2 e) pow_5_implementation_1 and pow_5_implementation_3 f) pow_5_implementation_2 and pow_5_implementation_3 g) all of them h) none of them
4. Which implementation is pipelined? a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3 d) pow_5_implementation_1 and pow_5_implementation_2 e) pow_5_implementation_1 and pow_5_implementation_3 f) pow_5_implementation_2 and pow_5_implementation_3 g) all of them h) none of them
5. Identify the implementation that corresponds to the following schematics: a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3 d) pow_5_implementation_1 and pow_5_implementation_2 e) pow_5_implementation_1 and pow_5_implementation_3 f) pow_5_implementation_2 and pow_5_implementation_3 g) all of them h) none of them #if defined (VARIANT_1) || defined (VARIANT_3) || defined (VARIANT_5) #elif defined (VARIANT_2) || defined (VARIANT_4) || defined (VARIANT_6) #else #endif
6. Identify the implementation that corresponds to the following schematics: a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3 d) pow_5_implementation_1 and pow_5_implementation_2 e) pow_5_implementation_1 and pow_5_implementation_3 f) pow_5_implementation_2 and pow_5_implementation_3 g) all of them h) none of them #if defined (VARIANT_1) || defined (VARIANT_3) || defined (VARIANT_5) #elif defined (VARIANT_2) || defined (VARIANT_4) || defined (VARIANT_6) #else #endif
7. Identify the implementation that corresponds to the following schematics: a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3 d) pow_5_implementation_1 and pow_5_implementation_2 e) pow_5_implementation_1 and pow_5_implementation_3 f) pow_5_implementation_2 and pow_5_implementation_3 g) all of them h) none of them #if defined (VARIANT_1) || defined (VARIANT_3) || defined (VARIANT_5) #elif defined (VARIANT_2) || defined (VARIANT_4) || defined (VARIANT_6) #else #endif
8. Which implementation is likely to allow the highest maximum frequency (assuming that the outputs of the combinational implementation are connected to clocked register)? a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3
9. Which implementation is likely to use the smallest number of gates? a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3
10. Which implementation is likely to have the highest throughput (number of calculated pow_5(n) results per seconds)? a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3
11. Which implementation is going to have the smallest latency in clock cycles (assuming that the outputs of the combinational implementation are connected to clocked registers)? a) pow_5_implementation_1 b) pow_5_implementation_2 c) pow_5_implementation_3
12. The testbench instantiated all three implementations of pow_5. #ifdef VARIANT_1 #include "pow_5_tb_comb_pipe_seq.v" #endif #ifdef VARIANT_2 #include "pow_5_tb_comb_seq_pipe.v" #endif #ifdef VARIANT_3 #include "pow_5_tb_pipe_comb_seq.v" #endif #ifdef VARIANT_4 #include "pow_5_tb_pipe_seq_comb.v" #endif #ifdef VARIANT_5 #include "pow_5_tb_seq_comb_pipe.v" #endif #ifdef VARIANT_6 #include "pow_5_tb_seq_pipe_comb.v" #endif #ifdef VARIANT_7 #include "pow_5_tb_seq_pipe_comb.v" #endif
An engineer simulated the testbench and got the following waveform. However he forgot the order he added the last three signals to the waveform. Can you determine which signal is the output of combinational implementation, sequential non-pipelined implementation and sequential pipelined implementation? a) The order is (from upper n_pow_5... to lower n_pow_5...): combinational, sequential non-pipelined implementation, pipelined b) combinational, pipelined, sequential non-pipelined implementation c) pipelined, combinational, sequential non-pipelined implementation d) pipelined, sequential non-pipelined implementation, combinational e) sequential non-pipelined implementation, combinational, pipelined f) sequential non-pipelined implementation, pipelined, combinational #if defined (VARIANT_1) #elif defined (VARIANT_2) #elif defined (VARIANT_3) #elif defined (VARIANT_4) #elif defined (VARIANT_5) #elif defined (VARIANT_6) #elif defined (VARIANT_7) #endif #if defined (VARIANT_1) || defined (VARIANT_5) #include "midterm_1_1.html" #elif defined (VARIANT_2) || defined (VARIANT_6) #include "midterm_1_2.html" #elif defined (VARIANT_3) #include "midterm_1_3.html" #elif defined (VARIANT_4) #include "midterm_1_4.html" #else #include "midterm_1_5.html" #endif 16. Write the missing code near red comments #if defined (VARIANT_1) || defined (VARIANT_3) || defined (VARIANT_5) #include "midterm_2_1.html" #elif defined (VARIANT_2) || defined (VARIANT_4) || defined (VARIANT_6) #include "midterm_2_2.html" #else #include "midterm_2_3.html" #endif
Exam is created by Yuri Panchul with some code borrowing from Digital Design and Computer Architecture, Second Edition by David Harris and Sarah Harris, 2012