Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using ARM Cortex-M Write an assembly program that calculates the value of the fo

ID: 2085751 • Letter: U

Question

Using ARM Cortex-M

Write an assembly program that calculates the value of the following polynomial, assuming signed integers x and y are stored in registers r0 and r1 respectively, using as few multiply and add or subtract instructions as possible. Test this programs for x values of 3, -4, and 9 using the TIVA board. What are the resulting values of y (as hex and base 10) for these three x values? State to the grader whether or not you have actually tested your program. Include your program (handwritten or printed). This problem can be performed using only two multiply and two add or subtract instructions. y = 3x^3 - 7x^2 + 8x - 2

Explanation / Answer

#include "stdio.h"
#include "conio.h"
void main()
{
float a[100],sum=0,x;
int n,i;
clrscr();
printf("Enter the degree of the polynomial:");
scanf("%d",&n);
printf("Enter the coefficients into the array:");
for(i=n;i>=0;i--)
{
scanf("%f",&a[i]);
}
printf("Enter the value of x:");
scanf("%f",&x);
for(i=n;i>0;i--)
{
sum=(sum+a[i])*x;
}
sum=sum+a[0];
printf(" Value of the polynomial is =%f",sum);
getch();
}
Consider the polynomial 3x^3-7x^2+8x-2 where x=2, then the output will be as follows,
Output:

Enter the degree of the polynomial:
3
Enter the coefficients into the array:
3
7
8
2
Enter the value of x:
3
Value of the polynomial is:43.000000
OUTPUT:
Enter the degree of the polynomial:
3
Enter the coefficients into the array:
3
7
8
2
Enter the value of x:
-4
Value of the polynomial is:-336.000000
OUTPUT:
Enter the degree of the polynomial:
3
Enter the coefficients into the array:
3
7
8
2
Enter the value of x:
9
Value of the polynomial is:1984.000000

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote