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
Step: 1
Get Instant Access to Expert-Tailored Solutions
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