-- Company: BUSE
-- Engineer: PAVEL SUNKA
-- 
-- Create Date:   8.2.2017
-- Module Name:   UNIVERSAL
-- Project Name:  universal_modul
-- Target Devices: 10M08
-----------------------------         ----------------------------
-- counter s asynchronnim resetem na rising_edge,  specialni counter 
-- s pocitanim do nekonecna!! Prijma se resetovaci signal!!! 
-----------------------------         ----------------------------
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_signed.all;
--	use IEEE.std_logic_signed.all;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
use IEEE.NUMERIC_STD.ALL;

-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity cnt_ren_srst is
	Generic(STOP_B : natural);

	Port(
		SRST     : in  std_logic;
		CLK      : in  std_logic;
		EN       : in  std_logic;
		DAT_O : out std_logic_vector(STOP_B downto 0)
	);
end cnt_ren_srst;

architecture rtl of cnt_ren_srst is
	signal cnt : std_logic_vector(STOP_B downto 0) := (others => '0');

begin

	process(CLK)
	begin
		if rising_edge(CLK) then
			if srst = '1' then
				cnt <= (others => '0');
			elsif EN = '1' then
				cnt <= cnt + 1;
			end if;
		end if;
	end process;

	DAT_O <= cnt;
end rtl;


