ENGR 325 HOMEWORK #2 KEY
. (5) For the following C statement, what is the corresponding MIPS assembly code? Assume that the variables f, g, and h are given and could be considered 32-bit integers as declared in a C program. Use a minimal number of MIPS instructions. (P&H 2.1, §2.2) f = g + (h – 5); SOLUTION: Since f, g, and h are declared registers, the corresponding assembly code is: addi f, h, -5 # f = h - 5 add f, f, g # f = f + g 2. (5) For the following MIPS assembly instructions, what is a corresponding C statement? i is a variable as described in problem 1. (P&H 2.2, §2.2) add f, g, h add f, i, f SOLUTION: f = g + h + i 3. (5) The table below shows 32-bit values of an array stored in memory. (P&H 2.6, §2.2, 2.3)
Geschreven voor
- Instelling
-
Calvin College
- Vak
-
ENGR 325
Documentinformatie
- Geüpload op
- 2 juli 2022
- Aantal pagina's
- 6
- Geschreven in
- 2021/2022
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
Ook beschikbaar in voordeelbundel