Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the following ARM code so that it now has a main that simply calls a RECURSIVE fibonacci function with a single parameter of 16

Modify the following ARM code so that it now has a main that simply calls a RECURSIVE fibonacci function with a single parameter of 16 (that is retrieved from a memory labeled fibinput. This function will return the 16th fibonacci value and the main will then store only this one value back into memory in a memory location labeled fibnumber.

Here is the ARM lab That need to modify:

ldr R4, =copyPrms MOV R0, #0 MOV R1, #24 MOV R2, #1 again ADD R3, R2, R0 SUBS R1, R1, #1 MOV R0, R2 MOV R2, R3 str R3, [R4], #4 BNE again copyPrms DCD 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 END

Here is what the recursive Java version of the code might look like:

public static int fibonacci(int number) { if (number == 1 || number == 2) { return 1; } return fibonacci(number-1) + fibonacci(number -2); }

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Group Size and Communication

Answered: 1 week ago