The coursework consists of one program with three questions to answer: Q1, Q2 and Q3. You should compile your answers to Q1, Q2 and Q3 and related discussion in a document to submit to Canvas. Please add a front page to the document showing your name, student number, module title and code, and assignment title.
The C program shown in the Appendix will add the coursework array marks to the exam array marks and store them in the results array. Assume the number of students is 10. The program will then increase the marks in the results array if half of the students fail. Note that CURVE is a function called by the main program. Finally, the program will create counters for the number of students with a result >= 70, >=60, >=50 and < 50.
Q1 Use the MIPS instruction set and the MARS MIPS simulator to:
Write the equivalent MIPS assembly code for the C-code shown above. Remember to add comments to your assembly code.
Test the assembly code program via the MARS MIPS simulator.
Show the assembly code and all test results of running the assembly code in the report.
Q2 Consider the basic MIPS 5-stage pipeline. Assume that there is full forwarding and branch not taken.
Show the pipeline execution table of your code from Q1.
Based on the pipeline execution table, does your solution in Q1 have any pipelining hazards?
If yes, then list these hazards and show how these hazard(s) can be resolved by rewriting the code you produced in Q1. You should test the rewritten code and provide the new code and the results in the report.
If your code from Q1 does not have any pipeline hazards, discuss why this is the case and how did you resolve the pipeline hazards issues in Q1.
Q3 Performance measurement.
How many instructions will be executed for your code in Q1 without optimisation?
Optimise using inline expansions and loop unrolling to use a minimum number of instructions in to run your assembly code and explain the methods done.
How many instructions will be executed for your code with optimisation conducted?
Appendix