VHDL Module Tesbench template
Here is an example of VHDL module testbech:
-- ----------------------------------------------------------------------------
-- FILE: my_module_tb.vhd
-- DESCRIPTION: Test bech description
-- DATE: Feb 13, 2014
-- AUTHOR(s): Lime Microsystems
-- REVISIONS:
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
-- NOTES:
-- ----------------------------------------------------------------------------
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
-- ----------------------------------------------------------------------------
-- Entity declaration
-- ----------------------------------------------------------------------------
entity my_module_tb is
end my_module_tb;
-- ----------------------------------------------------------------------------
-- Architecture
-- ----------------------------------------------------------------------------
architecture tb_behave of my_module_tb is
constant clk0_period : time := 10 ns;
constant clk1_period : time := 10 ns;
--signals
signal clk0,clk1 : std_logic;
signal reset_n : std_logic;
begin
clock0: process is
begin
clk0 <= '0'; wait for clk0_period/2;
clk0 <= '1'; wait for clk0_period/2;
end process clock0;
clock1: process is
begin
clk1 <= '0'; wait for clk1_period/2;
clk1 <= '1'; wait for clk1_period/2;
end process clock1;
res: process is
begin
reset_n <= '0'; wait for 20 ns;
reset_n <= '1'; wait;
end process res;
-- Design under test
dut0 : entity work.my_module
generic map (
g_DATA_WIDTH => 128
)
port map(
clk => clk0,
reset_n => reset_n,
d => (others=>'1'),
q => open
);
end tb_behave;