Question: [ 5 ] < 2 . 2 , 2 . 3 > Translate the following C code to MIPS. Assume that the variables f ,
Translate the following C code to MIPS. Assume that the variables f g h i and j are assigned to registers $s $s $s $sand $s respectively. Assume that the base address of the arrays A and B are in registers $s and $s respectively. Assume that the elements of the arrays A and B are byte words:
B Ai Aj:The code and interpretation on the website are as follows. However, if the array elements are eight bytes in size, shouldn't the shift left instruction be like this: sll $t $s I believe the here should be replaced with because shifting left by three positions is equivalent to multiplying by eight.# Perform shift logical left operation for register s by # Place the result in register t
sll $t $s
# Perform addition operation t with s
# Place the result in register t
add $t $t $s
#Perform load word function in the register t
# With the location
lw $t$t
# Perform shift logical left operation for register s by # Place the result in register t
sll $t $s
# Perform addition operation t with s
# Place the result in register t
add $t $t $s
#Perform load word function in the register t
# With the location
lw $t$t
# Perform addition operation t with s
# Place the result in register t
add $t$t$t
# Perform store word function with the register s and t
sw $t$s
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
