]> cvs.zerfleddert.de Git - raggedstone/blame - heartbeat/source/heartbeat.vhd
+= heartbeat
[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 (
8 divider : integer := 33000000
9);
10
11port (
12 clk_i : in std_logic;
13 nrst_i : in std_logic;
14 led_o : out std_logic
15);
16
17end heartbeat;
18
19architecture rtl of heartbeat is
20begin
21
22process(clk_i, nrst_i)
23variable counter : std_logic_vector(31 downto 0);
24variable state : std_logic := '0';
25begin
26
27if (clk_i'event AND clk_i = '1') then
28 if nrst_i = '0' then
29 counter := (others => '0');
30 else
31 led_o <= state;
32 counter := counter + 1;
33 if counter = divider then
34 state := not state;
35 end if;
36 end if;
37end if;
38end process;
39end architecture;
Impressum, Datenschutz