Question

Q1 ) We are writing a subroutine, and want to use $t0. What are the considerations?...

Q1 ) We are writing a subroutine, and want to use $t0. What are the considerations? (check all that apply)

1 - We know that the routine which called us gives us permission to use this register, so we don't have to save its value before using it.

2 - The routine which called us may have an important value in that register, so we should save its value before using it.

3- We know that the subroutine won't touch the value in $t0, but if it does, it will save the value then restore it, so the value will be preserved for us.

4 - If this is a recursive subroutine, then we should save the value of $t0.

5- If we have an important value in $t0, and we are going to call another subroutine, we should save the value in $t0 before making the call, and restore the value when we get back from the subroutine.

6- Perhaps we've used $t0, but we are done with the value before calling the subroutine, so in this case we don't have to save its value.

Q2) What values should be saved to the stack? Select all that apply.

1 - The $v0 register

2- The $fp register, if the routine uses it

3- The pc register

4 - Any of the $s registers that this routine uses

5 - The $sp register

6- Any of the $t registers if this routine calls a subroutine and these register have important values

7 - The $ra register (if this routine calls a subroutine)

8 -Any local values of the subroutine

Homework Answers

Answer #1

Q1)

ans: 4.If this is a recursive subroutine, then we should save the value of $t0.

5.If we have an important value in $t0, and we are going to call another subroutine, we should save the value in $t0 before making the call, and restore the value when we get back from the subroutine

Q2)

ans:

1 - The $v0 register.

6- Any of the $t registers if this routine calls a subroutine and these register have important values

7 - The $ra register (if this routine calls a subroutine)

8 -Any local values of the subroutine

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Remember that the discount rate is the interest rate that we use to find the present...
Remember that the discount rate is the interest rate that we use to find the present value of a cash flow or a lump sum. If you have $10,000 in 10 years, what would be the value of that $10,000 today. We would need to calculate the present value using 10 years as the number of periods (n), a discount rate (r) that we would need to determine, and we know the future value (fv) is $10,000. What if we...
Section 2: Using the MARS or SPIM simulator develop a program that will implement the following...
Section 2: Using the MARS or SPIM simulator develop a program that will implement the following conditional statement. If ( n is even) { n = n / 2; } else { n = 3 * n + 1; } In this case, n is to be input by the user (assume they input a non-negative value), the conditional is performed, and the resulting n is to be output. Again, use the system calls for input, output, and exiting the...
Mr. Bestall, CFO of the Best Finance Inc., was satisfied with its income statement report. He...
Mr. Bestall, CFO of the Best Finance Inc., was satisfied with its income statement report. He decided to have a meeting with the analysts following the Best Finance Inc. before filing its financial statements with the SEC. The following conversation was in the meeting. CFO: The year ended on September 30 should be our most profitable in history and as a consequence, the board of directors has just awarded the officers generous bonuses. Analysts: I thought profits were down this...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's...
Consider the C program (twoupdate) to demonstrate race condition. In this assignment, we will implement Peterson's algorithm to ensure mutual exclusion in the respective critical sections of the two processes, and thereby eliminate the race condition. In order to implement Peterson's Algorithm, the two processes should share a boolean array calledflagwith two components and an integer variable called turn, all initialized suitably. We will create and access these shared variables using UNIX system calls relating to shared memory – shmget,...
Create a function in MIPS using MARS to determine whether a user input string is a...
Create a function in MIPS using MARS to determine whether a user input string is a palindrome or not. Assume that the function is not part of the same program that is calling it. This means it would not have access to your .data segment in the function, so you need to send and receive information from the function itself. The program should be as simple as possible while still using necessary procedures. Follow the instructions below carefully. Instructions: ●...
Description: The purpose of this assignment is to practice writing code that calls functions, and contains...
Description: The purpose of this assignment is to practice writing code that calls functions, and contains loops and branches. You will create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. General Comments: Your code must contain at least one of all of the following control types: nested for() loops a while() or a do-while() loop a switch() statement an...
C++ ONLY -- PRACTICE ASSIGNMENT For our practice assignment we have to turn in 2 files...
C++ ONLY -- PRACTICE ASSIGNMENT For our practice assignment we have to turn in 2 files - Driver.cpp and StringQueue.h Driver.cpp is provided for us, but if there are any changes needed to be made to that file please let me know. Based on the instructions below, what should the code look like for StringQueue.h ? Create a class named StringQueue in a file named StringQueue.h. Create a QueueNode structure as a private member of the class. The node should...
TrackMinMax For this lab, you will create a generic version of the IntTrackMinMax class you wrote...
TrackMinMax For this lab, you will create a generic version of the IntTrackMinMax class you wrote in a previous lab, called TrackMinMax. The API is: Function Signature Description constructor TrackMinMax() constructor check void check(T i) compares i to the current minimum and maximum values and updates them accordingly getMin T getMin() returns the minimum value provided to check() so far getMax T getMax() returns the maximum value provided to check() so far toString String toString() returns the string "[min,max]" As...
Describe and assess the different risks associated to each alternative of the decision making and select...
Describe and assess the different risks associated to each alternative of the decision making and select your risk preference or tendency to choose a risky or less risky option. (300 words minimum) The directors of fast food chain of restaurants based in Barcelona named El Mejicano were considering whether to begin the promotion for their new line of menus than originally planned. "I think we should go ahead with the price cuts," Pedro Morales said. "After all, it couldn't hurt!...
The Estate Tax One of the richest men in the world, Warren Buffett (as of 2010),...
The Estate Tax One of the richest men in the world, Warren Buffett (as of 2010), suggests that repealing the estate tax will benefit only the richest Americans. In 2010, this is the top 2% of the United States population. To put this in more common terms, 98 of every 100 people who die face no estate tax whatsoever. Nevertheless, many younger Americans assume that the group of richest Americans will eventually include them. Listen to the short Warren Buffet...