]> cvs.zerfleddert.de Git - raggedstone/blame - heartbeat/source/heartbeat.vhd
give LED's more sensible names
[raggedstone] / heartbeat / source / heartbeat.vhd
CommitLineData
152884e6 1library ieee;
2
3use ieee.std_logic_1164.all;
4use ieee.std_logic_unsigned.all;
5
6entity heartbeat is
7generic (
82cc0f36 8 divider : std_logic_vector(31 downto 0) := X"01F78A40"
152884e6 9);
10
11port (
12 clk_i : in std_logic;
13 nrst_i : in std_logic;
f7be0147 14 led2_o : out std_logic;
15 led3_o : out std_logic;
16 led4_o : out std_logic;
17 led5_o : out std_logic
152884e6 18);
19
20end heartbeat;
21
22architecture rtl of heartbeat is
23begin
24
25process(clk_i, nrst_i)
26variable counter : std_logic_vector(31 downto 0);
27variable state : std_logic := '0';
28begin
29
30if (clk_i'event AND clk_i = '1') then
31 if nrst_i = '0' then
32 counter := (others => '0');
33 else
f7be0147 34 led5_o <= state;
35 led2_o <= state;
36 led4_o <= not state;
37 led3_o <= not state;
152884e6 38 counter := counter + 1;
39 if counter = divider then
40 state := not state;
82cc0f36 41 counter := (others => '0');
152884e6 42 end if;
43 end if;
44end if;
45end process;
46end architecture;
Impressum, Datenschutz