Nios 2 汇编语言中的斐波那契数列
Fibonacci numbers in Nios 2 assembly langueage
我有我的计算机架构作业 class,我们必须在其中实现斐波那契数列程序。它是这样的:
编写一个程序来存储一定数量的斐波那契数列。您唯一应该指定的是要生成的斐波那契数列的最大数字。所有数字都应存储在连续的地址中。例如,如果 n = 8,则序列为 0,1,1,2,3,5,8,13。
对我来说最大的问题是如何将这些数字存储在内存中?
您可以使用存储字指令存储 32 位整数。使用存储指令存储数字。 Nios II 汇编在其汇编语言中使用存储字。存储字指令的格式为
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.
我有我的计算机架构作业 class,我们必须在其中实现斐波那契数列程序。它是这样的:
编写一个程序来存储一定数量的斐波那契数列。您唯一应该指定的是要生成的斐波那契数列的最大数字。所有数字都应存储在连续的地址中。例如,如果 n = 8,则序列为 0,1,1,2,3,5,8,13。
对我来说最大的问题是如何将这些数字存储在内存中?
您可以使用存储字指令存储 32 位整数。使用存储指令存储数字。 Nios II 汇编在其汇编语言中使用存储字。存储字指令的格式为
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.