Question: 5.3 Write a function (int spe:v0, int sno:v1) PENO(int x[]:a0, N:a1) that will find the sum of the positive even values and the sum of

5.3 Write a function (int spe:v0, int sno:v1) PENO(int x[]:a0, N:a1) that will find the sum of the positive even values and the sum of the negative odd values in an array X of length N. The address of an array X is passed in a0. "N", the length of the array, is passed in a1. The function should return two values, 1. The sum of all the positive even elements in the array passed back in v0. 2. The sum of all the negative odd elements in the array passed back in v1. Write a main routine to call PENO and print the results.

5.4 5.4 (a) Write a function int SUM(int N:a0) to find the sum of the integers from 1 to N, making use of multiplication and shifting operations. The value N will be passed to the function in a0 and the result will be returned in the v0 register.

5.4(b) Write a MIPS assembly language main program that will call the SUM function five times each time passing a different value to the function for N, and then printing the results. The values for N are defined as -> N: .word 9,10,32666,32777,654321

5.5 Write a function FIB(int N:a0, int array[]:a1) to store the first N elements of the Fibonacci sequence into an array in memory. The value N is passed in $a0, and the address of the array is passed in register $a1. The first few numbers of the Fibonacci sequence are: 0, 1, 1, 2, 3, 5, 8, 13,.... The sequence can be defined over the natural numbers, n, by the recurrence equation: For all n in the Natural Numbers, Fib(n) is defined as n, if n is either 0 or 1 otherwise the sum of Fib(n-1) and Fib(n-2).

5.8 Write the function described in section 5.8 and a main routine to test it

5.9 Write the function described in section 5.9 and a main routine to test it 5.10 Write a function that will receive three integer words in registers $a0, $a1, and $a2, and will return them sorted with the minimum value in $a0 and the maximum value in $a2.

5.10 Write a function that will receive three integer words in registers $a0, $a1, and $a2, and will return them sorted with the minimum value in $a0 and the maximum value in $a2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!