Translate the functions main and max into MIPS assembly lang…
Translate the functions main and max into MIPS assembly language. If you need to use registers $t0 through $t9, use the lower-numbered registers first. [6 points] for main and [6 points] for max. Assume the function definition for a leaf function max is int max(int a, int b) { if (a>b) return a; else return b; } The code for the function main is as follows:int main() { int p=5; int q = 23; int result = max(p,q) ; } main: j End max: ret: jr $ra End: All the parameters use registers $a0 through $a3, and the result should be returned using $v0. The variables p and q are represented by $a0 and $a1. The variable result is represented by $s2. [You need to move the values of 5 and 23 into $a0 and $a1 .] Also, before using any s ($s0 – $s7) registers from the procedure max (in case you plan to use) make sure to push the content of the registers to the stack and pop the content once you are done using the register i.e. just before calling jr $ra from the max procedure. The best way to avoid using a stack is to use any t-registers in the procedure max and s-registers inside the main. If required, you may add more labels to the program max.
Read DetailsFor all the questions, try to explain the intermediate steps…
For all the questions, try to explain the intermediate steps. Providing the answer alone will only earn you 1 point for the question. Also, even if you do not get the final answer right, showing me the steps will help you to get partial credits, which is more than 1 point. Please use the units properly, such as picoseconds and nanoseconds, as applicable, when answering to receive full credit. For all pipeline questions, consider a 5-stage MIPS pipeline with IF-ID-EX-M-WB, unless otherwise explicitly stated in the questions. Also, please take your time answering the questions; do not rush and read them carefully.
Read Details