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
Step: 1
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 ...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