Write a MIPS program to complete the following functions. You must write comment
ID: 3565605 • Letter: W
Question
Write a MIPS program to complete the following functions. You must write comments and follow the register convention.
(1) Declare an integer array of 20 elements and other variables and labels;
(2) Write a procedure to initialize the array. Use random numbers between 0 and 99, and use
a loop to initialize the array
(3) Implement a sort procedure.
(4) Write the main program. It calls the initialization procedure; prints the numbers in the array; calls the sort procedure to sort the numbers in the array; and print the numbers in the sorted array.
Based on the syscalls in MARS simulator, you can use the following code to generate random
numbers between 0 and 99.
li $a1,100 # define the upper range
li $v0, 42 # 42 is the syscall
code for random integer generation
syscall # the generated random number will be placed in $a0
Explanation / Answer
#random number geneator
#use this in word
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.