-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-latch-sre.vhd
More file actions
85 lines (67 loc) · 1.31 KB
/
test-latch-sre.vhd
File metadata and controls
85 lines (67 loc) · 1.31 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
library ieee;
use ieee.std_logic_1164.all;
entity test_latch_sre is
end entity;
architecture behavior of test_latch_sre is
component latch_sre is
port (
S : in std_logic;
R : in std_logic;
E : in std_logic;
Q : out std_logic;
NQ : out std_logic
);
end component;
signal S : std_logic;
signal R : std_logic;
signal E : std_logic;
signal Q : std_logic;
signal NQ : std_logic;
begin
latch_0: latch_sre port map (S => S, R => R, E => E, Q => Q, NQ => NQ);
process
variable T : boolean := false;
begin
wait for 10 ms;
E <= '0';
wait for 10 ms;
if T = true then assert Q = '0'; end if;
S <= '1';
wait for 1 ms;
if T = true then assert Q = '0'; end if;
S <= '0';
wait for 10 ms;
if T = true then assert Q = '0'; end if;
E <= '1';
wait for 10 ms;
if T = true then assert Q = '0'; end if;
S <= '1';
wait for 1 ms;
assert Q = '1';
T := true; -- initialized
S <= '0';
wait for 1 ms;
assert Q = '1';
wait for 10 ms;
assert Q = '1';
E <= '0';
wait for 10 ms;
assert Q = '1';
R <= '1';
wait for 1 ms;
assert Q = '1';
R <= '0';
wait for 10 ms;
assert Q = '1';
E <= '1';
wait for 10 ms;
assert Q = '1';
R <= '1';
wait for 1 ms;
assert Q = '0';
R <= '0';
wait for 1 ms;
assert Q = '0';
wait for 10 ms;
end process;
end architecture;