Question: (8 points) Please complete the following code, which is supposed to be a loop that scans a word array, adds the numbers that have been

(8 points) Please complete the following code, which is supposed to be a loop that scans a word array, adds the numbers that have been scanned, and exits when the summation, to be stored in $t0, is larger than the number in $s2, or until all numbers has been scanned. The starting address of the array is in $s0. The length of the array is in $s1. Only $t0, $t1, and $t2 can be modified in your code.

ori $t0, $0, 0

ori $t1, $0, 0

P2P5L0: sll $t2, $t1, 2

lw $t2, 0($t2)

bgt $t0,

addi $t1, $t1, 1

P2P5L1: nop

Please comment out what each instruction does. Thank you

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!