Question: Project Description: In this project, you are asked to write MIPS code to sort a set of input floating-point numbers in an ascending order. You
Project Description:
In this project, you are asked to write MIPS code to sort a set of input floating-point numbers in an ascending order. You can implement any sorting algorithm you select (or invent) only if it produces correct results. You may refer to Project 4 for reading and printing floating-point numbers. However, for this project, you need to write all the code from the beginning to the end, including the .data and .text segments. In particular, you need to allocate data space to store the input sequence of floating-point numbers and sort them. Same as in Project 4, input number 0.0 indicates the end of the input numbers and it is not counted as an input number. A sample result: -------------------------------------------- Input a Float-Point #:(0 indicates the end) 1.0 Input a Float-Point #:(0 indicates the end) -1.0 Input a Float-Point #:(0 indicates the end) 2.0 Input a Float-Point #:(0 indicates the end) -2.0 Input a Float-Point #:(0 indicates the end) 3.0 Input a Float-Point #:(0 indicates the end) -3.0 Input a Float-Point #:(0 indicates the end) 0 Sorting Result -3.0, -2.0, -1.0, 1.0, 2.0, 3.0 -- program is finished running -- --------------------------------------------- For project submission, please submit your code in the name of project5.asm and make sure it can be compiled and executed in Mars.
It would be appreciated some help in creating the MIPS code.
Consult the green sheet and the chapter 3 for assembly instructions for floating point numbers. Here is one instruction that you might use:
c.lt.s $f2, $f4 bc1t Label1
Here if the value in the register $f2 is less than the value in $f4, it jumps to the Label1. If it should jump when the value in the register $f2 is NOT less than the value in $f4, then it should be:
c.lt.s $f2, $f4 bc1f Label1
To load a single precision floating point number (instead of lw for an integer), you might use:
l.s $f12, 0($t0)
To store a single precision floating point number (instead of sw for an integer), you might use:
s.s $f12, 0($t0)
The following shows the syscall numbers needed for this assignment.
System Call System Call System Call Number Operation Description
2 print_float $v0 = 2, $f12 = float number to be printed 4 print_string $v0 = 4, $a0 = address of beginning of ASCIIZ string 6 read_float $v0 = 6; user types a float number at keyboard; value is store in $f0 8 read_string $v0 = 8; user types string at keybd; addr of beginning of string is store in $a0; len in $a1
For refrence here is my program
http://p.shrib.co/7zzC3eV1U0GiMVGkPYQXnwzc5WhqwocAzgcHrU15
just needs to save input to array and then printout array after the sorting while keeping the exit loop input to be 0.
Thank you for the help!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
