Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 its 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). 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. data theArray: epsce 12 apace an int is bysoso 3 gorsis 2 bys -text 5 fchis fixst bit just puts valuss into rogistors 6 arcer thie ve need to copy them to an array addi sel, seo 3 addi $s2, zero, 5 know wo need to ute aw totoro word) to move values into 4n array set the index addl Sto, S2e, 0 Scoas 10 12 13 14 15 16 17 18 19 20 21 50, theArray(sto addi to, Sto. addi t 9t0. 582, theArray(sto) add to, sto, 4 #2oading data (to print it) lw ,print thaArray($zero) t 6, 23 24 25 26 27 28 syscall done li Svo 10 ayacall1
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 its 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).
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.
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