LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.all;
USE ieee.numeric_std.ALL;
ENTITY tb_cnt6 IS
END tb_cnt6;
ARCHITECTURE behavior OF tb_cnt6 IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT cnt6
PORT(
clr : IN std_logic;
en : IN std_logic;
clc : IN std_logic;
q : OUT std_logic_vector(2 downto 0)
);
END COMPONENT;
--Inputs
signal clr : std_logic := '0';
signal en : std_logic := '0';
signal clc : std_logic := '0';
--Outputs
signal q : std_logic_vector(2 downto 0);
constant clk_period :time :=20 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: cnt6 PORT MAP (
clr => clr,
en => en,
clc => clc,
q => q
);
clk_gen:process
begin
wait for clk_period/2;
clc<='1';
wait for clk_period/2;
clc<='0';
end process;
clr_gen:process
begin
clr<='0';
wait for 30 ns;
clr<='1';
wait;
end process;
en_gen:process
begin
en<='0';
wait for 50ns;
en<='1';
wait;
end process;