Question: Assembly Language and Computer Organization In this programming assignment, you will use ARMv8 single precision floating point arithmetic. You will compute average of a list
Assembly Language and Computer Organization
In this programming assignment, you will use ARMv8 single precision floating point arithmetic. You will compute average of a list of floating point numbers in an array a. Then you will compute the standard deviation of the list of numbers. The following pseudo code in C shows what you need to do. Remember

A few things to remember. In ARMv8 (using DS5) we will declare integers (e.g., n) as .Xword and single-precision floating-point numbers (the array a) as .float We will use X registers for integers and S registers for single-precision floating-point numbers.
Since we need to divide sum (which will be a floating-point number) by n (which is an integer), we need to first convert the integer into a floating-point number. We can use SCVTIF (Single precision Convert Integer to Float). For example, if n is X2, we can convert it to float using
SCVTIF S3, X2 //convert X2 to float and store in S3
S3 contains the same value as that in X2, but represented as a floating-point number. Now we can use S3 to divide sum.
All floating-point arithmetic instructions will start with F. For example, FADD, FSUB, FMUL, FDIV .
FDIV S2, S1, S3 // Divide S1 by S3 and store result in S2
We can find square root of a number using FSQRT.
FSQRT S4, S2 //find the square root of the value in S2 and store result in S4
One final item to remember: single-precision floating-point numbers are 32-bits and thus they occupy 4 bytes. This means, the array elements are only 4 bytes apart (unlike array of integers you have used in previous programming assignments, which take up 8 bytes and you incremented address by 8 bytes).
Otherwise the syntax of instructions look the same as integer instructions.
For this problem assume an array with 8 numbers and initialize the array with 17.0, 12.1, 3.2, 7.3, 31.4, 27.5, 5.6, 19.7.
Use X1 to contain the address of the array a, X2 contains the value of n (not the address of n), S1 will contain average (after the function average returns) and S2 contains standard deviation (after the function std-deviation returns). If you do not modify these registers, you do not have to save any values on stack. You should try to use other registers to keep track of the address of a[n] and not modify X1.
You need to write two functions similar to C code above.
Submit: A file containing your ARMv8 code, a read me file (if needed), a snapshot of S registers before you start executing, and after the program completing showing the results in S1 and S2. You should also show a snapshot of memory to show the values of the array a.
Optional: You can include additional snapshots to show values in X registers, and intermediate values when you are accumulating sum values in both the average and the standard deviation functions.
n-1 Average = [i]) i-n-1 Standard Dewlation(all-A)* . (a[i]-Average)2 float average (long long int *a, long long int n) [long long int i; float surn 0.0; for (i=0; i
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
