Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in MIPS machine language intended to be run on MARS that calls a procedure to calculate the average of two values. Initialize

Write a program in MIPS machine language intended to be run on MARS that calls a procedure to calculate the average of two values. Initialize the two values to be averaged in main. Pass these two values as parameters on the stack to the average procedure. Compute the average of the two value parameters in the procedure. Use the stack to pass the result back to main.

Here are some tips and REQUIREMENTS:

1. The first thing your program needs to do is to print out your family (last name) and your student ID. Create strings and use the print_string syscall to display this information to the MARS Run I/O window.

2. Load immediate values for num1 and num2 into save registers $s0, $s1 respectively.

3. Create a procedure to calculate the average of the two values. Store the average result in the temporary register $t0.

4. Use the stack to pass the values obtained in main to the procedure.

5. Use the stack to return the result generated in the procedure back to main.

6. Use the test values 12 and 2 for your test run.

7. Be sure to create and destroy stack frames as needed to cleanly implement your solution.

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions