1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
entity tb_latches is
end tb_latches;
library ieee;
use ieee.std_logic_1164.all;
architecture behav of tb_latches is
signal g : std_logic;
signal d : std_logic;
signal clr : std_logic;
signal q : std_logic;
begin
dut: entity work.latches
port map (g, d, clr, q);
process
begin
clr <= '1';
g <= '0';
wait for 1 ns;
assert q = '0' severity failure;
clr <= '0';
wait for 1 ns;
assert q = '0' severity failure;
g <= '1';
d <= '1';
wait for 1 ns;
assert q = '1' severity failure;
g <= '0';
d <= '0';
wait for 1 ns;
assert q = '1' severity failure;
g <= '1';
d <= '0';
wait for 1 ns;
assert q = '0' severity failure;
g <= '1';
d <= '1';
wait for 1 ns;
assert q = '1' severity failure;
clr <= '1';
wait for 1 ns;
assert q = '0' severity failure;
wait;
end process;
end behav;
|