A programming project using ARM 6 assembly language
$10-30 USD
Completed
Posted about 4 years ago
$10-30 USD
Paid on delivery
The programming project is to calculate the LCM() and GCD() for two user-entered positive integers. Like this:
There are requirements about the structure of your program and how it should work (see below). This assignment is easily done in fewer than 150 lines of code using (only) the ARM instructions and programming structures that we've covered. If you find yourself radically exceeding that number of lines it might be time to rethink your approach!
Requirements
The program should consist of two functions and the main code. One function implements integer quotient/remainder. The other calculates the greatest common divisor using the above formula. The main code should call these functions to perform the LCM calculation. The function call mechanism is the instructions bl and bx. No credit will be given for simply branching into and/or out of the functions.
The GCD calculation is recursive. Your function should recursively call itself (via bl). No credit will be given any non-recursion approach. The parameters should be passed into the function via r0 and r1 and the result returned in r0.
Integer division
If N is a non-negative integer (numerator) and D is an integer greater than 0 (divisor), integer division N ÷ D produces a pair of integers Q (quotient) and R (remainder) which satisfy N = D × Q + R and for which 0 ≤ R < D. The number Q is the quotient and the number R is the remainder (also known as the modulus, which we compute with the modulus operator in most programming languages).
In the above formulas we need the remainder when computing GCD and we need the quotient when computing the LCM. ARM6 assembler doesn't have an integer division instruction but it's an easy exercise to create an integer division function. You just repeatedly subtract the divisor from the numerator until the numerator is smaller than the divisor. The number of times you subtracted is the quotient. Whatever is left of the numerator is the remainder. Try it...
When coding it's always best to start small and build up. Additionally, it always pays to test your functions before you incorporate them into a program. These things are especially true when coding in an assembly language!
The best starting point is to make sure you can do input and output correctly. Once you've got that working, get an integer division function working. Once you've got integer division, it's easy to calculate the LCM.
Because both r0 and r1 get used for parameters and return values, it will pay to be very careful to protect their contents. The stack is your friend, here. Because there can be many function calls it definitely pays to be very careful with the stack. (There was an important lesson in the debugger-lab's code...)
Hi. I’m embedded software engineer working for Bosch Vietnam. I was a SoC hardware design and verification engineer in Renesas Vietnam. ARM assembly and C are the main programming language. Kindly contact me if you’re interested.
$25 USD in 1 day
0.0 (0 reviews)
0.0
0.0
7 freelancers are bidding on average $25 USD for this job
Hello! I am an experienced design engineer and have helped many students on their assembly projects. I already have the setup ready and should be able to help you out right away!
Hi, I have understood your requirement very well. I have 3 years of Embedded domain mostly on ARM cores. I have developed bootloaders, device drivers, Re-Programming modules , EEPROM module and so. As you can see most of them involves assembly language for implementation. I am confident that I can deliver the project on time.
i have good experience in c and embedded c i write assembly code using m0 and m4 arm core for me if you accept proposal i will start to learn assembly using arm 6 and will implement the code after it
5 years experience in Embedded and C/C++. Wrote debuggers and simulators for different embedded systems. Working primary on AVR, ARM, PICs, so it should not be a Problem.