Answered step by step
Verified Expert Solution
Question
1 Approved Answer
- Using MIPS Assembly Language Assignment: Create a MIPS program that runs in the MARS simulator. The program must bubble sort an array of 30
- Using MIPS Assembly Language
Assignment: Create a MIPS program that runs in the MARS simulator. The program must bubble sort an array of 30 random integers. The array must be allocated ON THE STACK. The program must print the sorted numbers at the end.
Example of how to get a random number and print it:
This example allocates an array of 2 integers on the stack, puts random numbers in it, and prints it out:
- data NEWLINE: , asciiz " n - text - globl main \#required main: \#required addi $sp,$sp,8 \# make space for 2 ints, 8 bytes on the sto li $a0,0 \#set up random number system call. use generator 0 li $al,100#max random number is 100 li \$v0, 42 \# syscall 42 is random number in a range syscall \# random number is now in sad sw $a0,0($sp) \# store the number in array location [0] syscall \# random number is now in sa0 sw \$a0, 4($sp) \# store the number in array location [1] \# NOTE I am making the array atart at a lower address \# and go UP in memory! \#now print out the numbers li $v0,1 \#set up to print int lw $a0,0($sp) \#get the int to print syscall li \$v0, 4 \#set up to print a string la \$a0, NEWLINE \#la is LOAD ADDRESS. newline is declared \#at the start of the program syscall li $v0,1 \#set up to print int lw $a0,4($sp) \#get the int to print syscall li \$v0, 4 \#set up to print a string la $a0, NEWLINE \#la is LOAD ADDRESS. newline is declared \#at the start of the program syscall li \$v0, 10 \# last 2 lines are required to make program exit syscallStep 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