Answered step by step
Verified Expert Solution
Question
1 Approved Answer
home / study / engineering / computer science / computer science questions and answers / write and test a mips program consisting of four functions.
home / study / engineering / computer science / computer science questions and answers / write and test a mips program consisting of four functions. in the following descriptions, ...
Your question has been answered
Let us know if you got a helpful answer. Rate this answer
Question: Write and test a MIPS program consisting of four functions. In the following descriptions, the sy...
Write and test a MIPS program consisting of four functions. In the following descriptions, the symbol & means address of. 1. void main(): The main function must 1) print your name 2) call the readData function 3) call count function 4) complete the program. The main function must set up all parameters before calling each of the functions. 2. int readData (&array): The starting address of an array is passed to the function as a parameter using $a0. The function must prompt for and read and store integers in the array until either a zero is entered or 10 numbers are read. Once the tenth integer 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 zero input is not part of the array and must not be stored in the array. If the first input is a zero, 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 integers 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. To find the average, sum all the integers together and then divide by the count as a floating point value. If the count is zero, return 0.0. Use appropriate registers for the parameters and the return value. 4. void count (&array, count): The starting address of an array (in $a0) and the number of integers stored in the array (in $a1) are passed to the function. The function determines how many of the integers in the array are greater than or equal to the average. First the parameters for the average function are set and then average function is called to determine the average value. The returned value is then printed. Then each value in the array is tested to determine if its value is greater than or equal to the average. The count of the values greater than or equal to the average is then printed.Important. Answer it in MIPS programming
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started