Starting from:

$30

MIPS Assignment #3

CS 218 – MIPS Assignment #3
Purpose: Become familiar with the MIPS stack and function calling convention.
Points: 100
Assignment:
Write a MIPS assembly language program to calculate the surface area for
each three dimensional hexagonal prism1
 in a series of hexagonal prisms.
Use the provided MIPS main program and develop the following functions:
● Write a void MIPS function, surfaceAreas(), to calculate the surface
areas for each three dimensional hexagonal prism in a series of
hexagonal prisms. The formula for the hexagon surface area is as
follows:
areas[ i] = 6 × bases[ i] × ( apothems[ i] + heights[i ])
Note, the routine is must call the shellSort() function for the surface
areas array before returning. All data is unsigned.
● Write a MIPS assembly language function, shellSort(), to sort the volumes into ascending order
(small to large). To sort the numbers, use the following Shell Sort2
 algorithm.
h = 1;
while ( (h*3+1) < length ) {
 h = 3 * h + 1;
}
while ( h>0 ) {
 for (i = h-1; i < length; i++) {
 tmp = lst[i];
 j = i;
 for ( j=i; (j >= h) &&
(lst[j-h] > tmp); j = j-h) {
 lst[j] = lst[j-h];
 }
 lst[j] = tmp;
 }
 h = h / 3;
}
You must use the above shell sort algorithm above
(i.e., do not use a different sort). Note, the algorithm
assumes array index’s start at 0. As necessary, you can
define additional variables. Submissions not based on
this algorithm will not be scored.
● Write a value returning MIPS function, findSum(), to find the sum of a passed array.
1 For more information, refer to: https://en.wikipedia.org/wiki/Hexagonal_prism
2 For more information, refer to: http://en.wikipedia.org/wiki/Shell_sort
● Write a void MIPS function, surfaceAreasStats(), that will find the minimum, maximum,
median, and float average of the areas array.
● Write a value returning MIPS function, findAverage(), to find the floating point (double)
average of an array. The function must call the findSum() function and perform the required
type conversions. Floating point functions return their results in $f0.
● Write a void MIPS function, displayStats(), to print the diagonals array (six per line) and the
statistical information (minimum, maximum, median, and float average) in the format shown in
the example.
Example Output:
The program must display the results to the console window. The output should look something like
the following (with all of the correct answers displayed for all data sets):
MIPS Assignment #3
Hexagonal Prism Surface Areas Program
*******************************************************************
Hexagonal Prisms 1
Length: 15
Surface Areas - Values:
 108000 112530 112728 114576 116160 116604
 117000 118818 121158 121158 121500 122472
 125388 126162 127488
Surface Areas - Stats:
 min = 108000
 max = 127488
 med = 118818
 ave = 118782.800000000003
*******************************************************************
Hexagonal Prisms 2
Length: 75
Surface Areas - Values:
 176016 177576 179664 180846 182106 183210
 183210 183918 184224 184800 185136 186048
 . . . output truncated . . .
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 (at a maximum
rate of 5 submissions per hour).
• Late submissions will be accepted for a period of 24 hours after the due date/time for any given
assignment. 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: <your name>
# NSHE ID: <your id>
# Section: <section>
# Assignment: <assignment number>
# Description: <short description of program goes here>
Failure to include your name in this format will result in a reduction of points.
Scoring Rubric
Scoring will include functionality, code quality, and documentation. Below is a summary of the
scoring rubric for this assignment.
Criteria Weight Summary
Assemble - Failure to assemble will result in a score
of 0.
Program Header 3% Must include header block in the
required format (see above).
General Comments 7% Must include an appropriate level of
program documentation.
Program Functionality
(and on-time)
90% Program must meet the functional
requirements as outlined in the
assignment. Must be submitted on time
for full score.

More products