Final Exam Review for the ARM Assembly instructions Part 2 is a programming problem (20 points) described below. Create a square root solver using ARM instructions in Assembly Language Write an assembly code to solve a square root problem such as solving V64 or V100 using the bisection method. Your code must approximate the square root of an integer. All math is done with integers, so the resulting square root will also be an integer. Using an integer math is sufficient (no floating point or fractions are required): your code will return the integer portion of the square root. Your code must be in assembly language subroutine which is called by a function. Be sure to use registers according to the ARM calling convention. Possible Assembly instructions used to create a square root solver: #include <MKL2524.H> _asm int my_sqrt(int x) ADD ADDS ASRS B BX BEQ BGT BNE CMP MOV MULS POP LDR PUSH }
int main(void) volatile intr, j=0; int i; r=my_sqrt(0); // should be o r=my_sqrt(64); // should be 8 r=my_sqrt(100); // should be 10 or A for (i=0; i<10000; i++) { r=my_sqrt(); while (1) } Results: Use the Debug environment in Vision IDE to check for results for your square root solver, as illustrated below. The example shows a square root of 64 is 8 in debug mode. 42 44 45 46 my_sqrt(0); // should be o I - my_sqrt (64): 11 should be s my_set(100): // should be 10 ora Watch1 Name Value Dc00000DB Type int <Enter expression>
Final Exam Review for the ARM Assembly instructions Part 2 is a programming problem (20 points) described below. Create
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Final Exam Review for the ARM Assembly instructions Part 2 is a programming problem (20 points) described below. Create
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!