Implement a MIPS assembly program that processes two integer arrays of size 20:
ID: 3776413 • Letter: I
Question
Implement a MIPS assembly program that processes two integer arrays of size 20: Raw and Fresh. The Raw array is initialized with the values {2, 17, 28, 20, 6, 51, 20, 48, 12, 54, 3, 31, 15, 22, 46, 72, 41, 39, 30, 55}. The values for Fresh array will be read in (note: add proper prompt for reading data.) All elements of Fresh will be stored in memory. The program will output (i.e. display) the sum of two largest integers and the sum of two smallest integers of Raw and store the sum of two largest integers and the sum of two smallest integers of Fresh in memory locations right after where the last element of Fresh is stored. Test the program once and enter the Fresh array's data of your choice. Write an efficient algorithm to perform the following tasks: Create an array A of size 20, where all the array elements are initialized to 4. For every element in the array, if its index i is even, perform A[i] = A[i] - i; If its index i is odd, perform A[i] = A[i] + 2 * i. Swap the elements A[i] and A[19 - i], such that, i.e. A[0] with A[19], A[1] with A[18], A[2] with A[17], ... Print out the resulting array. Count how many cycles needed to execute your program and write it down in readme.txtExplanation / Answer
2 Algorithm :
step 1 : start
step 2 : for i=0 to 19
a[i]=4
step 3 : for i=0 to 19
if i%2=0
a[i]=a[i]-i
else
a[i]=a[i]+2*i
step 4 : for i=0 to 19
a[i]=a[19-i]
print a[i]
step 5 : stop
e) no of cycles needed to execute complete program :
step 2 need 20 cycle
step 3 need 20 cycle
step 4 need 20 cycle
total = 20+20+20 = 60
***************END***********PLD GIVE ME GOOD RATING**************************************
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.