The first argument in the array sum function below is a pointer to an array of integers
Fantastic news! We've Found the answer you've been seeking!
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 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?
Posted Date: