Question: Description: Create a bubblesort implementation in MIPS assembly language in the MARS MIPS emulator that will sort an array of ints into ascending order. In
Description: Create a bubblesort implementation in MIPS assembly language in the MARS MIPS emulator that will sort an array of ints into ascending order. In this code, the swap step of the bubblesort algorithm must be implemented as a procedure call, where you implement the swap as a MIPS subroutine.
Print out the contents of the a array before doing the sort, then do the sort, then print out the contents of the a array after the sort. The source array for sorting is hard-coded as is the problem size, which is set to n=10.
Show:
Screen Shots of Program Working in MIPS MARS PROGRAM (i.e. registers, output of Array before and after sorting) Please
The contents of the Array before sorting: ie: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
The contents of the Array after sorting: ie: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
.data arr: .word 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 # this is the source data array n: .word 10 # hard-coded problem size n=10 msg: .asciiz "The problem size is : "
.text .globl main main:
# print a string li $v0, 4 # opcode to print a string to the console la $a0, msg syscall # print the value of the $t0 register li $v0, 1 # opcode to print an int to the console lw $a0, n syscall # EOF
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
