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

  Write a regular expressions for numbers which can be

Write a regular expressions for numbers which can be natural numbers or decimal mumbers, or numbers with exponent.

  Make a 2010 word flowchart listing the steps

You are sitting on a chair in a large room. You see an empty chair, facing you, across the room. You want to get to that chair on the other side of the room and sit in it.

  Identify design decisions that made as part of etl process

Identify design decisions that must be made as part of the ETL process. Describe the importance of these design decisions.

  What will the swap macro

What will the SWAP macro in the following program be expanded to on preprocessing? will the code compile?

  Logic programming and imperative programming

Can describe procedural language in clearly and simply - And compare other object-oriented programming, functional programming, logic programming and imperative programming.

  Discuss future trends in it process integration

Define the concept of foundation building as an IT portfolio management strategy. Describe the horizontal approach to IT portfolio management.

  Define place to manage ongoing security

what kinds of corporate procedures will you put in place to manage ongoing security of the banking industry resources

  Write down a 3- to 5-page paper which gives a detailed

write a 3- to 5-page paper that provides a detailed technical analysis comparing the advantages and disadvantages of

  Recognize the dsl and cable modem services referenced in

research dsl and cable modem services available closest to your community. you may use neighboring communities or

  Draw a uml class diagram to support your claim

Identify one or two key distinctions within that class that would prompt you to create subclasses instead of fields

  Fill all array elements with a zero except those diagonal

Declare a two dimensional array with 10 rows and 10 columns of whole numbers.

  Display the sum and average of the numbers

Write a Java program that inserts 25 random integers ranging from 0 to 100 into an ArrayList in ascending order.

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