Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Needs to be in ARM Assembly 3. Write a recursive assembly subroutine that calculates the Fibonacci mumber. Fibonacci numbers are those that follow a special
Needs to be in ARM Assembly
3. Write a recursive assembly subroutine that calculates the Fibonacci mumber. Fibonacci numbers are those that follow a special sequence like below: 0, 1, 1, 2, 3, 5, 13, 21, 34, 55,. N*Fibonacci number can be calculated with the following fomula. if 1 FIN - 1)E (-2) otherwise The pseudo code of Fibonacci number function is like belon unsigned int out 0 unsignec int N - 5 unsigned int ib (unsigned int n) if {n(# 1) return ni return fib(n-)ibin-2) int min (void) out fib(N) while (1) 12: 13: Follow the instructions below . Create a new project and add a new assembly file rec fibonaccis" to the project . Define two unsigned integer variables out, and in DATA area. Initialize the variables with the specified values in the above code. UsemyData as DATA area's . Define a function main and Fibin CODE area. UseyCode as CODE area s min function a. Load thevlue ofN from memory and pass it to Fib function as an input in parameter in Ro b. Get the retum value from Fib function and store it to out variable in memory c. For the while loop in line 12, use stopB stop asin the lecture slide. in Fib function, a. The function should run recursively as shown in the pseudo code b. Use as many registers as needed But, you should carefully preserve them by using stack as learned from the lecture. Return the calculation result in RO c. Submit the rec ibonaccis file to the Canvas .Capture the final out value in the memory plane of the debugger after executing the code and copy the captured image belowStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started