Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE/EEE 230 Assignment 3 Spring 2018 Due February 27 (11:59PM) No late assignments are accepted. Get your work done early. Comment the beginning of your

image text in transcribed

CSE/EEE 230 Assignment 3 Spring 2018 Due February 27 (11:59PM) No late assignments are accepted. Get your work done early. Comment the beginning of your programs with your name, class ID, and assignn . Comment each function. Describe which registers are used in the function and they are used. 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 Submit your file with the complete program. num1:.word 0 num2:.word O answer: asciiz "The product is # add other strings at this point as needed 1. print a0-integer value to print Sa1- address of string to print text Elobl main 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 al getpos addi $sa, $vo, O # get a positive number for the loop # save input value $a0-first integer a1 -second integer vo first integer second integer repeat: beq $so, So, end # while there are more repeats 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 lul $a0, 0x1001 addlu $a1, $a0, 4 Jal gctinput # get address of first word # get address of second word # call function to ect input, store into addresses #get address of first word # get the first value from memory # get the second value from memory # m ulti ply the values, result in $VU lui $:0, 0x1001 3. getpos lw $a1, 40StO) jal multiply vo 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 addi $ao, Sva, o lui $al, Ox1001 addi Sal, $al, 8 al print # get value to print from SVD # get start of data section # get start of the product autput string print results addi $50, 550,-1 i repeat 4. getinput #d rt again Sa0- address to store the first value $al- address to store the second value end: ori SvO, $O, 10 # set command to stop program # end program yscall 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 Sra must be stored on the stack at the beginning of the function. Also, the Sra and Ssp 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 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

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

=+a. Is it relevant to the audience?

Answered: 1 week ago