Question: 5. Consider the following MIPS assembly program with a leaf procedure call. Assume that the $sp is initialized to 7FFFEFFC hex, the text or code

5. Consider the following MIPS assembly program with a leaf procedure call. Assume that the $sp is initialized to 7FFFEFFC hex, the text or code segment starts at the memory address of 400100 hex, and the data segment is located starting at 10010000h for this program. Further, assume that the return address from the main procedure is 400000 hex. data my_global: .word 100 text globl main 00400100 | main: 00400104 $sp, $sp,-4 addi sw ra, ($sp) # main calls a procedure so it should save its own return address on the stack $t1, ($s0) $a0, $t1, 1 leaf $t2, $vO, $0 # assume $sO has the address of my-global variable 00400108 004001OC 00400110 00400114 lw addi al add # call the leaf procedure $ra, ($sp) $sp, $sp, 4 # restore man's own return address from the stack 00400118 0040011c 00400120 lw addi ra 00400124 | leaf: 00400128 addi $v0, $a0, 1 # leaf procedure return value ra b) What are the values of all affected registers (except pc, $sp, and Sra) immediately after each indicated instruction in the below table is executed during the execution of the above MIPS assembly program? As an example if a register such as the St0 is affected (e.g. register value changed) and its new value is 2 in decimal then represent the change using the name of the register and its new value as follows: $t0-2. Use both binary and hexadecimal numbers to represent register contents. Instruction Register-Value Pair Register-Value Pair Register-Value Pair sw Sra, (5sp) lw St1, ($s0) addi Sa0, St1, 1 add $12, Sv0, $O 5. Consider the following MIPS assembly program with a leaf procedure call. Assume that the $sp is initialized to 7FFFEFFC hex, the text or code segment starts at the memory address of 400100 hex, and the data segment is located starting at 10010000h for this program. Further, assume that the return address from the main procedure is 400000 hex. data my_global: .word 100 text globl main 00400100 | main: 00400104 $sp, $sp,-4 addi sw ra, ($sp) # main calls a procedure so it should save its own return address on the stack $t1, ($s0) $a0, $t1, 1 leaf $t2, $vO, $0 # assume $sO has the address of my-global variable 00400108 004001OC 00400110 00400114 lw addi al add # call the leaf procedure $ra, ($sp) $sp, $sp, 4 # restore man's own return address from the stack 00400118 0040011c 00400120 lw addi ra 00400124 | leaf: 00400128 addi $v0, $a0, 1 # leaf procedure return value ra b) What are the values of all affected registers (except pc, $sp, and Sra) immediately after each indicated instruction in the below table is executed during the execution of the above MIPS assembly program? As an example if a register such as the St0 is affected (e.g. register value changed) and its new value is 2 in decimal then represent the change using the name of the register and its new value as follows: $t0-2. Use both binary and hexadecimal numbers to represent register contents. Instruction Register-Value Pair Register-Value Pair Register-Value Pair sw Sra, (5sp) lw St1, ($s0) addi Sa0, St1, 1 add $12, Sv0, $O
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
