|
|
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
-- Company:
|
-- Company:
|
-- Engineer:
|
-- Engineer:
|
--
|
--
|
-- Create Date: 09:44:54 03/26/2008
|
-- Create Date: 09:44:54 03/26/2008
|
-- Design Name: counter
|
-- Design Name: counter
|
-- Module Name: counter_tb.vhd
|
-- Module Name: counter_tb.vhd
|
-- Project Name: clk_tb
|
-- Project Name: clk_tb
|
-- Target Device:
|
-- Target Device:
|
-- Tool versions:
|
-- Tool versions:
|
-- Description:
|
-- Description:
|
--
|
--
|
-- VHDL Test Bench Created by ISE for module: counter
|
-- VHDL Test Bench Created by ISE for module: counter
|
--
|
--
|
-- Dependencies:
|
-- Dependencies:
|
--
|
--
|
-- Revision:
|
-- Revision:
|
-- Revision 0.01 - File Created
|
-- Revision 0.01 - File Created
|
-- Additional Comments:
|
-- Additional Comments:
|
--
|
--
|
-- Notes:
|
-- Notes:
|
-- This testbench has been automatically generated using types std_logic and
|
-- This testbench has been automatically generated using types std_logic and
|
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
|
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
|
-- that these types always be used for the top-level I/O of a design in order
|
-- that these types always be used for the top-level I/O of a design in order
|
-- to guarantee that the testbench will bind correctly to the post-implementation
|
-- to guarantee that the testbench will bind correctly to the post-implementation
|
-- simulation model.
|
-- simulation model.
|
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
LIBRARY ieee;
|
LIBRARY ieee;
|
USE ieee.std_logic_1164.ALL;
|
USE ieee.std_logic_1164.ALL;
|
USE ieee.numeric_std.ALL;
|
USE ieee.numeric_std.ALL;
|
|
|
ENTITY tlc2_tb IS
|
ENTITY tlc2_tb IS
|
END tlc2_tb;
|
END tlc2_tb;
|
|
|
ARCHITECTURE behavior OF tlc2_tb IS
|
ARCHITECTURE behavior OF tlc2_tb IS
|
|
|
-- Component Declaration for the Unit Under Test (UUT)
|
-- Component Declaration for the Unit Under Test (UUT)
|
COMPONENT tlc2
|
COMPONENT tlc2
|
PORT(
|
PORT(
|
clk : IN std_logic;
|
clk : IN std_logic;
|
rst, j_left, j_right : IN std_logic;
|
rst, j_left, j_right : IN std_logic;
|
led : OUT std_logic_vector(2 downto 0) );
|
led : OUT std_logic_vector(2 downto 0) );
|
END COMPONENT;
|
END COMPONENT;
|
|
|
--Inputs
|
--Inputs
|
SIGNAL clk : std_logic := '0';
|
SIGNAL clk : std_logic := '0';
|
SIGNAL rst : std_logic := '0';
|
SIGNAL rst : std_logic := '0';
|
SIGNAL j_right : std_logic := '1';
|
SIGNAL j_right : std_logic := '1';
|
SIGNAL j_left : std_logic := '1';
|
SIGNAL j_left : std_logic := '1';
|
|
|
--Outputs
|
--Outputs
|
SIGNAL led : std_logic_vector(2 downto 0);
|
SIGNAL led : std_logic_vector(2 downto 0);
|
|
|
BEGIN
|
BEGIN
|
|
|
-- Instantiate the Unit Under Test (UUT)
|
-- Instantiate the Unit Under Test (UUT)
|
uut: tlc2 PORT MAP(
|
uut: tlc2 PORT MAP(
|
clk => clk,
|
clk => clk,
|
rst => rst, j_left => j_left, j_right => j_right,
|
rst => rst, j_left => j_left, j_right => j_right,
|
led => led
|
led => led
|
);
|
);
|
|
|
tb_clk : PROCESS
|
tb_clk : PROCESS
|
BEGIN
|
BEGIN
|
|
|
-- Wait 100 ns for global reset to finish
|
-- Wait 100 ns for global reset to finish
|
--wait for 100 ns;
|
--wait for 100 ns;
|
|
|
clk <= not clk;
|
clk <= not clk;
|
wait for 5 ns;
|
wait for 5 ns;
|
-- Place stimulus here
|
-- Place stimulus here
|
END PROCESS;
|
END PROCESS;
|
|
|
tb_s: PROCESS
|
tb_s: PROCESS
|
BEGIN
|
BEGIN
|
wait for 15 ns;
|
wait for 15 ns;
|
rst <= '0';
|
rst <= '0';
|
wait for 25 ns;
|
wait for 25 ns;
|
rst <= '1';
|
rst <= '1';
|
wait for 15 ns;
|
wait for 15 ns;
|
j_left <= '0';
|
j_left <= '0';
|
wait for 30 ns;
|
wait for 30 ns;
|
j_left <= '1';
|
j_left <= '1';
|
wait for 13000 ns;
|
wait for 13000 ns;
|
j_right <= '0';
|
j_right <= '0';
|
wait for 100 ns;
|
wait for 100 ns;
|
j_right <= '1';
|
j_right <= '1';
|
-- wait for 1000 ns;
|
-- wait for 1000 ns;
|
-- j_left <= '0';
|
-- j_left <= '0';
|
-- wait for 100 ns ;
|
-- wait for 100 ns ;
|
-- j_left <= '1';
|
-- j_left <= '1';
|
-- wait for 1500 ns;
|
-- wait for 1500 ns;
|
-- j_right <= '0';
|
-- j_right <= '0';
|
-- wait for 50 ns;
|
-- wait for 50 ns;
|
--- j_right <= '1';
|
--- j_right <= '1';
|
wait;
|
wait;
|
|
|
END PROCESS;
|
END PROCESS;
|
END;
|
END;
|
|
|