Description
Purpose: Become familiar with the MIPS Instruction Set, and the MIPS functions, MIPS standard calling convention, and indexing for multiple dimension arrays. Points: 80 Assignment: Write a simple assembly language function to simulate the rolling of two dice. The provided main calls the following functions: ● Write a value returning MIPS function, getInput(), that will read a number between between 1 and 100,000. Note, A MIPS function returns its integer result in $v0. ● Write a value returning MIPS function, random(), to generate a random number using a lagged Fibonacci generator1 . ● Write a void MIPS function, throwDice(), to simulate the rolling of two dice n times. Each die can show an integer value from 1 to 6, so the sum of the values would vary from 2 to 12. The results should be stored in a two-dimension array. The first roll represents the row and the second roll represents the column. This function will call the random() function. ● Write a void MIPS function, results(), to calculate sums, percentages, and display the twodimensional matrix showing the results. The numbers should be printed in a twodimensional format (see example output). All numbers in the table must be right justified (i.e., lined up on right side). Print the eleven possible different totals followed by the percent each combination occurred. For the final percentages, the sums should be computed as integers, then converted to float (single precision), divided by the roll count (also converted to single precision), and multiplied by 100.00. Due to the required formatting, this is likely the most difficult function. Array Implementation: In assembly, multi-dimension arrays are implemented as a large single dimension array. The formula for calculating two-dimensional array indexing is: addr(row,col) = baseAddr + (rowIndex * colSize + colIndex) * data_size You must use the formula to access matrix elements. No score will be provided for submissions that do not use this formula. Refer to Chapter 5.6 2.2 for more information. 1 For more information, refer to: http://en.wikipedia.org/wiki/Lagged_Fibonacci_generator Submission: • All source files must assemble and execute with QtSpim/SPIM MIPS simulator. • Submit source file ◦ Submit a copy of the program source file via the on-line submission • Once you submit, the system will score the project and provide feedback. ◦ If you do not get full score, you can (and should) correct and resubmit. ◦ You can re-submit an unlimited number of times before the due date/time. • Late submissions will be accepted for a period of 24 hours after the due date/time for any given lab. Late submissions will be subject to a ~2% reduction in points per an hour late. If you submit 1 minute – 1 hour late -2%, 1-2 hours late -4%, … , 23-24 hours late -50%. This means after 24 hours late submissions will receive an automatic 0. Program Header Block All source files must include your name, section number, assignment, NSHE number, and program description. The required format is as follows: # Name: # NSHE ID: # Section: