Compute the Fibonacci sequence - assembly program:
Problem: Fibonacci
In this problem you will write a program that will compute the first 20 numbers in the Fibonacci sequence. (You can refer to Wikipedia for more information on the Fibonacci sequence). Here is the pseudo-code for the procedure:
F_0 = 0
F_1 = 1;
i = 2;
While (i < 20) {
F_i = F_(i-1) + F_(i-2);
i = i+1
}
More specifically your program should write the first 20 Fibonacci numbers into memory starting at address x4000. At the end of your program the addresses x4000 through x4013 will contain the first 20 Fibonacci numbers starting at 0. You may find the list instruction in PennSim useful for examining the contents of memory.
You can look at the sum_numbers.asm program for an example of a program that accesses data memory.
Big Hint. You will probably find it convenient to maintain a variable that points to the address in memory you are going to write to next and update this on each iteration. You may also find it useful to use the offset field in the LDR instructions to read values that are near to the current store address.
For this part you should turn in two files: fibonacci.asm and fibonacci_script.txt