----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.1 [5] For...

1 answer below »
Complete the following problems and shor work.



----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.1 [5] For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables f, g, h, and i are given and could be considered 32-bit integers as declared in a C program. Use a minimal number of MIPS assembly instructions. f = g + (h − 5); 2.2 [5] For the following MIPS assembly instructions above, what is a corresponding C statement? add f, g, h add f, i, f 2.3 [5] For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables f, g, h, i, and j are assigned to registers $s0, $s1, $s2, $s3, and $s4, respectively. Assume that the base address of the arrays A and B are in registers $s6 and $s7, respectively. B[8] = A[i − j]; 2.13 Assume that $s0 holds the value 128ten. 2.13.1 [5] For the instruction add $t0, $s0, $s1, what is the range(s) of values for $s1 that would result in overflow? 2.13.2 [5] For the instruction sub $t0, $s0, $s1, what is the range(s) of values for $s1 that would result in overflow? 2.13.3 [5] For the instruction sub $t0, $s1, $s0, what is the range(s) of values for $s1 that would result in overflow?
Answered Same DayAug 03, 2021

Answer To: ----------------------------------------------------------------------------------------------------...

Arun Shankar answered on Aug 03 2021
132 Votes
Computer Architecture Answers chapter 2
2.1
lw $t2, 4 ($s1)
lw $t3, 8 ($s1)
addi $t3, $t3, -5
a
dd $t1, $t2, $t3
sw $t1, 0 ($s1)
The value of f is now available in register s1.
2.2
The first instruction sets f to the sum of g and h, so f = g + h. Then, the second instructions
sets f = f + i, so in total the effect is that of the following C statement...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here