Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c code to MIPS assembly code (compile in QTSpim) In this part, you will gain experience in writing assembly code to call, execute, and return

c code to MIPS assembly code (compile in QTSpim) image text in transcribed
In this part, you will gain experience in writing assembly code to call, execute, and return from a function. You will use the jal and jr instructions to get to and return from a function. You will need to study the registers and adhere to the standards of which registers are saved by the caller and callce. The register conventions are attached on the last page for your convenience. You will also gain experience in the use of the stack. Some points to keep in mind while writing function calls are, You will need to save any of the Stx registers on the stack that you want to preserve after the function returns. Remember to pop those Stx back from the stack immediately after the calling function returns. Remember to push any of Ss registers onto the stack you might want to use them inside your function You will then need to pop those $s registers back before you execute the jr Sra to return. You may also need to push and pop the Sra register if your function calls yet another function. i.e., if your function is not a "leaf" function. . . Program 1 In this first program you can use registers to pass arguments and results. Conventionally, you should use the Sao...Sa4 registers to pass your function arguments. int distance (int a, int b) int temp (b> a) tempa ab: batemp retorna-b) 1 void main(void) int varl 30 int var2 210: result - distance (vari, var2): return

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

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions