Question: Problem 7 (30 marks) Use the following code fragment: Loop: LW R1,0 (R2) ADDI R1,R1,1 SW R1, 0 (R2) ADDI R2,R2,4 SUB R4,R3,R2 BNEZ R4,

 Problem 7 (30 marks) Use the following code fragment: Loop: LW

R1,0 (R2) ADDI R1,R1,1 SW R1, 0 (R2) ADDI R2,R2,4 SUB R4,R3,R2

Problem 7 (30 marks) Use the following code fragment: Loop: LW R1,0 (R2) ADDI R1,R1,1 SW R1, 0 (R2) ADDI R2,R2,4 SUB R4,R3,R2 BNEZ R4, Loop ;load R1 from address 0+R2 R1-R1+1 store R1 at address 0+R2 R2-R2+4 R4-R3-R2 ,branch to Loop if R4 ! Assume that the initial value of R3 is R2 396. Further assume that the branch addresses are calculated during the ID phase and branch prediction is handled as designated in the tables 2.1 of the appendix. a. Data hazards are caused by data dependences in the code. List all of the data dependences in the code above. Record the register, source instruction, and destination instruction; for example, there is a data dependency for register R1 from the LW to the ADDI b. Show the timing of this instruction sequence for the 5-stage RISC pipeline without any forwarding or bypassing hardware but assuming that a register read and a write in the same clock cycle "forwards" through the register file. 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? c. Show the timing of this instruction sequence for the 5-stage RISC pipeline with full forwarding and bypassing hardware. 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? d. Show the timing of this instruction sequence for the 5-stage RISC pipeline with full forwarding and bypassing hardware. Assume that the branch is handled by predicting it as taken. If all memory references take 1 cycle, how many cycles does this loop take to execute? e. Assume a 10-stage pipeline in which every stage of the 5-stage pipeline has been split in two. The only catch is that, for data forwarding, data are forwarded from the end of a pair of stages to the beginning of the two stages where they are needed. For example, data are forwarded from the output of the second execute stage to the input of the first execute stage, still causing a 1-cycle delay. Show the timing of this instruction sequence for the 10-stage RISC pipeline with full fowdin ndbypassing hardviare Assumes that the branch is handled by predicting it as taken. If all memory references take 1 cycle, how many cycles does this loop take to execute? Go to Settings to activate Wi Problem 7 (30 marks) Use the following code fragment: Loop: LW R1,0 (R2) ADDI R1,R1,1 SW R1, 0 (R2) ADDI R2,R2,4 SUB R4,R3,R2 BNEZ R4, Loop ;load R1 from address 0+R2 R1-R1+1 store R1 at address 0+R2 R2-R2+4 R4-R3-R2 ,branch to Loop if R4 ! Assume that the initial value of R3 is R2 396. Further assume that the branch addresses are calculated during the ID phase and branch prediction is handled as designated in the tables 2.1 of the appendix. a. Data hazards are caused by data dependences in the code. List all of the data dependences in the code above. Record the register, source instruction, and destination instruction; for example, there is a data dependency for register R1 from the LW to the ADDI b. Show the timing of this instruction sequence for the 5-stage RISC pipeline without any forwarding or bypassing hardware but assuming that a register read and a write in the same clock cycle "forwards" through the register file. 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? c. Show the timing of this instruction sequence for the 5-stage RISC pipeline with full forwarding and bypassing hardware. 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? d. Show the timing of this instruction sequence for the 5-stage RISC pipeline with full forwarding and bypassing hardware. Assume that the branch is handled by predicting it as taken. If all memory references take 1 cycle, how many cycles does this loop take to execute? e. Assume a 10-stage pipeline in which every stage of the 5-stage pipeline has been split in two. The only catch is that, for data forwarding, data are forwarded from the end of a pair of stages to the beginning of the two stages where they are needed. For example, data are forwarded from the output of the second execute stage to the input of the first execute stage, still causing a 1-cycle delay. Show the timing of this instruction sequence for the 10-stage RISC pipeline with full fowdin ndbypassing hardviare Assumes that the branch is handled by predicting it as taken. If all memory references take 1 cycle, how many cycles does this loop take to execute? Go to Settings to activate Wi

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!