Do not use memory locations to store f1, f2, and f3.

Place your order now for a similar assignment and have exceptional work written by our team of experts, At affordable rates

For This or a Similar Paper Click To Order Now

Objective: To implement conditional and loop in
assembly code
Fibonacci numbers are defined as
f1 = 1 and f2 = 1
fn = fn-1 + fn-2, for n > 2
Write an ARM assembly program to find the next 15
Fibonacci numbers after f1 and f2, but only report those
that are even.
Since the next 15 Fibonacci numbers are 2 3 5 8 13 21 34
55 89 144 233 377 610 987 1597,
The output is: 2 8 34 144 610
Algorithm
1. f1 =1
2. f2 =1
3. loop 15 times
f3 = f1 + f2
if f3 is even display it
f1 = f2
f2 = f3
Suggestions
Use registers r4 – r10 for operands in arithmetic and logical
operations
You may write code to print all the numbers without
checking if they are even first and then add code for the
condition check
Hint: How to check if a number is
even r9 Even: if its bit 0 is 0
r9 Odd: if its bit 0 is 1
Check if r9 is even
ands r10,r9,#1 // if r9 is even, r10 = 0
// also set condition codes
Do not use memory locations to store f1, f2, and f3.
For this assignment, the instruction ldr should only be used
for setting up parameters for printf
**Please Comments on individual instructions
Thank you

Place your order now for a similar assignment and have exceptional work written by our team of experts, At affordable rates

For This or a Similar Paper Click To Order Now

Categories:

No Responses

Leave a Reply

Your email address will not be published. Required fields are marked *