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

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!