Question: I am trying to convert the following array from c to mips in qtSpim i am also attempting to print the contents to make sure

I am trying to convert the following array from c to mips in qtSpim i am also attempting to print the contents to make sure i have properly converted the array but every time i try running it i get a memory out of bounds error can someone explain why and provide a solution in detail please?

Array in C

int arr[] = {7, 9, 4, 3, 8, 1, 6, 2, 5};

My mips code

.data

#initialize and fill the area

size: .word 10

array: .word 7, 9, 4, 3, 8, 1, 6, 2, 5

iterator: .word 0

.text

main:

la $t0, array

lw $t1,iterator

lw $t2, size

begin_loop:

bgt $t1, $t2, exit_loop

sll $t3, $t1, 2

addu $t3, $t3, $t0

li $v0,4

lw $a0, 0($t3)

syscall

addi $t1, $t1, 1

j begin_loop

exit_loop:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!