

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!


This assignment is due at the beginning of class on Wednesday, January 21, 2009. Please read the class policies web page regarding homework assignments. The total score for the assignment is 100 points.
lw $1, 45($2) add $7, $1, $ sub $8, $1, $ or $9, $5, $ bnez $7, target add $10, $8, $ xor $2, $3, $
a) (10 points) Identify each dependence by type; list the two instructions involved; identify which instruction is dependent; and, if there is one, name the storage location involved.
b) (5 points) Use information about the MIPS five-stage pipeline (see Appendix A), and assume a register file that writes in the first half of the clock cycle and reads in the second half-cycle, forwarding the write result for immediate use. Which of the dependencies that you found in part (a) become hazards and which do not? Why?
Loop: LD R1, 0(R2) ; R1 Å Mem[R2] DADDI R1, R1, #1 ; R1 Å R1 + 1 SD 0(R2), R1 ; Mem[R2] Å R DADDI R2, R2, #4 ; R2 Å R2 + 4 DSUB R4, R3, R2 ; R4 Å R3 – R
BNEZ R4, Loop ; if R4 != 0 then go back
Assume that the initial value of R3 is R2 + 396 10. Throughout this exercise use the classic RISC 5-stage integer pipeline (see Appendix A, Figure A.1) and assume all memory accesses take 1 clock cycle (caches always hit).
a) (10 points) Show the timing of this instruction sequence for the RISC pipeline without any forwarding or bypassing hardware, but assume that a register read and write in the same clock cycle “forwards” through the register file as in problem 1. Use a pipeline timing chart like Figure A.6. Assume that the branch is handled by flushing the pipeline. If all memory references take 1 cycle, how many cycles does this loop take to execute? b) (10 points) Show the timing of this instruction sequence for the RISC pipeline with normal forwarding and bypassing hardware. Use a pipeline timing chart like Figure A.6. Assume that the branch is handled by predicting it as not taken. If all memory references take 1 cycle, how many cycles does this loop take to execute? c) (10 points) Assume the RISC pipeline with a single-cycle delayed branch and normal forwarding and bypassing hardware. Schedule the instructions in the loop including the branch delay slot. You may re-order instructions and modify the individual instruction operands, but do not make other loop transformations that change the number or opcode of the instructions in the loop. Show a pipeline timing diagram and compute the number of cycles needed to execute the entire loop.
ALUop Rdest, Rsource1, Rsource or ALUop Rdest, Rsource1, Mem
Where ALUop is one of the following: Add, Subtract, And, Or, Load (for Load, Rsource1 is ignored), Store. Rsource and Rdest in this notation are registers. Mem in this notation is a (base register, offset) pair. Branches use a full compare of two registers and are PC-relative. Assume that this machine is pipelined so that a new instruction is started every clock cycle. The pipeline structure, similar to that of the VAX 8700, is
IF RF ALU1 MEM ALU2 WB IF RF ALU1 MEM ALU2 WB IF RF ALU1 MEM ALU2 WB IF RF ALU1 MEM ALU2 WB IF RF ALU1 MEM ALU2 WB IF RF ALU1 MEM ALU2 WB
The first ALU stage (ALU1) is used for effective address calculation for both memory references and branch targets. The second ALU stage is used for operations and branch comparison. RF is both a decode and register fetch stage. Assume that when a register read