blob: 8e303552178ca27ce599635e3103a33780eaf88c (
plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
entity tb_cnt01 is
end tb_cnt01;
library ieee;
use ieee.std_logic_1164.all;
architecture behav of tb_cnt01 is
signal clk : std_logic;
signal rst : std_logic;
signal clr : std_logic;
signal en : std_logic;
signal cnt : std_logic_vector (9 downto 0);
begin
dut: entity work.cnt01
port map (clock => clk, reset => rst, clear_count => clr,
enable => en, counter_out => cnt);
process
procedure pulse is
begin
clk <= '0';
wait for 1 ns;
clk <= '1';
wait for 1 ns;
end pulse;
begin
clk <= '0';
clr <= '0';
en <= '0';
rst <= '1';
wait for 1 ns;
assert cnt = "0000000000" severity failure;
rst <= '0';
pulse;
assert cnt = "0000000000" severity failure;
en <= '1';
pulse;
assert cnt = "0000000001" severity failure;
en <= '0';
pulse;
assert cnt = "0000000001" severity failure;
en <= '1';
pulse;
assert cnt = "0000000010" severity failure;
en <= '1';
pulse;
assert cnt = "0000000011" severity failure;
en <= '1';
clr <= '1';
pulse;
assert cnt = "0000000000" severity failure;
en <= '1';
clr <= '0';
pulse;
assert cnt = "0000000001" severity failure;
wait;
end process;
end behav;
|