-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdffr_a_test.vhd
64 lines (62 loc) · 1.33 KB
/
dffr_a_test.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
library ieee;
use ieee.std_logic_1164.all;
use work.eecs361.dffr_a;
entity dffr_a_test is
end dffr_a_test;
architecture behavioral of dffr_a_test is
signal clk : std_logic;
signal d : std_logic;
signal q : std_logic;
signal aload : std_logic;
signal arst : std_logic;
signal adata : std_logic;
signal enable : std_logic;
begin
test_comp : dffr_a port map (
clk => clk,
arst => arst,
aload => aload,
adata => adata,
enable => enable,
d => d,
q => q);
testbench : process
begin
clk <= '0';
d <= '0';
enable <= '1';
aload <= '0';
arst <= '0';
wait for 5 ns;
clk <= '1';
wait for 5 ns;
assert q = '0' report "first signal" severity error;
wait for 5 ns;
clk <= '0';
d <= '1';
assert q = '0' report "before second signal" severity error;
wait for 5 ns;
clk <= '1';
wait for 5 ns;
assert q = '1' report "second signal" severity error;
wait for 5 ns;
clk <= '0';
d <= '0';
enable <= '0';
wait for 5 ns;
clk <= '1';
wait for 5 ns;
assert q = '1' report "enable disabled" severity error;
wait for 5 ns;
arst <= '1';
adata <= '1';
aload <= '1';
wait for 5 ns;
assert q = '0' report "arst working" severity error;
wait for 5 ns;
arst <= '0';
wait for 5 ns;
assert q = '1' report "aload working" severity error;
wait;
end process;
end behavioral;