Question: Convert the high level language loop to MIPS assembly: while (save[ i] == k) i += 1; i and k are in $s3 and $s5
Convert the high level language loop to MIPS assembly:
while (save[ i] == k)
i += 1;
i and k are in $s3 and $s5 and base of array save[ ] is in $s6.
| A. | Loop: sll $t1, $s3, 2 add $t1, $t1, $s6 lw $t0, 0($t1) bne $t0, $s5, Exit addi $s3, $s3, 1 j Loop Exit: | |
| B. | Loop: sll $t1, $s3, 2 add $t1, $t1, $s6 lw $t0, 4($t1) bne $t0, $s5, Loop addi $s3, $s3, 1 Loop: j Loop Exit:
| |
| C. | Loop: sll $t1, $s3, 1 add $t1, $t1, $s6 lw $t0, 0($t1) bne $t0, $s5, Exit addi $s3, $s3, 1 j Loop Exit: | |
| D. | Loop: sll $t1, $s3, 2 add $t1, $t1, $s6 lw $t0, 0($t1) bne $t0, $s5, Exit addi $s3, $s3, 4 j Loop Exit: |
![Convert the high level language loop to MIPS assembly: while (save[ i]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3e2363ed00_18966f3e235ce547.jpg)
Convert the high level language loop to MIPS assembly: while (save ik) i += 1; i and k are in $s3 and $5 and base of array save ] is in $s6. Loop: sll St1, Ss3, 2 add $t1, $t1, $s6 lw $to, 0($t1) bne $t0, $s5, Exit addi $s3, $s3, 1 j Loop Exit: O B. Loop: sll St1, Ss3, 2 add $t1, $t1, $s6 lw $to, 4($t1) bne $to, $s5, Loop addi $s3, $s3, 1 Loop: j Loop Exit: O C. Loop: sl St1, Ss3, 1 add $t1, $t1, $s6 lw $to, 0($t1) bne $t0, $s5, Exit addi $s3, $s3, 1 j Loop Exit: O D. Loop: sll St1, Ss3. 2 add $t1, $t1, $s6 lw $to, 0($t1) bne $t0, $s5, Exit addi $s3, $s3, 4 j Loop Exit
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
