Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity Fibonacci is
Port (
clk : in STD_LOGIC;
reset : in STD_LOGIC;
fib_out : out INTEGER_VECTOR(0 to 9)
);
end Fibonacci;
architecture Behavioral of Fibonacci is
signal fib : INTEGER_VECTOR(0 to 9);
begin
process(clk, reset)
begin
if reset = '1' then
fib(0) <= 0;
fib(1) <= 1;
elsif rising_edge(clk) then
for i in 2 to 9 loop
fib(i) <= fib(i-1) + fib(i-2);
end loop;
end if;
end process;
fib_out <= fib;
end Behavioral;Coding works best on desktop or with an external keyboard.