Question: Exercise 2.2 The following problems deal with translating from C to MIPS. Assume that the variables g, h, i, and j are given and could

Exercise 2.2 The following problems deal with translating from C to MIPS. Assume that the variables g, h, i, and j are given and could be considered 32-bit integers as declared in a C program.

a. f = f + f + i;

b. f = g + (j + 2);
2.2.1 [5] <2.2> For the C statements above, what is the corresponding MIPS assembly code? Use a minimal number of MIPS assembly instructions.
2.2.2 [5] <2.2> For the C statements above, how many MIPS assembly instructions are needed to perform the C statement?
2.2.3 [5] <2.2> If the variables

f, g, h, and i have values 1, 2, 3, and 4, respectively, what is the end value of f?
The following problems deal with translating from MIPS to C. For the following exercise, assume that the variables g, h, i, and j are given and could be considered 32-bit integers as declared in a C program.

a. add

f, f, h

b. sub

f, $0, f addi

f, f, 1 2.2.4 [5] <2.2> For the MIPS statements above, what is a corresponding C statement?
2.2.5 [5] <2.2> If the variables

f, g, h, and i have values 1, 2, 3, and 4, respectively, what is the end value of f?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Computer Organization And Design Questions!