Skip to content

Latest commit

 

History

History

Day-44

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

In this Verilog code:

  1. We have an always block that is sensitive to the rising edge of the clock (clk) and the rising edge of the reset signal (rst).

  2. Inside the always block, when the reset signal (rst) is asserted, we initialize the Fibonacci sequence with the first two Fibonacci numbers (1 and 1) and reset temporary storage variables.

  3. During normal operation (when not in reset), we update the current Fibonacci number (current) with the next Fibonacci number (next) and calculate the new next value by adding the current value to the previous Fibonacci number (fib_1). We also update the temporary storage variables fib_1 and fib_2.

  4. The fib output wire provides the current Fibonacci number for external use.

Make sure to connect this module to your clock and reset signals appropriately in your larger Verilog design. Additionally, you may need to modify the data width of the fib output and internal variables to suit your specific requirements.