Consider the following (unoptimized) MIPS assembler program: 2 3 4 5 6 6 - 7 BA...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these databases questions
-
In September 2023, Thomas died. His wife was the beneficiary of his $50,000 life insurance policy. Thomas had paid $20,000 in premiums. His wife elected to collect the proceeds in ten equal...
-
The following additional information is available for the Dr. Ivan and Irene Incisor family from Chapters 1-5. Ivan's grandfather died and left a portfolio of municipal bonds. In 2012, they pay Ivan...
-
(a) Let Find vectors -12 -5] -- -- [18-[1] 1 = = S = -5 to U = A = U = in R such that S is the transition matrix from (v1, v2} to {u, u}- (b) Let P4 be the vectors space of all polynomials of degree...
-
1. Suppose a company produces a product that sells for $55, has a variable cost per unit of $35, and has fixed costs of $100,000. How many units must the company sell to earn a target profit of...
-
Construct a normal probability plot of the wine quality rating data in Exercise 6-27. Does it seem reasonable to assume that this variable is normally distributed?
-
Given the function g(r) = (r- 5)(r + 7)(r - 1) its g-intercept is (5) (-7) (1) its r-intercepts are -5, 7,-1 X Submit Question X Question Help: Video Message instructor
-
Continuing Question 5, turn off the lag filter and use a notch filter to improve the performance. Simultaneously adjust Notch Freq and KVP to maximize KVP without inducing peaking in the closed-loop...
-
Cambridge Manufacturing Inc. uses the job order cost system of accounting. The following information was taken from the company's books after all posting had been completed at the end of May: a....
-
X = 1.2 For I = 1 To 5 Step 2 X = X + X^2 Next I MsgBox("I " = & Str()) 11 MsgBox ("X = & Str (X)) What does the first MsgBox display?
-
Rachel Cook is very concerned. Until recently, she has always had the golden touch, having successfully launched two start- up companies that made her a very wealthy woman. However, the timing could...
-
What are "end of runway" facilities?
-
Give the output of the following code segment? for(int i = 1; i
-
What do vampire teach us about humanity and being human (about mortality and fragility; about love and hate; about religion, beliefs and rituals; about fears of the unknown and the different, etc.)?...
-
1. For the following program segment, give the output produced by the segment: 1 int i = 13; 2 while (i> 0) { int j = 2; while (j
-
3. Write an algorithm to compute the distance s fallen by an object in free fall. The formula is: S=So +Vot+/2a1 where so is the initial position in feet, vo is the initial downward velocity in...
-
1. Solve the given system of equations using Cramer's rule. 3x + 5y = 6 4x - y =7 (b) 2y+z+=-1 -2-y + 3x= -1 -2x+3:+2y=5
-
=CX 5. Graphical Behavior of the Log to the Base e (Natural Log) Function: a. Plot both the exponential function f(x)=e" and the logarithmic function g(x)= In x in Mathematica. (Notation: In...
-
Avatar Financials, Inc., located on Madison Avenue, New York City, is a company that provides financial advice to individuals and small- to mid-sized businesses. Its primary operations are in wealth...
-
In Exercises use the quotient Rule to find the derivative of the function. g(t) = 31 - 1 2t + 5
-
In Exercises match the differential equation with its slope field. [The slope fields are labeled (a), (b), (c), and (d).] (a) (b) (c) (d) ////// ////////// // / / / / / / / / / / / / / / / /...
-
Use Theorem 13.9 to find the directional derivative of the function at P in the direction of v. Data from in Theorem 13.9 THEOREM 13.9 Directional Derivative If f is a differentiable function of x...
-
Example 11.3 introduces Klein's Model I. Use the data file klein to answer the following questions. a. Estimate the consumption function in equation (11.17) by OLS. Comment on the signs and...
-
Example 11.3 introduces Klein's Model I. Use the data file klein to answer the following questions. a. Estimate the investment function in equation (11.18) by OLS. Comment on the signs and...
-
Mike's Veneer Shop owns a vacuum press that requires annual maintenance. Mike has a contract to cover the maintenance expenses for the next 5 years. The contract calls for an annual payment of \(\$...
Study smarter with the SolutionInn App