Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Complete the mips program so it will perform the required tasks. NO PSEUDO CODE or EXTENDED FORMATS. NO Li or La In this assignment, you

Complete the mips program so it will perform the required tasks. NO PSEUDO CODE or EXTENDED FORMATS. NO Li or La

image text in transcribed

image text in transcribed

In this assignment, you are to complete a MIPS program so it will perform the required tasks The main function of the code is provided. You are to complete the program by writing four functions. Pay particular attention to the purpose of each function and how the parameters and stack are to be used. NO pseudo code/extended formats. Turn off the option on MARS under settings that allows the use of these instructions 1. print ?a0 integer value to print $a1 - address of string to print This function must first print the string and then print the integer. Both outputs must be on the same line. End the output with a newline 2. multiplication $a0-first integer ?a1 - second integer Sv0-first integer * second integer This function is to calculate and return the result of multiplying the first argument by the second argument. Assume that both arguments are greater than zero. You must calculate the result using a loop. Using any version of the mult instruction is NOT ACCEPTABLE 3. getpos SvO -positive integer input This function must prompt the user to input a positive integer and then get input from the user. The process of printing a prompt and then reading input must be repeated until a value greater than zero is input. The input value is then returned in $vO. The prompt string will need to be added to the.data segment 4. getinput ?a0 - address to store the first value ?a1 - address to store the second value This function will call the getpos function (above) two times. The result of the first call should be stored into memory at the location given in $a0 and the result of the second call should be stored into memory at the location given in $a1. As this function calls another function, the ?ra must be stored on the stack at the beginning of the function. Also, the Sra and $sp must be restored at the end of the function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions