Question
A program has 11 instructions. The following code adds integers from two arrays and stores the results back to the first array. $s0 is the
A program has 11 instructions. The following code adds integers from two arrays and stores the results back to the first array. $s0 is the starting address of the first array, while $s1 the address of the second array. $s2 is a counter. $s3 determines the number of iterations the loop is expected to run. The initial values: $s2= 0 and $s3=100.
I1: lw $t0, 0($s0)
I2: lw $t1, 0($s1)
I3: addu $t0, $t0, $t1
I4: sw $t0, 0($s0)
I5: addi $s0, $s0, 4
I6: addi $s1, $s1, 4
I7: addi $s2, $s2, 1
I8: bne $s2, $s3, I1
I9: nop
I10: nop
I11: nop
Q3. Scheduling instructions can remove some hazards that cannot be handled by hardware without pipeline stalls. Assume a 5-stage MIPS pipeline implementation: a) With all forwarding paths; b) No IF/ME or ID/WB conflicts; c) Predict branch not taken; d) branch address available after ID stage (i.e. the correct instruction is fetched in the EX stage of the branch instruction). Schedule the instruction in HW05 to reduce pipeline installs.
1) List the updated code.
2) Show the pipeline diagram.1
3) Calculate the total cycles and CPI of the loop. Explain how the number is calculated.
Step 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