Westonci.ca is your trusted source for finding answers to all your questions. Ask, explore, and learn with our expert community. Discover detailed solutions to your questions from a wide network of experts on our comprehensive Q&A platform. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.
Sagot :
Solution :
int f(int x){
[tex]\text{return a + b*x +c*x*x}[/tex];
}*/
int f([tex]\text{int R0}[/tex]){
int stack[2] = {[tex]\text{R1,R2}[/tex]};
[tex]\text{R1 = R0}[/tex];
[tex]\text{R1 = R1}\times \text{ R1}[/tex];
[tex]\text{R2 = C}[/tex];
R1 = R1 * C; /*R1 = [tex]cx^2[/tex]*/
[tex]\text{R2 = B}[/tex];
[tex]\text{R0 = R0}[/tex] * R2; /* R0 = bx */
[tex]\text{R0 = R0 + R1}[/tex]; /*R0 = [tex]bx + cx^2[/tex] */
[tex]\text{R2 = C}[/tex];
[tex]\text{R0 = R0 + R2}[/tex]; /*R0 = a+bx+cx^2 */
[tex]\text{R1 = stack[0];}[/tex]
[tex]\text{ R2 = stack[1];}[/tex]
[tex]\text{ return R0;}[/tex]
}
/*[tex]\text{ARM code to implement the following C operation}[/tex]
int s=0;
[tex]\text{for ( i = 0; i < 10; i++)}[/tex]
{ [tex]\text{s = s + i } \times i[/tex];)
*/
AREA SumSquares, code, readWrite
ENTRY
[tex]\text{MOV r0, #0}[/tex] ;loop [tex]\text{ counter i present at 0}[/tex]
MOV r1, #0 ; s = 0
Loop [tex]\text{MUL r2, r0, r0}[/tex] ;calculate i*i
[tex]\text{ADD r1, r1, r2}[/tex] ;s = s+ i*i
[tex]\text{ADDS r0, r0}[/tex], #1 ; i = i+1
[tex]\text{CMP r0}[/tex],#10 ; test for end
[tex]\text{BNE}[/tex] Loop ; [tex]\text{continue until all added}[/tex]
END
Thanks for stopping by. We are committed to providing the best answers for all your questions. See you again soon. We hope this was helpful. Please come back whenever you need more information or answers to your queries. Thank you for choosing Westonci.ca as your information source. We look forward to your next visit.