--- /dev/null
+library ieee;\r
+use ieee.std_logic_1164.all;\r
+use work.math_pkg.all;\r
+\r
+entity counter is\r
+ generic\r
+ (\r
+ CNT_MAX : integer range 2 to integer'high\r
+ );\r
+ port\r
+ (\r
+ sys_clk : in std_logic;\r
+ sys_res_n : in std_logic;\r
+ clear_cnt : in std_logic;\r
+ cnt : out std_logic_vector(log2c(CNT_MAX) - 1 downto 0)\r
+ );\r
+end entity counter;\r