Best bech template for kick start:
--#############################################################################
-- Entity
library ieee;
use ieee.std_logic_1164.all;
entity tb is
end entity;
--#############################################################################
-- Architecture
library ieee;
use ieee.numeric_std.all;
architecture sim of tb is
--===========================================================================
-- Clock and reset decl.
-- Clock
constant CLK_FREQ : real := 100.0E6; -- Clock frequency in Hz
signal clk : std_logic;
-- Reset
constant RST_PER : time := 100 ns; -- Reset period; and then waiting for rising clk edge before deassert rst
signal rst : std_logic;
--===========================================================================
-- Device Under Test (DUT) decl.
signal dut_address : integer range 0 to 15;
signal dut_data_out : std_logic_vector(7 downto 0);
--===========================================================================
-- Test control decl.
-- None
begin
--===========================================================================
-- Clock and reset impl.
-- Clock generation
process is
begin
while true loop
clk <= '1';
wait for 0.5 sec / CLK_FREQ;
clk <= '0';
wait for (1.0 sec / CLK_FREQ) - (0.5 sec / CLK_FREQ);
end loop;
end process;
-- Reset generation
process is
begin
rst <= '1';
wait for RST_PER;
wait until rising_edge(clk);
rst <= '0';
wait;
end process;
--===========================================================================
-- Device Under Test (DUT) impl.
rom_e : entity work.rom
port map(
address => dut_address,
data_out => dut_data_out);
--===========================================================================
-- Test control general
process is
begin
-- Wait for reset release and clock.
wait until rst = '0';
wait until rising_edge(clk);
-- Address apply and data output check
for address in 0 to 15 loop
wait until rising_edge(clk);
dut_address <= address;
wait until rising_edge(clk);
-- Check output of ROM
end loop;
-- Run for a while
wait for 1 us;
-- End of simulation
report "OK ########## Sim end: OK :-) ########## (not actual failure)" severity failure;
wait;
end process;
end architecture;
--#############################################################################
-- EOF