代写 algorithm math MIPS assembly CSCI 3301 – MIPS Programming Using SPIM

CSCI 3301 – MIPS Programming Using SPIM
Programming Assignment
Due Date: Friday, March 29, 2019, 11:00 PM
Instructions:
• The assignment must be done by you alone.
• Your programming code must be well commented.
• You can include screenshots of your outputs.
• For the two MIPS-programs, you will generate 2 text files, named Facto.s and Sort.s. Put them in a folder named:
FACTO_SORT_ __PA1. Compress the folder and submit the compressed folder.
Total Marks: 100. Part 1 [50 points]:
The factorial function is mathematically defined as:
𝑛
𝑛!=∏ 𝑘 𝑘=1
For example, factorial of 6, that is 6! = 720, which is computer as: 6  5  4  3  2  1.
Write a recursive MIPS assembly program using SPIM simulator (such as QtSpim), where for a given number (n) as an input (taken from the console), the program will recursively compute and return the corresponding factorial number. For retuning the result, use the standard console (screen) and print the output. You program must be able to take positive as well as negative integer numbers as input and must be able to respond appropriately.
Part 2 [50 points]:
Develop a MIPS program, “SORT”, to sort a set of given integers (note: both positive and negative integers are allowed) by the user. Note that, you can use any sorting algorithm you want including the Bumble sort which we covered in the class.
First, your program will ask the user, how many numbers the user wants to enter, and then ask the user to provide those numbers.
Your program will read in those numbers and
will place those numbers in an array.
Sort the array elements in ascending order.
Now, print the set of numbers that the user entered saying, “You have entered: …”. Then, print the sorted list saying, “Here is the sorted list in ascending order: …”.
Page 1