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
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