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...
-
The unadjusted and adjusted trial balances follow for Fraser Valley Services Ltd. at the end of its fiscal year, August 31. The company adjusts its accounts annually. Instructions Prepare the...
-
The data in Table 6 on page 232 represent the club-head speed, the distance the golf ball traveled, and the residuals (Column 7) for eight swings of a golf club. Construct a residual plot and boxplot...
-
What are three economic factors that influence what people buy?
-
Padre, Inc., buys 80 percent of the outstanding common stock of Sierra Corporation on January 1, 2015, for $802,720 cash. At the acquisition date, Sierras total fair value, including the...
-
Dorion Fresh WaterDorion Fresh Water (DFW) sells bottled water that comes from afreshwater spring in the town of Dorion, Ontario. DFW owns theland, and much of the surrounding area, where the fresh 2...
-
i. ii. Inventory as of 31 April 2024 was valued at RM27,515. The loan interest for six months ended 30 April 2024 is outstanding. Rent paid in advance on 30 April 2024 amounted to RM870. iv. Rates...
-
Question 16 1 Point Mr. Jones is insured under a Homeowners Broad Form (HO-2). A sudden surge of power from the city's power plant burns out the motor on his freezer and the meat in the freezer...
-
What are human resource management (HRM) programs intended to do for the organization?
-
What is the purpose of training and what are the major steps in training?
-
What is selection? Also, what is meant by a performance test?
-
Define recruitment and the two major sources for recruiting.
-
Discuss the three general roles of management. What are the purposes of these roles? What specific roles fall under each general role?
-
What is implied demand uncertainty? Provide one example of a product with high implied demand uncertainty and a product with low implied demand uncertainty. Paragraph
-
If the amplifier indicated by the box input impedance of oo, which of the following statements are true ? has an open loop gain as well as Feedback factor (\beta = 1/ R_1\) The feedback is voltage...
-
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...
-
What are three economic factors that influence what people buy?
-
What are at least five strategies followed by smart shoppers.
-
Suppose that you are considering buying a pair of in-line skates. What steps might you take before you shop and as you weigh your alternatives?
Study smarter with the SolutionInn App