Verilog 实现斐波那契数列
主要学习了for语句的使用(避免相似重复的语句,但实际硬件上还是一样的) 以及memory的用法:
`timescale 1ns / 1ps
module fibonacci(clk,rst_n,seq_out);
input clk;
input rst_n;
output [12:0] seq_out;
reg[12:0] memory [19:0];
reg [4:0] addr;
integer i;
always @(posedge clk ) begin
if (!rst_n) begin
// reset
addr <= 5'b0;