Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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,

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions

Question

Recommend the key methods to improve service productivity.

Answered: 1 week ago