Question: This is a high level, C programming language for loop that is accessing all the 1 0 0 elements of an integer array named A:

This is a high level, C programming language for loop that is accessing all the 100 elements of an integer array named A:
for(i =0; i <100; i++){
sum+=A[i];
}
This is a low level MIPS assembly language program that works similarly to the for loop that is accessing all the 100 elements of the integer array named A:
and $t0, $t0, $zero
addi $t1, $zero, 100
LOOP: lw $t3,0($s0)
add $t4, $t0, $t3
addi $s0, $s0,4
addi $t0, $t0,1
bne $t1, $t0, LOOP
Given these facts, please answer the following questions.
a) Which register is being used to store the equivalent of the for loop's i variable? (4 points)
b) List the assembly language instruction or instructions that correspond to the high level language part of the for loop that states
i <100;
(5 points)
c) List the assembly language instruction or instructions that correspond to the high level language part of the for loop that states
i++
(3 points)
d) Assume the register $s0 contains the base address of the array A. List the assembly language instructions that correspond to the high level language statement
sum+=A[i];
(5 points)

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!