Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Array Continued: Goal for today: Change the array to 5 elements (you need to change the .space parameter to something > 12) You then need

image text in transcribed

Array Continued:

Goal for today:

Change the array to 5 elements (you need to change the .space parameter to something > 12)

You then need to load up those elements into the array

And then print off all of the elements in the array.

Array hand in:

Code that creates an array of 5 elements, populates it, and then prints off the elements

Arrays Arrays in MIPS could be stored in registers, that severely constraints what the array could do, no more than 32 elements, to the point that using a struct might make more sense in that case. The better option for an array is to declare it in the data' subsection and then it's stored out in main memory. (Because MIPS is a simulator not a native language we are still constrained on array sizes compared to C, but that constraint is on the order of a billion elements). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 data theArray: .space 12 . space an Intis 4 bytes, so 3 integers is 12 bytes .text #this first bit just puts values into registers # after this we need to copy them to an array addi $80, Szero, 1 addi $31, Szero, 3 addi $82, Szero, 5 #now we need to use sw (store word) to move values into an array iset the index 0 addi $t0, $zero, O Store Values sw $80, theArray($t0) addi $t0,$t0, 4 sw $81, theArray($t0) addi $t0,$t0, 4 SW $82, theArray($t0) sw addi $t0,$t0, 4 #loading data (to print it) lw $t6, theArray($zero) #print it li $v0, 1 addi $a0, $t6,0 syscall #done li $v0, 10 syscall 17 18 19 20 21 22 23 24 25 26 27 Here is a simple program to create and print one element of an array of integers)28 PA

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

What Is acidity?

Answered: 1 week ago

Question

Explain the principles of delegation

Answered: 1 week ago

Question

State the importance of motivation

Answered: 1 week ago

Question

Discuss the various steps involved in the process of planning

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago