Question: Part 1 : Coding Task you need to write two subroutines The project is about finding the mean ( i . e . , E

Part 1: Coding Task you need to write two subroutines
The project is about finding the mean (i.e., E[cos(x)]) and mean square (i.e., E[cos2(x)]) of the
cosine function.
You are asked to write two subroutines called array_average and array_square_Qm whose
contracts are given in the file project.asm posted to Carmen. Download this file and add your
code to it as indicated. This asm file comes with the test code and three subroutines that you will
use when computing the average and do the squaring. You are not allowed to modify any of the
code that is already provided in the file project.asm.
The subroutine array_average takes a pointer to an array of 16-bit signed numbers and the
number of elements in the array of length and returns the average of the values in the array.
This subroutine will call the two subroutines x_div_2powerP and log_x_base2 that are
provided in the asm file on Carmen.
The subroutine array_square_Qm takes two pointers to word-arrays of the same length n.
One of the pointers points to an input array with elements (x 1, x2,..., xn ), and the other one points
to an output array with elements (y 1, y2,..., yn ). Each of the elements (x1, x2,..., xn ) in the input
array is assumed to be a signed 16-bit number with Q-value m. The subroutine
array_square_Qm will compute the square of each of these elements, correct for the Q-value,
and write the result to the output array. In particular,
!=1
2"(!)#
Recall that if both factors of a multiplication have Q-value m, the product will have Q-value 2m. If
we want to have the product have Q-value m, we must adjust the product value and divide by 2m .

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 Programming Questions!