Homework 5: Sorting out MIPS Assembly Language

The goals of this homework are:

This homework is worth 10 points.

Assignment

Write a program in MIPS assembly language that will Your program should begin by prompting the user for a random seed and a size. Please use the prompting method described below. The seed will be a positive integer and the the size will be a positive integer between 8 and 8,000 inclusive. The size represents the size, in bytes, of the array to generate. You should generate n = size/4 random integers and store them in an array. For example, if the size is 20, n=5 and you should generate 5 random integers.

Your program should seed the random number generator with the given seed. It should then make n calls to the random number generator. These values should be stored in the array in the order they are generated. The random numbers shold be between 0 and 10,000

Once your program has generated the specified number of integers, it should print them out, on a single line, separated by a comma and a space. The last integer should not be followed by a comma or a space, but a newline should be printed. For example if the numbers are 1, 2 and 3 the output should be

1, 2, 3\n

You should then sort the array using whatever sorting algorithm you wish to implement. After the array has been sorted, print values in order using the above format.

While I would normally insist that you use functions to implement this program, however, as we have not yet discussed the function call system you are not required to use functions for this program. If you wish to study the calling convention you may use functions. We will cover this soon.

I will be testing your program with an automated script so it is important that you follow instructions for input and output.

Prompts should be a single line of text that end in a new line.

Please enter the random seed\n
5
Please enter the array size\n
40
Please ask for the random seed first then ask for the array size. You may assume all input is valid.

For validation, an input of 3,40 should produce the folowing output

3734, 3660, 4210, 2581, 9128, 7202, 4549, 6564, 7459, 3961
2581, 3660, 3734, 3961, 4210, 4549, 6564, 7202, 7459, 9128

Submission

Submit your homework by class time on the due date as an attachment to a mail message to your instructor. Submission time will be determined by the time stamp on the email message. No late homework will be accepted.