Write and test a mips program using only mars

Assignment Help Computer Engineering
Reference no: EM132216504

Write and test a MIPS program USING ONLY MARS consisting of four functions. Note: In the following descriptions, the symbol & means "address of".

1. void main(): The main function must print your name, call readvals to place the values into an array of 10 single precision floating point numbers and then call the print function to complete the program. The main function must set up all parameters before calling each of the functions.

2. int readvals (&array): The starting address of an array is passed to the function as a parameter using $a0. The function must prompt for, read and store floating point numbers into the array until either a negative number is entered or 10 numbers are read. Once the tenth number is entered, your program must stop reading. The function must return (using $v0) the number of values read and stored in the array (10 or less). The negative ending input is not part of the array and must not be stored in the array. If the first input is a negative number, then the array will be empty and the count returned is zero.

3. float average (&array, count): The starting address of an array (in $a0) and the number of values stored in the array (in $a1) are passed to the function. The purpose of the function is to calculate and return (using $f0) the floating point average of the numbers. If the count is zero, return 0.0.

4. void print (&array, count): The starting address of an array (in $a0) and the number of values stored in the array (in $a1) are passed to the function. The function should print all values stored in the array each on its own line. Then the average function is called to determine the average value. The returned value is then printed. As this function calls another function, it must store the $ra on the stack and then restore it at the end.

Example input and output. Note: floating point output cannot be formatted. This is not real output.

Katy Perry

Enter a number 3.0

Enter a number 6.0

Enter a number 2.0

Enter a number 4.0

Enter a number -1.0

3.0

6.0

2.0

4.0

3.75

In addition,

Functions must be called using jal and return using jr.

Parameters must be passed as specified and used correctly. The readints, average and print functions must access the array through the parameter $a0, not determine the address directly.

Be sure to comment all instructions. All functions must include comments describing the function and its parameters and return value (if any)

Reference no: EM132216504

Questions Cloud

Write a main program that reads in two lengths from the user : Write a main program that reads in two lengths from the user as feet and inches and uses the functions to compute the sum of he lengths.
What is the big-oh worst-case running time of your algorithm : What is the big-Oh worst-case running time of your algorithm, if the length of the input string w is n?
Write and test the code for the function mystery function : Write and test the code for the function mystery Function that consumes a vector, V, and produces a new vector, W, of the same length.
Draw a schematic diagram of the temperature profile : Determine the mass flow rate of the cooling water needed and the mass flow rate of condensation of the stream in the condenser
Write and test a mips program using only mars : Write and test a MIPS program USING ONLY MARS consisting of four functions.
Write a threaded echo client and add a nice feature : Your problem is to add a "nice" feature to this program to allow a user to start a command-line shell on the host machine.
Display the output voltage of an electrical circuit : Writhe a C++ program that calculates and displays the output voltage of an electrical circuit by the following equation.
Write a volatile loop fragment that calculate : Sum of a series of numbers entered by the user until the value 999 is entered Note: 999 should not be part of the sum
Provide your code and evidence of it working properly : A sub that reads the number from cell A1 (entered by the user), calls the factorial calculator function, and then writes the answer in cell B1.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd