Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

3. Would you say that effective teamwork saved their lives?

Answered: 1 week ago