-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_shuffer_ctrl_tb.vhd
More file actions
93 lines (64 loc) · 2.57 KB
/
data_shuffer_ctrl_tb.vhd
File metadata and controls
93 lines (64 loc) · 2.57 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
86
87
88
89
90
91
92
93
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity data_shuffler_ctrl_tb is
end data_shuffler_ctrl_tb;
architecture TB of data_shuffler_ctrl_tb is
-- Clock period
constant clk_period : time := 10 ns;
-- Generics
constant pulse_length : positive := 1;
-- Ports
signal clk : std_logic := '0';
signal rst : std_logic;
signal en : std_logic := '1';
signal input_valid : std_logic;
signal ds_select : std_logic;
signal sim_done : std_logic := '0';
begin
-- toggle clock
clk <= not clk after clk_period when sim_done = '0' else
clk;
UUT : entity work.data_shuffler_ctrl
generic map(
pulse_length => pulse_length)
port map(
clk => clk,
rst => rst,
en => en,
input_valid => input_valid,
ds_select => ds_select);
process
variable expected_ds_select : std_logic;
begin
rst <= '1';
wait until rising_edge(clk);
rst <= '0';
wait until rising_edge(clk);
input_valid <= '0';
for i in 0 to pulse_length loop
wait until rising_edge(clk);
end loop; -- i
expected_ds_select := '0';
assert ds_select = expected_ds_select report "unexpected value. expected_ds_select = " & std_logic'image(expected_ds_select) & ", ds_select = " & std_logic'image(ds_select);
wait until rising_edge(clk);
input_valid <= '1';
for i in 0 to pulse_length - 1 loop
wait until rising_edge(clk);
end loop; -- i
expected_ds_select := '1';
assert ds_select = expected_ds_select report "unexpected value. expected_ds_select = " & std_logic'image(expected_ds_select) & ", ds_select = " & std_logic'image(ds_select);
for i in 0 to pulse_length - 1 loop
wait until rising_edge(clk);
end loop; -- i
expected_ds_select := '0';
assert ds_select = expected_ds_select report "unexpected value. expected_ds_select = " & std_logic'image(expected_ds_select) & ", ds_select = " & std_logic'image(ds_select);
for i in 0 to pulse_length - 1 loop
wait until rising_edge(clk);
end loop; -- i
expected_ds_select := '1';
assert ds_select = expected_ds_select report "unexpected value. expected_ds_select = " & std_logic'image(expected_ds_select) & ", ds_select = " & std_logic'image(ds_select);
sim_done <= '1';
report "SIMULATION FINISHED!!!";
end process;
end TB;