EECS 370 Exam 2 26 Oct 2001
|
Instructors: |
Scott Mahlke or Gary Tyson |
Name: |
|
|
UID: |
|||
|
Honor Code: I have neither given nor received aid on this exam. |
uniqname: |
||
|
Signature: |
|||
There are 15 multiple-choice questions, each of equal value. Each question has one correct answer. You should mark your answers on the optical grade forms provided. This is a closed book, closed notes examination. You may use a calculator for arithmetic (but not note storage, etc.). Dont forget to copy your answers so you can compare to the key that will be posted on the website after the exam.
1. The Pentium Pro and Pentium 4 processors can best be described as:
2. In the pipeline design for the LC2k1 described in lecture, which value is not needed in the Ex/MEM pipeline register?
3. In which of the following ways was the multi-cycle LC2K1 datapath modified to obtain the pipelined LC2K1 datapath discussed in lecture?
4. Among the following pipelines, whose performance suffers the most from poor branch prediction?
5. Assume clock rate = 200MHz and three instructions with the following multi-cycle execution times:
lw 8 cycles
add 3 cycles
beq 4 cycles
If an application is run on this processor which executes 4200 instructions with the following distribution of opcodes: 20% lw, 50% add, 30% beq.
What is the CPI rounded to the nearest integer (i.e. 1.5 rounds up to 2, 1.49 rounds down to 1)?
6. What is the maximum number of active stack frames for the function shown below when making the initial call ( combination(8, 4) )? Note the first frame is created by combination(8,4) itself.
int combination(int n, int r) {
if (r==0 || n==r) {
return(1);
} else {
return(combination(n-1,r) + combination(n-1,r-1));
}
}
7. What is wrong with the following definition of a state for Project 2?
beq1: printState(&state, "beq1");
state.pc++;
bus = state.reg[(state.instrReg >> 16) & 0x7];
state.aluResult = state.aluOperand - bus;
if (state.aluResult == 0)
goto beq2;
else
goto fetch1;
8. Suppose program A running multi-cycle processor X achieves a CPI of 4.8. In program A, the only thing you know is that 20% of the instructions are branches. Suppose we a change to the processor implementation that reduces the execution time of taken branches from 4 to 3 cycles. What is the best achievable CPI for program A with this change?
9. For the following code executed on the 5-stage pipeline used in lecture, what value is written to the ALU result in the EX/Mem pipeline register at the end of time = 6? (Assume that the first add is written to the IF/ID pipeline register at the end of time = 1, and each register has the value 5 at the start of the code).
add 1 2 3
sw 4 5 15
add 1 4 2
lw 6 6 20
nand 3 4 5
10. What modification must be made to the pipeline datapath discussed in lecture to support the LC2K1 JALR instruction?
11. In the LC2K1 pipeline implementation with data forwarding support, which pipeline register(s) contain value(s) that will be forwarded at time=5 for the following LC2K1 code? (note: the add instruction is written to the IF/ID pipeline register at time=1)
add 1 2 3
nand 3 2 2
beq 2 3 25
halt
12. Which of the following exceptions might be identified on a MIPS-like processor because we change control hazard management from detect and stall to speculate and squash? Note: we are not asking whether the exception is taken, just identified.
13. What does Amdahl's law say?
14. How many hazards exist in the following LC2K1 code (make no assumptions about branch prediction or squashing i.e. assume that branches may be predicted as taken or not taken, and the predictor may be right or wrong)?
add 1 2 2
beq 2 4 3
lw 2 3 10
sw 3 2 6
beq 1 1 -5
halt
15. How many clock cycles will be saved when executing the code shown in question 14 if we use detect and forward instead of detect and stall for handling data hazards? Assume that registers 1 through 4 contain values (1,0,2,3) and that branch hazard management uses speculate and squash and that all branches are predicted not taken.