Question: The following MIPS code snippet implements a simple loop. Analyze the code and answer the questions below: li $t 0 , 0 loop: beq $t
The following MIPS code snippet implements a simple loop. Analyze the code
and answer the questions below:
li $t
loop: beq $t $s end
addi $t $t
sll $t $t
add $t $s $t
lw $t$t
addi $t $t
sw $t$t
j loop
end:
a Assuming $s holds the value how many times will the loop iterate?
b Describe in words what this code does. What is the purpose of the sll
instruction?
c If $s contains the base address of an array named data, in Python, Java or
CC please write the equivalent of the code inside the loop from addi
$t $t to j loop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
