Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following (unoptimized) MIPS assembler program: 2 3 4 5 6 6 - 7 BA 8 0 9 10 10 .text .globl main

Consider the following (unoptimized) MIPS assembler program: 2 3 4 5 6 6 - 7 BA 8 0 9 10 10 .text .globl main 

Consider the following (unoptimized) MIPS assembler program: 2 3 4 5 6 6 - 7 BA 8 0 9 10 10 .text .globl main #int procB (int a, int b) # { # # # # # # } int = 0; c = a + b return C; 44 11 procB: 12 addi $sp, $sp, -8 13 SW 3ra, 4($sp) 14 15 add 16 SW 17 1w 18. 1w SW $zero, 0($sp) $t0, $a0, $al $t0, 0($sp) $v0, 0($sp) $ra, 4($sp) $sp, $sp, 12 37 addi 38 jr Sra 39 m 40 #int main() 41 # { 42 # print int (procA (2, 3)); 43 # exit (); 44 # } 45 main: 19 20 21 22 23 24 25 26 26 27 28 29 30 addi $sp, $sp, 8 jr $ra #int procl (int a, int b) # { # # } (a) before procedure procA is called, at the beginning of line 48, PTOCA: addi $sp, $sp, -12 SW Ou SW 46 11 47 li 48 49 50 51 52 53 return a procB (a, b); SW $ra, 8($sp) $al, 4($sp) 3a0, 0(3p) 31 32 jal procB 33 1w $a0, 0(3p) $al, 4($sp) 34 1w 35 1w 36 mul $ra, 8 (3sp) $v0, $a0, $v0 (d) after procedure procB has ended, at the beginning of line 33. jal procA move $a0, $v0 li $v0, 1 $a0, 2 Sal, 3 syscall li syscall (b) after procedure procA has been called, at the beginning of line 29, * Illustrate how the runtime stack changes during the execution of the program by sketching the runtime stack (with stack pointer) and the values stored there at the following times: $v0, 10 (c) after procedure procB has been called, at the beginning of line 15, and Note: "At the beginning of line x" means that the statement in line x has not yet been executed. The program execution begins at label main.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Calculus

Authors: Ron Larson, Bruce H. Edwards

10th Edition

1285057090, 978-1285057095

More Books

Students also viewed these Databases questions

Question

Why do some individuals confess to a crime they did not commit?

Answered: 1 week ago