Suppose $t0 stores the base address of word array, $s0 is associated with position, and $s1 is associated with offset.I have to convert the following program segment into Assembly and write down the...


Suppose $t0 stores the base address of word array, $s0 is associated with position, and $s1 is associated with offset.I have to convert the following program segment into Assembly and write down the resulting array content


array = [0,1,2,3,4,5,6,7,8,9,10,11]
position = 0
offset = 1
while position <>
array[position] = array [position + offset]
position = position + 1;


so far i have written this-


.data


array:

.word 0,1,2,3,4,5,6,7,8,9,10,11
counter: .word 11


lw $t1,counter
la $t0,array
li $s0,0
li $s1,1


loop:


beq $s0,$t1,end
lb $s0,0($t0)
add $s0,$s0,@s1
sw $s0,($s0)
addi $s0,$s0,1
addi $t0,$t0,4

j loop


end:


i dont know how to move forward from here , can anyone help



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here