Question
Complete the corresponding assembly language fragments by selecting the correct instruction, register, or value: (Choices in bold) Consider the following fragment of C code: while
Complete the corresponding assembly language fragments by selecting the correct instruction, register, or value: (Choices in bold)
Consider the following fragment of C code:
while (A[ i ] == 0){
A[ i ] = A[ i ] + 10; i += 1;
}
Assume that variable i is assigned to $s0 and the base address for array A is in $s1. A is an array of words. Registers $t0 and $t1 are used for storing results temporarily.
Loop: sll $t0, $s0, (0 / 1 / 2 / 4 / 10)
add $t0, $t0, $s1
lw $t1, 0($s0 / $s1 / $t0 / $st1 / $zero)
bne $t1, $zero, (Loop / Exit)
addi $t1, ($s0 / $s1/ $t0 / $t1 / $zero) , 10
sw $t1, 0($t0)
addi ($s0 / $s1 / $t0 / $t1 / $zero) , $s0, 1 j Loop Exit:
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