Reference no: EM132457514
BME 7371 - Failure Analysis of Medical Devices Assignment - Wright State University, USA
Assignment brief - The assignment consists of one problem with Q1, Q2 and Q3 to answer. You should compile your answers to Q1, Q2 and Q3 and related results and discussion in a document.
Assessment Problem - The C-code shown below will add the coursework array marks to the exam array marks and store in the results array for one of your modules. The code will also create counters for the number of students with results >= 70, >=60, >=50 and < 50. Assume the number of students is 15.
int A, B, C, F; // declare results counters
int i; // declare loop counter
A=0; B=0; C=0; F=0; // initialize results counters
int coursework []; // coursework is an array to store the coursework marks that goes from 0 to 60.
int exam []; // exam is an array to store the exam marks that goes from 0 to 40.
int results []; // results is an array to store the total marks = coursework + exam. Results goes from 0 to 100.
for (i=0; i<N; i++) {
results [i] = coursework [i] + exam [i]
if(results [i] >= 70)
A = A + 1;
else if (results [i] >=60
B = B + 1;
else if (results [i] >= 50
C = C + 1;
else
F = F + 1;
}
Questions -
Q1. Write the equivalent MIPS assembly code for the C-code shown above. Show the assembly code, test the assembly code program via the MARS MIPS simulator and show test results in the report.
Q2. Consider the basic MIPS 5-stage pipeline (F, D, EX, M, WB). Assume that there is full forwarding and branch not taken. 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?
Q3. How many instructions will be executed for your code in Q2? If the clock cycle rate of the processor is 1GHz, what is the execution time of your code in Q2?
Note - Please only use Mars stimulator and only use $S and $T and just use $s $t registers.