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...
We are using a raspberry pi in my computer systems class. We need to Write a...
We are using a raspberry pi in my computer systems class. We need to Write a statically allocated linked list in ARM assembly. Steps You Should Follow Step 1 You will statically allocate some space for your link list elements. You need to make 5 elements, each elements should have two components, the next pointer first then the value stored. First inialize next pointer to NULL. The value stored at the address will be a string pointer. It doesn't matter...
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,...
chooose all tye corrct answers to the question:- Q1) What are the best practices for building...
chooose all tye corrct answers to the question:- Q1) What are the best practices for building out good unit tests? - You do not need an assert statement for each edge case. - Write a test function to check for implementation given all parameters. - Have multiple assert statements to test for all edge cases. - Think about all edge cases before you write the function. - Run a test function to see if your function works in all edge...
please use Projectile simulator, for the Lab Projectile Motion in 2-D and answer question below 14....
please use Projectile simulator, for the Lab Projectile Motion in 2-D and answer question below 14. Solve for t. [Hint, you can factor one of the variables.] 15. What is the smaller answer referring to? Given that your larger answer should be the time it takes to land, use that in your x-position equation, i.e. rewrite your equation for x, replacing t with what you got in #14. 16. How far does it travel in the x-direction before it lands?...
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: ●...
Families vary in size and relationships and I believe family should be redefined to reflect the...
Families vary in size and relationships and I believe family should be redefined to reflect the diversity of relationships found today. In my family, my biological father left my mother before my twin sister and I were born so for a little while it was just the three of us. Then my mother met my stepfather and we eventually had two more sisters. As we grew up my mother and stepfather grew apart and then it was just my mom...
please answer and explain Video Transcript: Promoting Children's Health: A Focus on Nutrition in Early Childhood...
please answer and explain Video Transcript: Promoting Children's Health: A Focus on Nutrition in Early Childhood Settings: >> Our most important job is to keep the children safe and healthy. And within keeping them healthy and keeping them safe, we want to make sure that they are receiving proper nutrition. So at this age, starting healthy habits, we want to make sure that the preschool and kindergarten age children are receiving all that we can give them when it comes...