Write the equivalent MIPS assembly code for the C-code shown above.
You should assume the following:
- The number of scores, N, to be analysed is 50.
- The address of the first element in the marks array is contained in $s0.
Additionally, to make it easier for you to keep track of register assignments, you may use register names that have the same name as the variable names used in the code above. For example, to initialize the register that holds the A counter, you might write:
add $A, $0, $0
If you do choose to use actual MIPS register names, you should write your code out as follows i.e. with appropriate comments:
add $t0, $0, $0 # $t0 maps to variable A; we need to initialize it to 0
Problem 2: (50%)
This problem consists of two questions Q1 and Q2 which consider the basic MIPS 5-stage pipeline (F, D, EX, M, WB). You should assume that there is full forwarding.
Q2 Show how the instructions below proceed through the pipeline and indicate many stall cycles occur. You should assume the beq instruction is taken. Use the following chart.