Question: Given an array of four integers, write a program that populates a new array with the square of the elements in the given array.
Given an array of four integers, write a program that populates a new array with the square of the elements in the given array. Assume $s0 stores the memory location of the first element of the given array, and $s1 stores the memory location of the first element of the new array. Hint: Each memory address is incremented by 4 due to the size of an integer stored in the memory. Ex: If $s0 and $s1 are initialized in the simulator as 4000 and 5000, and the content of the given array is: then the content of the new array is: Addresses Data 4000 4004 4008 4012 5004 5008 1 5012 2 Addresses Data 5000 3 4 1 4 9 16 Note: Use the '+' button under the Registers and Memory display to initialize $s0, $s1, and the four memory locations of the given array. LAB ACTIVITY 7.4.1: Module 3 Lab: Array of squares - Iw/sw Assembly Line 1 # Type your code here. Line 2 # Do not initialize $s0 and $s1 here. Line 3 # Use the button under the Register di Line 4 ENTER SIMULATION More options v Submit for grading Coding trail of your work What is this? STEP RUN Registers Each has value 0 + Memory Each has value 0 + 0/10 Load default template...
Step by Step Solution
There are 3 Steps involved in it
To solve this problem you need to write a MIPS assembly program that reads values from one array squ... View full answer
Get step-by-step solutions from verified subject matter experts
