Write and test a mips program with mars consisting functions

Assignment Help Computer Engineering
Reference no: EM132216469

Write and test a MIPS program with 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: EM132216469

Questions Cloud

Fill the array with ten doubles entered by the user : Call the display function to output the array. Call the remove function to remove the value at the index provided by the user.
Convert a complex number in rectangular form : Write and test thoroughly a MATLAB function which converts a complex number in rectangular form.
Display the integers 50 through 1 in descending order th : Write two short segmentd of code that displays the integers 50 through 1 in descending order on the console.
Write two pep-7 machine language instructions : Write two Pep/7 machine language instructions that put the value 0000000100000001 into the A register and then adds the value 0000000000000010 to it.
Write and test a mips program with mars consisting functions : Write and test a MIPS program with MARS consisting of four functions. Note: In the following descriptions, the symbol & means "address of".
What is unique about the product or service : Write 300 - 500 Word Maximum. Include your name in file upload for example: JohnSmith_Assignment1_BA432. Research your company, write a paper with a paragraph.
Write a test program that prompts the user to enter a string : Write a test program that prompts the user to enter a string and displays the num ber of letters in the string 6.21 .
What is the context of the situation from your perspective : To write this assignment, you must find a clear focus about your topic (do not try to write about all of technology, instead find an element that interests you)
Write two page summary paper about oracle 12c : Write two page summary paper about ORACLE 12C release 2 includes three or more different quotes for purchasing the program, including price.

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