Question: 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 Needs to be in ARM Assembly 3. Write a recursive 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 below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!