3 use ieee.std_logic_1164.all;
4 use ieee.std_logic_unsigned.all;
8 divider : std_logic_vector(31 downto 0) := "00000000001111101111000101001000"
13 nrst_i : in std_logic;
14 led2_o : out std_logic;
15 led3_o : out std_logic;
16 led4_o : out std_logic;
17 led5_o : out std_logic
22 architecture rtl of heartbeat is
25 process(clk_i, nrst_i)
26 variable counter : std_logic_vector(31 downto 0);
27 variable state : std_logic_vector(3 downto 0) := "0001";
28 variable direction : std_logic := '0';
31 if (clk_i'event AND clk_i = '1') then
33 counter := (others => '0');
39 counter := counter + 1;
40 if counter = divider then
41 if state(3) = '1' then
45 if state(0) = '1' then
49 if direction = '0' then
50 state(3 downto 1) := state(2 downto 0);
53 state(2 downto 0) := state(3 downto 1);
56 counter := (others => '0');