Question: The first argument in the array sum function below is a pointer to an array of integers andthe second argument is the length of the

The first argument in the array sum function below is a pointer to an array of integers andthe second argument is the length of the array. Notice how each instruction is individually labeled for easy identification.

add1: add $v0, $0, $0
beq1: beq $a1, $0, jr1
addi1: addiu $a1, $a1, -1
lw1: lw $t0, 0($a0)
add2: add $v0, $v0, $t0
addi2: addiu $a0, $a0, 4
beq2: beq $0, $0, beq1
jr1: jr $ra

a. How many instructions will be executed when this function is invoked on an array of Nintegers?

b. Assume there is a five stage pipeline with early branch resolution and data forwarding fromW-X, M-X and M-D, indicate how many bubbles and where they will occur.

c. What is the CPI of this function on long arrays as N --> Infinity?

Step by Step Solution

3.52 Rating (166 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a How many instructions will be executed when this function is invoked on an array of N integers N 7 instructions will be executed when this function is invoked on an array of N integers The array sum ... View full answer

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 Accounting Questions!