Assume the following two MIPS codes are given to you. Answer the following quest
ID: 3782798 • Letter: A
Question
Assume the following two MIPS codes are given to you. Answer the following questions based on the assumptions that values of 10, 20, 30, and 40 are assigned to registers $s0, $s1, $s2, $s3, and $s4 respectively. Assume that the base address of the array B is in registers $s6 and has the value of 256.
Assume the following two MIPS codes are given to you. Answer the following questions based on the assumptions that values of 10, 20, 30, and 40 are assigned to registers $s0, $s1, $s2, $s3, and $s4 respectively. Assume that the base address of the array Bis in registers $s6 and has the value of 256. Code 1: Code 2: add $s0, $s0, $s1. addi $s6, $s6, 20 add $s0, $s3, $s2 add $s6, $s6, $s1 add $s0, $s1, $s3 lw $s0, 8 ($s6) You're also given the following memory allocation with saved values: 10 35 12 43 18 256 a. For the given MIPS instructions above, what are the corresponding C codes? b. For each code given above, find the value saved in register so at the end of execution. c. Comment on the performance of the compiler based on the corresponding MIPS code output. Should you continue to use the same compiler for your other programs? Or should you look for another one? Why? Explain your answer in detail.Explanation / Answer
a) For the given MIPS instructions above,the corresponding C codes:
CODE 1: CODE 2:
S0+=S1; S6+=-20;
S0=S3+S2; S6+=S1;
S0=S1+S3; S0 = *( (S6) + 8 )
b)The result of S0 at the end of execution:
CODE1: CODE2:
C.The performane of the compiler based on the corresponding MIPS code output is that it has high speed and performance.Plus,MIPS provides a wide range of instruction sets and with the technique technique to avoid interlocking stages.Due to which it can be used for other programs also we can use where the data hazards are more likely to happen.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.