-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-latch-w.vhd
67 lines (47 loc) · 1.11 KB
/
test-latch-w.vhd
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
library ieee;
use ieee.std_logic_1164.all;
entity test_latch_w is
generic (N : positive := 4);
end entity;
architecture behavior of test_latch_w is
component latch_w is
generic (N : positive);
port (
I : in std_logic_vector (N-1 downto 0);
O : out std_logic_vector (N-1 downto 0);
E : in std_logic
);
end component;
signal I : std_logic_vector (N-1 downto 0);
signal O : std_logic_vector (N-1 downto 0);
signal E : std_logic;
begin
latch_0: latch_w
generic map (N => N)
port map (I => I, O => O, E => E);
process
variable T : boolean := false;
begin
wait for 10 ms;
I <= (N-1 downto 0 => '0');
wait for 1 ms;
if T = true then assert O = (N-1 downto 0 => '1'); end if;
E <= '1';
wait for 1 ms;
assert O = (N-1 downto 0 => '0');
T := true;
E <= '0';
wait for 1 ms;
assert O = (N-1 downto 0 => '0');
wait for 10 ms;
I <= (N-1 downto 0 => '1');
wait for 1 ms;
assert O = (N-1 downto 0 => '0');
E <= '1';
wait for 1 ms;
assert O = (N-1 downto 0 => '1');
E <= '0';
wait for 1 ms;
assert O = (N-1 downto 0 => '1');
end process;
end architecture;