2 use ieee.std_logic_1164.all;
3 use ieee.std_logic_arith.all;
4 use ieee.std_logic_unsigned.all;
6 --------------------------------------------------------------------------------
7 -- General counter which counter width and maximum value can be set by generic
8 -- attributes. When 'count' is equal to MAX value, 'event_ow' is high.
9 --------------------------------------------------------------------------------
17 clk_en : in std_logic;
19 count : out std_logic_vector (WIDTH-1 downto 0);
20 event_ow : out std_logic);
23 --------------------------------------------------------------------------------
25 architecture behavioral of counter is
27 signal eq_max : std_logic; -- cnt is equal to MAX
28 signal cnt : std_logic_vector (WIDTH-1 downto 0) := (others => '0');
30 --------------------------------------------------------------------------------
35 report "MAX is bigger then counter max. value."
40 event_ow <= eq_max and clk_en;
43 COUTER : process (clk, reset) is
45 if rising_edge(clk) then
47 cnt <= (others => '0');
52 cnt <= (others => '0');
62 CNT_EQ_MAX : process (cnt) is
64 if cnt = CONV_STD_LOGIC_VECTOR(MAX, WIDTH) then