Question
The goal of the problem is to increase the execution speed of the code below by eliminating as many stalls and useless operations (nops in
The goal of the problem is to increase the execution speed of the code below by eliminating as many stalls and useless operations (nops in the branch delay slots) as possible. The code runs on a 5- stage pipelined MIPS CPU with forwarding with the characteristics discussed in lecture. (10 points) Note: the branch delay slot is not hidden, i.e. nops in the code below are always executed regardless of the branch decision. i. Indicate stalls in the code below with arrows right after the instruction where the stall occurs. The following is not necessarily correct and only used as an example. (2 points)
ii. How many cycles does it take to execute the entire code sequence below, including stalls and nops? (2 points)
N1 = cycles iii. Assuming all stalls and nops can be eliminated, by how many cycles does the execution time decrease? (2 points) N2 = cycles
iv. Rewrite the code below, eliminating as many stalls and nops as possible. The improved code must store the same results to memory, but register values may differ between the two versions when exit is reached. (4 points) Loop: sltiu $t0, $s0, 100 beq $t0, $0, exit nop lw $t0, 0($s1) addiu $t0, $t0, 1 lw $t1, 0($s2) addu $t0, $t0, $t1 sw $t0, 0($s2) addiu $s0, $s0, 1 addiu $s1, $s1, 4 addiu $s2, $s2, 4 beq $0, $0, loop nop exit:
stall addiu $s0, $s0, 1 addiu Ss1, $s1,4 addiu $s2,$s2,4Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started