Fibonacci numbers in Nios 2 assembly langueage

I have homework from my Computer architecture class in which we have to implement Fibonacci number program. It goes like this:

Write a program that will store certain number of Fibonacci numbers. The only thing that you should specify is the number up to which Fibonacci numbers are going to be generated. All numbers should be stored in consecutive addresses. For example, if n = 8, then the series is 0,1,1,2,3,5,8,13.

The biggest problem for me is how to store those numbers in the memory?


  • You can store 32-bits integers using the store word instruction. Use the store instruction to store the numbers. Nios II assembly uses store word in its assembly language. The Store Word instruction has the format

    stw rB, byte_offset(rA)

    It stores the contents of register B into the memory location at the address computed as the sum of the byte_offset value and the contents of register A.