


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Date assigned: February 1 4, 2008 Due date: February 26, 2008 (11:59 pm) Due date for UF EDGE: March 4, 2008 (11:59 pm) Total Points: 100 pts (Important: if the exercise is from case studies of textbook, please read the case study description carefully before solving problem) Appendix A Exercise 1 (20pts) Identify all possible hazards in the following instructions and show clearly which instructions are involved in what type of hazard (data-WAW, data-WAR, data-RAW and control) and why? Consider a simple 5-stage MIPS pipeline as shown in Figure A.18 for this exercise. ADDI R8, R0, # ADDI R6, R0, # SW R6, 800(R0) ADDI R7, R0, # SW R6, 800(R7) ADDI R10, R0, # ADDI R3, R10, #- LW R1, 800(R3) ADDI R4, R10, #- LW R2, 800(R4) ADD R5, R1, R SW R5, 800(R10) ADDI R10, R10, # BEQ R10, R8, # J # NOP BREAK Exercise 2 (20pts) Following is a simple pipeline; with a bypass from the output of the MEM stage (i.e., the MEM/WB latch) to the EX stage. (Note: There is no bypass from the EX stage, i.e., the EX/MEM latch, back to the EX stage.) Assume that the register file is written in the first half and read in the second half of the clock cycle. Hence, a register value can be written and read in the same cycle.
(a)What’s the purpose of bypassing? (b)For the following instruction sequence, show the pipeline stages in the table. Part of the stages for the first instruction is shown. ADD R1, R2, R3 // add ADD R4, R1, R5 // add LD R5, 0(R4) // lw LD R6, 0(R5] // lw SUB R7, R5, R6 // sub SW R7, 0(R4) // sw Cycle IF ID EXE MEM WB 1 add 2 add2 add 3 4 5 6 7 8 9 10 11 12 13 14 (c)Suggest technique(s) to eliminate the bubbles in part (b). Which bubbles would your proposed technique(s) eliminate?
Iter. Instruction Issue Execute Memory Write-CDB Commit 1 L.D F0, 0(R1) 1 DIV.D F4, F2, F 1 S.D F4, 0(R1) 1 LW R5, 0(R4) 1 ADD R5, R5, R 1 ST R5, 0(R4) 1 SUBI R4, R4, # 1 ADDI R1, R1, # 1 BNE R1, R2, LOOP 2 L.D F0, 0(R1) 2 DIV.D F4, F2, F 2 S.D F4, 0(R1) 2 LW R5, 0(R4) 2 ADD R5, R5, R 2 ST R5, 0(R4) 2 SUBI R4, R4, # 2 ADDI R1, R1, # 2 BNE R1, R2, LOOP Exercise 4 (20pts) Draw the state transition diagram of a 2-bit predictor that can perfectly predict the following sequence of outcomes of a particular branch: untaken, taken, taken, untaken, taken, taken, untaken, taken, taken, ….. (repeat). Note that the initial state can be anyone of the four states. In the worst case, you are allowed to have at most one wrong prediction for the first outcome in the given sequence.