Question: Part 1 : Coding task - Average Absolute Deviation of an Array of Numbers Task: Write a short assembly program that finds the average absolute
Part : Coding task Average Absolute Deviation of an Array of Numbers
Task: Write a short assembly program that finds the average absolute deviation of a given
array. You are given an array with elements dots, and your code computes
where is the mean value of the elements.
The average absolute deviation is a measure of the statistical dispersion of a set of given
samples. The standard deviation, defined as the square root of the variance, is another widely
used measure of statistical dispersion but requires multiplication and taking square roots to
compute. The average absolute deviation is easier to compute and more suitable for
microcontroller applications with a limited instruction set.
Note that, in most cases, the computed average absolute deviation will only be an
approximation due to limitations of available operations. Recall that there is no instruction to do
division unless we are dividing by a power of two. Even then, we will make rounding errors if the
outcome of the division is not an integer value.
For this assignment, you do not need to worry about approximation errors. You will work on a
set with numbers to facilitate easy division you know how to divide by and you can
neglect rounding errors due to discarded fractional bits do not attempt to fix rounding errors
data ; Assemble into RAM
retain ; Override ELF conditional linking
retainrefs ; And retain any sections that have
samples: word
LENGTH: set
buff: word x
mean: word ; Your code will return the mean here
aad: word ; Your code will return the avg. absolute deviation here
foot: word xFFF
; Do NOT modify any of these definition for your submission
; You can experiment while debugging, but submit your results for the given set
;
Your code needs to follow all these requirements or constraints:
Your code needs to compute the mean value of the samples in mean.
Your code needs to compute the average absolute deviation of the samples in aad.
Your code is not allowed to modify the RAM or FRAM otherwise. That means
Your code is not allowed to modify the samples, buff, or foot.
Your code is not allowed to create new variables, arrays etc. in RAM or FRAM nor
does it need to
Your code needs to use indexed mode with the label samples when accessing the
elements in the given array and use the constant LENGTH instead of hardcoded values.
This is a good restriction since using indexed mode will actually make your life easier.
Your code is allowed to use core registers as needed.
Your code must not be wasteful with resources.
Your code must not use more core registers than necessary.
Your code must not use unnecessary jumps aka no spaghetti
Your code must not have unnecessary instructions and the like.
You code should have comments and use descriptive labels.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
