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 --------------------------------------------------------------------------------
18 count : out std_logic_vector (WIDTH-1 downto 0);
19 event_ow : out std_logic);
22 --------------------------------------------------------------------------------
24 architecture behavioral of counter is
26 signal eq_max : std_logic; -- cnt is equal to MAX
27 signal cnt : std_logic_vector (WIDTH-1 downto 0);
29 --------------------------------------------------------------------------------
34 report "MAX is bigger then counter max. value."
42 COUTER : process (clk, reset) is
45 cnt <= (others => '0');
47 elsif rising_edge(clk) then
49 cnt <= (others => '0');
57 CNT_EQ_MAX : process (cnt) is
59 if cnt = CONV_STD_LOGIC_VECTOR(MAX, WIDTH) then