tsfpga VHDL coverage


Directory: generated/vunit_out/preprocessed/
File: generated/vunit_out/preprocessed/fifo/tb_asynchronous_fifo.vhd
Date: 2021-07-26 04:08:16
Exec Total Coverage
Lines: 232 232 100.0%
Branches: 743 965 77.0%

Line Branch Exec Source
1 246 -- -------------------------------------------------------------------------------------------------
2 -- Copyright (c) Lukas Vik. All rights reserved.
3 --
4 -- This file is part of the tsfpga project.
5 -- https://tsfpga.com
6 -- https://gitlab.com/tsfpga/tsfpga
7 -- -------------------------------------------------------------------------------------------------
8
9 library ieee;
10 use ieee.std_logic_1164.all;
11 use ieee.numeric_std.all;
12
13 library osvvm;
14 use osvvm.RandomPkg.all;
15
16 library vunit_lib;
17 use vunit_lib.axi_stream_pkg.all;
18 use vunit_lib.sync_pkg.all;
19 context vunit_lib.com_context;
20 context vunit_lib.vunit_context;
21
22 library common;
23 use common.types_pkg.all;
24
25
26
41/82
✓ Branch 0 taken 41 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 41 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 41 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 41 times.
✗ Branch 10 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 41 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 41 times.
✗ Branch 18 not taken.
✓ Branch 19 taken 41 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 41 times.
✗ Branch 24 not taken.
✓ Branch 25 taken 41 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 41 times.
✗ Branch 30 not taken.
✓ Branch 31 taken 41 times.
✗ Branch 33 not taken.
✓ Branch 34 taken 41 times.
✗ Branch 36 not taken.
✓ Branch 37 taken 41 times.
✗ Branch 39 not taken.
✓ Branch 40 taken 41 times.
✗ Branch 42 not taken.
✓ Branch 43 taken 41 times.
✗ Branch 45 not taken.
✓ Branch 46 taken 41 times.
✗ Branch 48 not taken.
✓ Branch 49 taken 41 times.
✗ Branch 51 not taken.
✓ Branch 52 taken 41 times.
✗ Branch 54 not taken.
✓ Branch 55 taken 41 times.
✗ Branch 57 not taken.
✓ Branch 58 taken 41 times.
✗ Branch 60 not taken.
✓ Branch 61 taken 41 times.
✗ Branch 63 not taken.
✓ Branch 64 taken 41 times.
✗ Branch 66 not taken.
✓ Branch 67 taken 41 times.
✗ Branch 69 not taken.
✓ Branch 70 taken 41 times.
✗ Branch 72 not taken.
✓ Branch 73 taken 41 times.
✗ Branch 75 not taken.
✓ Branch 76 taken 41 times.
✗ Branch 78 not taken.
✓ Branch 79 taken 41 times.
✗ Branch 81 not taken.
✓ Branch 82 taken 41 times.
✗ Branch 84 not taken.
✓ Branch 85 taken 41 times.
✗ Branch 87 not taken.
✓ Branch 88 taken 41 times.
✗ Branch 90 not taken.
✓ Branch 91 taken 41 times.
✗ Branch 93 not taken.
✓ Branch 94 taken 41 times.
✗ Branch 96 not taken.
✓ Branch 97 taken 41 times.
✗ Branch 99 not taken.
✓ Branch 100 taken 41 times.
✗ Branch 102 not taken.
✓ Branch 103 taken 41 times.
✗ Branch 105 not taken.
✓ Branch 106 taken 41 times.
✗ Branch 108 not taken.
✓ Branch 109 taken 41 times.
✗ Branch 111 not taken.
✓ Branch 112 taken 41 times.
✗ Branch 114 not taken.
✓ Branch 115 taken 41 times.
✗ Branch 117 not taken.
✓ Branch 118 taken 41 times.
✓ Branch 120 taken 41 times.
✗ Branch 121 not taken.
451 entity tb_asynchronous_fifo is
27 generic (
28 41 depth : integer;
29
4/6
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 41 times.
✓ Branch 9 taken 328 times.
✓ Branch 10 taken 41 times.
369 read_clock_is_faster : boolean;
30 41 almost_empty_level : natural := 0;
31
5/6
✗ Branch 2 not taken.
✓ Branch 3 taken 41 times.
✓ Branch 11 taken 41 times.
✓ Branch 12 taken 41 times.
✓ Branch 13 taken 41 times.
✓ Branch 14 taken 41 times.
164 almost_full_level : natural := 0;
32
5/6
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
✓ Branch 10 taken 41 times.
✓ Branch 11 taken 41 times.
✓ Branch 12 taken 41 times.
✓ Branch 13 taken 41 times.
123 read_stall_probability_percent : integer := 0;
33
11/16
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
✓ Branch 7 taken 328 times.
✓ Branch 8 taken 41 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 41 times.
✓ Branch 12 taken 328 times.
✓ Branch 13 taken 41 times.
✓ Branch 14 taken 328 times.
✓ Branch 15 taken 41 times.
✓ Branch 18 taken 41 times.
✗ Branch 19 not taken.
✗ Branch 27 not taken.
✓ Branch 28 taken 41 times.
✗ Branch 29 not taken.
✓ Branch 30 taken 41 times.
1066 write_stall_probability_percent : integer := 0;
34
3/6
✓ Branch 2 taken 41 times.
✗ Branch 3 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 41 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 41 times.
82 enable_packet_mode : boolean := false;
35
8/12
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
✓ Branch 10 taken 41 times.
✓ Branch 11 taken 41 times.
✓ Branch 12 taken 41 times.
✓ Branch 13 taken 41 times.
✓ Branch 16 taken 41 times.
✗ Branch 17 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 41 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 41 times.
164 enable_last : boolean := false;
36
5/6
✗ Branch 1 not taken.
✓ Branch 2 taken 41 times.
✓ Branch 10 taken 41 times.
✓ Branch 11 taken 41 times.
✓ Branch 12 taken 41 times.
✓ Branch 13 taken 41 times.
123 enable_drop_packet : boolean := false;
37
3/6
✓ Branch 1 taken 41 times.
✗ Branch 2 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 41 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 41 times.
41 runner_cfg : string
38
3/6
✓ Branch 1 taken 41 times.
✗ Branch 2 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 41 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 41 times.
41 );
39
3/6
✓ Branch 1 taken 41 times.
✗ Branch 2 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 41 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 41 times.
41 end entity;
40
41 architecture tb of tb_asynchronous_fifo is
42
43 41 constant width : integer := 8;
44 41
45 82 signal clk_read, clk_write : std_logic := '0';
46
47 82 signal read_ready, read_valid, read_last : std_logic := '0';
48
8/10
✗ Branch 0 not taken.
✓ Branch 1 taken 41 times.
✓ Branch 6 taken 328 times.
✓ Branch 7 taken 41 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 41 times.
✓ Branch 11 taken 328 times.
✓ Branch 12 taken 41 times.
✓ Branch 13 taken 328 times.
✓ Branch 14 taken 41 times.
1066 signal write_ready, write_valid, write_last : std_logic := '0';
49 1353 signal read_data, write_data : std_logic_vector(width - 1 downto 0) := (others => '0');
50 41
51 41 signal read_level, write_level : integer;
52 41 signal read_almost_empty, write_almost_full : std_logic := '0';
53
54 41 signal drop_packet : std_logic := '0';
55
56 41 signal has_gone_full_times, has_gone_empty_times : integer := 0;
57
58 41 constant read_stall_config : stall_config_t := new_stall_config(
59 stall_probability => real(read_stall_probability_percent) / 100.0,
60 min_stall_cycles => 1,
61
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 41 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 41 times.
41 max_stall_cycles => 4);
62 41 constant read_slave : axi_stream_slave_t := new_axi_stream_slave(
63 data_length => width,
64 stall_config => read_stall_config,
65 protocol_checker => new_axi_stream_protocol_checker(data_length => width,
66 logger => get_logger("read_slave")));
67 41
68 41 constant write_stall_config : stall_config_t := new_stall_config(
69 stall_probability => real(write_stall_probability_percent) / 100.0,
70 41 min_stall_cycles => 1,
71 max_stall_cycles => 4);
72 82 constant write_master : axi_stream_master_t := new_axi_stream_master(
73 41 data_length => width,
74
4/6
✗ Branch 0 not taken.
✓ Branch 1 taken 41 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 41 times.
✓ Branch 8 taken 328 times.
✓ Branch 9 taken 41 times.
369 stall_config => write_stall_config,
75 protocol_checker => new_axi_stream_protocol_checker(data_length => width,
76 41 logger => get_logger("write_master")));
77
78 begin
79
80
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 41 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 41 times.
328 test_runner_watchdog(runner, 2 ms);
81
82 41 clocks : if read_clock_is_faster generate
83 100154 clk_read <= not clk_read after 2 ns;
84 66758 clk_write <= not clk_write after 3 ns;
85 else generate
86 65257 clk_read <= not clk_read after 3 ns;
87 97687 clk_write <= not clk_write after 2 ns;
88 end generate;
89
90
91 ------------------------------------------------------------------------------
92 41 main : process
93
94 41 variable data_queue, last_queue, axi_stream_pop_reference_queue : queue_t := new_queue;
95 205 variable rnd : RandomPType;
96
97
33/34
✓ Branch 0 taken 2237 times.
✓ Branch 1 taken 28749 times.
✓ Branch 2 taken 30942 times.
✓ Branch 3 taken 28749 times.
✓ Branch 4 taken 28749 times.
✓ Branch 5 taken 28749 times.
✓ Branch 6 taken 28749 times.
✓ Branch 7 taken 28749 times.
✓ Branch 8 taken 28749 times.
✓ Branch 9 taken 2237 times.
✓ Branch 10 taken 28057 times.
✓ Branch 11 taken 28098 times.
✓ Branch 12 taken 28057 times.
✓ Branch 13 taken 28057 times.
✓ Branch 14 taken 28057 times.
✓ Branch 15 taken 28057 times.
✓ Branch 16 taken 2237 times.
✓ Branch 17 taken 28057 times.
✓ Branch 18 taken 84171 times.
✓ Branch 19 taken 28057 times.
✓ Branch 20 taken 28057 times.
✓ Branch 21 taken 28057 times.
✓ Branch 22 taken 14992 times.
✓ Branch 23 taken 14992 times.
✓ Branch 24 taken 14992 times.
✓ Branch 25 taken 28057 times.
✓ Branch 26 taken 28057 times.
✓ Branch 27 taken 2237 times.
✓ Branch 28 taken 6714 times.
✓ Branch 29 taken 2237 times.
✓ Branch 30 taken 4474 times.
✓ Branch 31 taken 2237 times.
✓ Branch 32 taken 2237 times.
✗ Branch 33 not taken.
724904 procedure run_test(read_count, write_count : natural; set_last_flag : boolean := true) is
98
2/2
✓ Branch 0 taken 17896 times.
✓ Branch 1 taken 2237 times.
20133 variable data : std_logic_vector(write_data'range);
99 2237 variable last, last_expected : std_logic := '0';
100 2237 variable axi_stream_pop_reference : axi_stream_reference_t;
101 begin
102
2/2
✓ Branch 0 taken 2193 times.
✓ Branch 1 taken 44 times.
2237 for write_idx in 0 to write_count - 1 loop
103
1/2
✓ Branch 2 taken 28749 times.
✗ Branch 3 not taken.
28749 data := rnd.RandSLV(data'length);
104
2/2
✓ Branch 0 taken 2193 times.
✓ Branch 1 taken 26556 times.
28749 last := to_sl(write_idx = write_count - 1 and set_last_flag);
105
106
2/2
✓ Branch 2 taken 2193 times.
✓ Branch 3 taken 28749 times.
59691 push_axi_stream(net, write_master, data, last);
107
108
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 28749 times.
57498 push(data_queue, data);
109
3/4
✗ Branch 2 not taken.
✓ Branch 3 taken 28749 times.
✓ Branch 5 taken 2193 times.
✓ Branch 6 taken 26556 times.
114996 push(last_queue, last);
110 end loop;
111
112 -- Queue up reads in order to get full throughput
113
2/2
✓ Branch 0 taken 57 times.
✓ Branch 1 taken 2180 times.
2237 for read_idx in 0 to read_count - 1 loop
114
2/2
✓ Branch 2 taken 41 times.
✓ Branch 3 taken 28057 times.
56155 pop_axi_stream(net, read_slave, axi_stream_pop_reference);
115 -- We need to keep track of the pop_reference when we read the reply later.
116 -- Hence it is pushed to a queue.
117
3/4
✗ Branch 2 not taken.
✓ Branch 3 taken 28057 times.
✓ Branch 5 taken 57 times.
✓ Branch 6 taken 28000 times.
112228 push(axi_stream_pop_reference_queue, axi_stream_pop_reference);
118 end loop;
119
120
2/2
✓ Branch 0 taken 57 times.
✓ Branch 1 taken 2180 times.
2237 for read_idx in 0 to read_count - 1 loop
121 28057 axi_stream_pop_reference := pop(axi_stream_pop_reference_queue);
122
2/2
✓ Branch 2 taken 56114 times.
✓ Branch 3 taken 28057 times.
112228 await_pop_axi_stream_reply(net, axi_stream_pop_reference, data, last);
123
124
3/6
✗ Branch 4 not taken.
✓ Branch 5 taken 28057 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 28057 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 28057 times.
56114 check_equal(data, pop_std_ulogic_vector(data_queue), "read_idx " & to_string(read_idx), line_num => 124, file_name => "tb_asynchronous_fifo.vhd");
125 28057 last_expected := pop(last_queue);
126
2/2
✓ Branch 0 taken 14992 times.
✓ Branch 1 taken 13065 times.
28057 if enable_last then
127
5/8
✗ Branch 2 not taken.
✓ Branch 3 taken 14992 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14992 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 14992 times.
✓ Branch 17 taken 57 times.
✓ Branch 18 taken 28000 times.
101090 check_equal(last, last_expected, "read_idx " & to_string(read_idx), line_num => 127, file_name => "tb_asynchronous_fifo.vhd");
128 end if;
129 end loop;
130
131
2/2
✓ Branch 4 taken 4477 times.
✓ Branch 5 taken 2237 times.
8951 wait_until_idle(net, as_sync(write_master));
132
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 4474 times.
✓ Branch 6 taken 2237 times.
✓ Branch 7 taken 2237 times.
662079 wait until rising_edge(clk_write);
133 end procedure;
134
135
4/5
✓ Branch 0 taken 41 times.
✓ Branch 1 taken 7296 times.
✓ Branch 2 taken 41 times.
✓ Branch 3 taken 41 times.
✗ Branch 4 not taken.
7419 procedure run_read(count : natural) is
136 begin
137
2/2
✓ Branch 2 taken 7255 times.
✓ Branch 3 taken 41 times.
7419 run_test(count, 0);
138 end procedure;
139
140
4/5
✓ Branch 0 taken 36 times.
✓ Branch 1 taken 216 times.
✓ Branch 2 taken 36 times.
✓ Branch 3 taken 36 times.
✗ Branch 4 not taken.
324 procedure run_write(count : natural) is
141 begin
142
2/2
✓ Branch 2 taken 180 times.
✓ Branch 3 taken 36 times.
324 run_test(0, count);
143 end procedure;
144
145
6/7
✓ Branch 0 taken 20 times.
✓ Branch 1 taken 40 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 40 times.
✓ Branch 4 taken 20 times.
✓ Branch 5 taken 20 times.
✗ Branch 6 not taken.
160 procedure wait_for_read_to_propagate is
146 begin
147
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 40 times.
✓ Branch 6 taken 20 times.
✓ Branch 7 taken 20 times.
80 wait until rising_edge(clk_write);
148
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 40 times.
✓ Branch 6 taken 20 times.
✓ Branch 7 taken 20 times.
120 wait until rising_edge(clk_write);
149 end procedure;
150
151
10/11
✓ Branch 0 taken 33 times.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 33 times.
✓ Branch 3 taken 66 times.
✓ Branch 4 taken 33 times.
✓ Branch 5 taken 66 times.
✓ Branch 6 taken 33 times.
✓ Branch 7 taken 66 times.
✓ Branch 8 taken 33 times.
✓ Branch 9 taken 33 times.
✗ Branch 10 not taken.
442 procedure wait_for_write_to_propagate is
152 begin
153
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 46 times.
✓ Branch 6 taken 33 times.
✓ Branch 7 taken 13 times.
112 wait until rising_edge(clk_read);
154
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 66 times.
✓ Branch 6 taken 33 times.
✓ Branch 7 taken 33 times.
132 wait until rising_edge(clk_read);
155
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 66 times.
✓ Branch 6 taken 33 times.
✓ Branch 7 taken 33 times.
132 wait until rising_edge(clk_read);
156
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 66 times.
✓ Branch 6 taken 33 times.
✓ Branch 7 taken 33 times.
264 wait until rising_edge(clk_read);
157 end procedure;
158
159
2/3
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
16 procedure clear_queue(queue : queue_t) is
160 8 variable dummy : character;
161 begin
162
2/2
✓ Branch 1 taken 10560 times.
✓ Branch 2 taken 8 times.
10568 while not is_empty(queue) loop
163 10576 dummy := unsafe_pop(queue);
164 end loop;
165 end procedure;
166
167
4/5
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
20 procedure pulse_drop_packet is
168 begin
169
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 drop_packet <= '1';
170
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 8 times.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 4 times.
16 wait until rising_edge(clk_write);
171
255/259
✓ Branch 0 taken 41 times.
✓ Branch 1 taken 82 times.
✓ Branch 2 taken 41 times.
✓ Branch 3 taken 41 times.
✓ Branch 4 taken 41 times.
✓ Branch 5 taken 41 times.
✓ Branch 6 taken 41 times.
✓ Branch 7 taken 41 times.
✓ Branch 8 taken 41 times.
✓ Branch 9 taken 41 times.
✓ Branch 10 taken 41 times.
✓ Branch 11 taken 4 times.
✓ Branch 12 taken 4 times.
✓ Branch 13 taken 4 times.
✓ Branch 14 taken 4 times.
✓ Branch 15 taken 4 times.
✓ Branch 16 taken 4 times.
✓ Branch 17 taken 4 times.
✓ Branch 18 taken 4 times.
✓ Branch 19 taken 4 times.
✓ Branch 20 taken 4 times.
✓ Branch 21 taken 4 times.
✓ Branch 22 taken 4 times.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 4 times.
✓ Branch 25 taken 4 times.
✓ Branch 26 taken 4 times.
✓ Branch 27 taken 4 times.
✓ Branch 28 taken 4 times.
✓ Branch 29 taken 4 times.
✓ Branch 30 taken 4 times.
✓ Branch 31 taken 24024 times.
✓ Branch 32 taken 4 times.
✓ Branch 33 taken 4 times.
✓ Branch 34 taken 4 times.
✓ Branch 35 taken 4 times.
✓ Branch 36 taken 4 times.
✓ Branch 37 taken 4 times.
✓ Branch 38 taken 24024 times.
✓ Branch 39 taken 4 times.
✓ Branch 40 taken 4 times.
✓ Branch 41 taken 4 times.
✓ Branch 42 taken 4 times.
✓ Branch 43 taken 4 times.
✓ Branch 44 taken 4 times.
✓ Branch 45 taken 32 times.
✓ Branch 46 taken 4 times.
✓ Branch 47 taken 24 times.
✓ Branch 48 taken 4 times.
✓ Branch 49 taken 34 times.
✓ Branch 50 taken 4 times.
✓ Branch 51 taken 4 times.
✓ Branch 52 taken 4 times.
✓ Branch 53 taken 4 times.
✓ Branch 54 taken 4 times.
✓ Branch 55 taken 24 times.
✓ Branch 56 taken 4 times.
✓ Branch 57 taken 34 times.
✓ Branch 58 taken 4 times.
✓ Branch 59 taken 4 times.
✓ Branch 60 taken 4 times.
✓ Branch 61 taken 12 times.
✓ Branch 62 taken 72 times.
✓ Branch 63 taken 12 times.
✓ Branch 64 taken 12 times.
✓ Branch 65 taken 12 times.
✓ Branch 66 taken 12 times.
✓ Branch 67 taken 4 times.
✓ Branch 68 taken 152 times.
✓ Branch 69 taken 4 times.
✓ Branch 70 taken 4 times.
✓ Branch 71 taken 4 times.
✓ Branch 72 taken 4 times.
✓ Branch 73 taken 4 times.
✓ Branch 74 taken 24 times.
✓ Branch 75 taken 4 times.
✓ Branch 76 taken 34 times.
✓ Branch 77 taken 4 times.
✓ Branch 78 taken 4 times.
✓ Branch 79 taken 4 times.
✓ Branch 80 taken 4 times.
✓ Branch 81 taken 4 times.
✓ Branch 82 taken 24 times.
✓ Branch 83 taken 4 times.
✓ Branch 84 taken 32 times.
✓ Branch 85 taken 4 times.
✓ Branch 86 taken 4 times.
✓ Branch 87 taken 4 times.
✓ Branch 88 taken 4 times.
✓ Branch 89 taken 1056 times.
✓ Branch 90 taken 6336 times.
✓ Branch 91 taken 1056 times.
✓ Branch 92 taken 1056 times.
✓ Branch 93 taken 4 times.
✓ Branch 94 taken 4 times.
✓ Branch 95 taken 4 times.
✓ Branch 96 taken 32 times.
✓ Branch 97 taken 4 times.
✓ Branch 98 taken 4 times.
✓ Branch 99 taken 4 times.
✓ Branch 100 taken 24 times.
✓ Branch 101 taken 4 times.
✓ Branch 102 taken 34 times.
✓ Branch 103 taken 4 times.
✓ Branch 104 taken 4 times.
✓ Branch 105 taken 4 times.
✓ Branch 106 taken 2136 times.
✓ Branch 107 taken 4 times.
✓ Branch 108 taken 4 times.
✓ Branch 109 taken 4 times.
✓ Branch 110 taken 1056 times.
✓ Branch 111 taken 6336 times.
✓ Branch 112 taken 1056 times.
✓ Branch 113 taken 1056 times.
✓ Branch 114 taken 4 times.
✓ Branch 115 taken 4 times.
✓ Branch 116 taken 4 times.
✓ Branch 117 taken 2128 times.
✓ Branch 118 taken 4 times.
✓ Branch 119 taken 4 times.
✓ Branch 120 taken 4 times.
✓ Branch 121 taken 32 times.
✓ Branch 122 taken 4 times.
✓ Branch 123 taken 4 times.
✓ Branch 124 taken 4 times.
✓ Branch 125 taken 2 times.
✓ Branch 126 taken 12 times.
✓ Branch 127 taken 2 times.
✓ Branch 128 taken 12 times.
✓ Branch 129 taken 2 times.
✓ Branch 130 taken 12 times.
✓ Branch 131 taken 2 times.
✓ Branch 132 taken 17 times.
✓ Branch 133 taken 2 times.
✓ Branch 134 taken 2 times.
✓ Branch 135 taken 2 times.
✓ Branch 136 taken 4 times.
✓ Branch 137 taken 1080 times.
✓ Branch 138 taken 4 times.
✓ Branch 139 taken 20 times.
✓ Branch 140 taken 4 times.
✓ Branch 141 taken 4 times.
✓ Branch 142 taken 4 times.
✓ Branch 143 taken 24 times.
✓ Branch 144 taken 4 times.
✓ Branch 145 taken 12 times.
✓ Branch 146 taken 4 times.
✓ Branch 147 taken 552 times.
✓ Branch 148 taken 4 times.
✓ Branch 149 taken 20 times.
✓ Branch 150 taken 4 times.
✓ Branch 151 taken 4 times.
✓ Branch 152 taken 4 times.
✓ Branch 153 taken 4 times.
✓ Branch 154 taken 4 times.
✓ Branch 155 taken 4 times.
✓ Branch 156 taken 4 times.
✓ Branch 157 taken 4 times.
✓ Branch 158 taken 4 times.
✓ Branch 159 taken 24 times.
✓ Branch 160 taken 4 times.
✓ Branch 161 taken 4 times.
✓ Branch 162 taken 4 times.
✓ Branch 163 taken 56 times.
✓ Branch 164 taken 4 times.
✓ Branch 165 taken 4 times.
✓ Branch 166 taken 4 times.
✓ Branch 167 taken 20 times.
✓ Branch 168 taken 4 times.
✓ Branch 169 taken 4 times.
✓ Branch 170 taken 4 times.
✓ Branch 171 taken 2 times.
✓ Branch 172 taken 2 times.
✓ Branch 173 taken 2 times.
✓ Branch 174 taken 4 times.
✓ Branch 175 taken 2 times.
✓ Branch 176 taken 2 times.
✓ Branch 177 taken 2 times.
✓ Branch 178 taken 2 times.
✓ Branch 179 taken 2 times.
✓ Branch 180 taken 4 times.
✓ Branch 181 taken 2 times.
✓ Branch 182 taken 4 times.
✓ Branch 183 taken 2 times.
✓ Branch 184 taken 2 times.
✓ Branch 185 taken 2 times.
✓ Branch 186 taken 2 times.
✓ Branch 187 taken 2 times.
✓ Branch 188 taken 4 times.
✓ Branch 189 taken 2 times.
✓ Branch 190 taken 2 times.
✓ Branch 191 taken 2 times.
✓ Branch 192 taken 16 times.
✓ Branch 193 taken 2 times.
✓ Branch 194 taken 2 times.
✓ Branch 195 taken 2 times.
✓ Branch 196 taken 4 times.
✓ Branch 197 taken 4 times.
✓ Branch 198 taken 4 times.
✓ Branch 199 taken 4 times.
✓ Branch 200 taken 4 times.
✓ Branch 201 taken 24 times.
✓ Branch 202 taken 4 times.
✓ Branch 203 taken 4 times.
✓ Branch 204 taken 4 times.
✓ Branch 205 taken 33 times.
✓ Branch 206 taken 4 times.
✓ Branch 207 taken 4 times.
✓ Branch 208 taken 4 times.
✓ Branch 209 taken 2136 times.
✓ Branch 210 taken 4 times.
✓ Branch 211 taken 4 times.
✓ Branch 212 taken 4 times.
✓ Branch 213 taken 20 times.
✓ Branch 214 taken 4 times.
✓ Branch 215 taken 4 times.
✓ Branch 216 taken 4 times.
✓ Branch 217 taken 4 times.
✓ Branch 218 taken 4 times.
✓ Branch 219 taken 4 times.
✓ Branch 220 taken 24 times.
✓ Branch 221 taken 4 times.
✓ Branch 222 taken 4 times.
✓ Branch 223 taken 4 times.
✓ Branch 224 taken 24 times.
✓ Branch 225 taken 4 times.
✓ Branch 226 taken 4 times.
✓ Branch 227 taken 4 times.
✓ Branch 228 taken 32 times.
✓ Branch 229 taken 4 times.
✓ Branch 230 taken 20 times.
✓ Branch 231 taken 4 times.
✓ Branch 232 taken 4 times.
✓ Branch 233 taken 4 times.
✓ Branch 234 taken 5 times.
✓ Branch 235 taken 5 times.
✓ Branch 236 taken 5 times.
✓ Branch 237 taken 30 times.
✓ Branch 238 taken 5 times.
✓ Branch 239 taken 5 times.
✓ Branch 240 taken 5 times.
✓ Branch 241 taken 30 times.
✓ Branch 242 taken 5 times.
✓ Branch 243 taken 43 times.
✓ Branch 244 taken 5 times.
✓ Branch 245 taken 5 times.
✓ Branch 246 taken 5 times.
✓ Branch 247 taken 40 times.
✓ Branch 248 taken 5 times.
✓ Branch 249 taken 5 times.
✓ Branch 250 taken 5 times.
✓ Branch 251 taken 41 times.
✓ Branch 252 taken 164 times.
✗ Branch 253 not taken.
✗ Branch 254 not taken.
✗ Branch 255 not taken.
✓ Branch 256 taken 4 times.
✓ Branch 257 taken 4 times.
✗ Branch 258 not taken.
77717 drop_packet <= '0';
172 end procedure;
173
174 begin
175
2/2
✓ Branch 2 taken 41 times.
✓ Branch 3 taken 41 times.
123 test_runner_setup(runner, runner_cfg);
176
1/2
✗ Branch 6 not taken.
✓ Branch 7 taken 41 times.
82 rnd.InitSeed(rnd'instance_name);
177
178 -- Decrease noise
179
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 41 times.
82 disable(get_logger("read_slave:rule 4"), warning);
180
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 41 times.
82 disable(get_logger("write_master:rule 4"), warning);
181 -- Some tests leave data unread in the FIFO
182
1/2
✗ Branch 4 not taken.
✓ Branch 5 taken 41 times.
82 disable(get_logger("read_slave:rule 9"), error);
183
184
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 37 times.
41 if run("test_init_state") then
185
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
8 check_equal(read_valid, '0', line_num => 185, file_name => "tb_asynchronous_fifo.vhd");
186
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_ready, '1', line_num => 186, file_name => "tb_asynchronous_fifo.vhd");
187
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_almost_full, '0', line_num => 187, file_name => "tb_asynchronous_fifo.vhd");
188
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_almost_empty, '1', line_num => 188, file_name => "tb_asynchronous_fifo.vhd");
189
1/10
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
12 wait until read_valid'event or write_ready'event or write_almost_full'event or read_almost_empty'event for 1 us;
190
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, '0', line_num => 190, file_name => "tb_asynchronous_fifo.vhd");
191
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_ready, '1', line_num => 191, file_name => "tb_asynchronous_fifo.vhd");
192
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_almost_full, '0', line_num => 192, file_name => "tb_asynchronous_fifo.vhd");
193
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
12 check_equal(read_almost_empty, '1', line_num => 193, file_name => "tb_asynchronous_fifo.vhd");
194
195
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 33 times.
37 elsif run("test_write_faster_than_read") then
196
2/2
✓ Branch 2 taken 24020 times.
✓ Branch 3 taken 4 times.
24028 run_test(3000, 3000);
197
3/6
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 4 times.
8 check_relation(has_gone_full_times > 200, line_num => 197, file_name => "tb_asynchronous_fifo.vhd", context_msg => "Expected has_gone_full_times > 200. Left is " & to_string(has_gone_full_times) & ". Right is " & to_string(200) & ".");
198
3/6
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4 times.
12 check_true(is_empty(data_queue), line_num => 198, file_name => "tb_asynchronous_fifo.vhd");
199
200
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 29 times.
33 elsif run("test_read_faster_than_write") then
201
2/2
✓ Branch 2 taken 24020 times.
✓ Branch 3 taken 4 times.
24028 run_test(3000, 3000);
202
3/6
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 4 times.
8 check_relation(has_gone_empty_times > 200, line_num => 202, file_name => "tb_asynchronous_fifo.vhd", context_msg => "Expected has_gone_empty_times > 200. Left is " & to_string(has_gone_empty_times) & ". Right is " & to_string(200) & ".");
203
3/6
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 4 times.
12 check_true(is_empty(data_queue), line_num => 203, file_name => "tb_asynchronous_fifo.vhd");
204
205
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 25 times.
29 elsif run("test_packet_mode") then
206 -- Write and immediately read a small packet
207
2/2
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 4 times.
36 run_test(read_count=>1, write_count=>1);
208
209 -- Write a few words, without setting last
210
2/2
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 4 times.
28 run_test(read_count=>0, write_count=>3, set_last_flag=>false);
211
2/2
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 4 times.
38 wait_for_write_to_propagate;
212
3/6
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 4 times.
8 check_relation(read_level > 0, line_num => 212, file_name => "tb_asynchronous_fifo.vhd", context_msg => "Expected read_level > 0. Left is " & to_string(read_level) & ". Right is " & to_string(0) & ".");
213
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, False, line_num => 213, file_name => "tb_asynchronous_fifo.vhd");
214
215 -- Writing another word, with last set, shall enable read valid
216
2/2
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 4 times.
28 run_test(read_count=>0, write_count=>1);
217
2/2
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 4 times.
38 wait_for_write_to_propagate;
218
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, True, line_num => 218, file_name => "tb_asynchronous_fifo.vhd");
219
220 -- Write further packets
221
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 for i in 1 to 3 loop
222
2/2
✓ Branch 2 taken 60 times.
✓ Branch 3 taken 12 times.
84 run_test(read_count=>0, write_count=>4);
223
3/4
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 8 times.
48 check_equal(read_valid, True, line_num => 223, file_name => "tb_asynchronous_fifo.vhd");
224 end loop;
225
226 -- Read and check all the packets (will only work if read_valid is set properly)
227
2/2
✓ Branch 2 taken 148 times.
✓ Branch 3 taken 4 times.
156 run_read(4 * 4);
228
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, False, line_num => 228, file_name => "tb_asynchronous_fifo.vhd");
229
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_level, 0, line_num => 229, file_name => "tb_asynchronous_fifo.vhd");
230
231 -- Write a few words, without setting last
232
2/2
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 4 times.
28 run_test(read_count=>0, write_count=>3, set_last_flag=>false);
233
2/2
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 4 times.
38 wait_for_write_to_propagate;
234
3/6
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 4 times.
8 check_relation(read_level > 0, line_num => 234, file_name => "tb_asynchronous_fifo.vhd", context_msg => "Expected read_level > 0. Left is " & to_string(read_level) & ". Right is " & to_string(0) & ".");
235
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, False, line_num => 235, file_name => "tb_asynchronous_fifo.vhd");
236
237 -- Writing another word, with last set, shall enable read valid
238
2/2
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 4 times.
28 run_test(read_count=>0, write_count=>1);
239
2/2
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 4 times.
36 wait_for_write_to_propagate;
240
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
12 check_equal(read_valid, True, line_num => 240, file_name => "tb_asynchronous_fifo.vhd");
241
242
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 21 times.
25 elsif run("test_packet_mode_deep") then
243 -- Show that the FIFO can be filled with lasts and that the last counters can wrap around.
244
245 -- Fill the FIFO with lasts
246
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 for i in 1 to depth loop
247
4/4
✓ Branch 2 taken 5280 times.
✓ Branch 3 taken 1056 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 1052 times.
9504 run_test(read_count=>0, write_count=>1, set_last_flag=>true);
248 end loop;
249
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, True, line_num => 249, file_name => "tb_asynchronous_fifo.vhd");
250
251
2/2
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 4 times.
36 run_read(1);
252
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, True, line_num => 252, file_name => "tb_asynchronous_fifo.vhd");
253
254
2/2
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 4 times.
28 run_write(1);
255
2/2
✓ Branch 2 taken 30 times.
✓ Branch 3 taken 4 times.
38 wait_for_write_to_propagate;
256
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, True, line_num => 256, file_name => "tb_asynchronous_fifo.vhd");
257
258
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 2132 times.
✓ Branch 6 taken 4 times.
2140 run_read(depth);
259
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, False, line_num => 259, file_name => "tb_asynchronous_fifo.vhd");
260
261 -- Fill the FIFO with lasts again, making the write counter wrap around
262
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 for i in 1 to depth loop
263
4/4
✓ Branch 2 taken 5280 times.
✓ Branch 3 taken 1056 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 1052 times.
9504 run_test(read_count=>0, write_count=>1, set_last_flag=>true);
264 end loop;
265
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, True, line_num => 265, file_name => "tb_asynchronous_fifo.vhd");
266
267
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 2124 times.
✓ Branch 6 taken 4 times.
2132 run_read(depth - 1);
268
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, True, line_num => 268, file_name => "tb_asynchronous_fifo.vhd");
269
270
2/2
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 4 times.
36 run_read(1);
271
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
12 check_equal(read_valid, False, line_num => 271, file_name => "tb_asynchronous_fifo.vhd");
272
273
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 19 times.
21 elsif run("test_drop_packet_mode_read_level_should_be_zero") then
274 -- Write a couple of packets
275
2/2
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 2 times.
14 run_write(4);
276
2/2
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 2 times.
14 run_write(4);
277
2/2
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 2 times.
14 run_write(4);
278
2/2
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 2 times.
19 wait_for_write_to_propagate;
279
280
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
6 check_equal(read_level, 0, line_num => 280, file_name => "tb_asynchronous_fifo.vhd");
281
282
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 15 times.
19 elsif run("test_drop_packet_random_data") then
283 -- Write and read some data, to make the pointers advance a little.
284 -- Note that this will set write_last on the last write, and some data will be left unread.
285
4/6
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✓ Branch 8 taken 1076 times.
✓ Branch 9 taken 4 times.
1084 run_test(read_count=>depth / 2, write_count=>depth * 3 / 4);
286
2/2
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 4 times.
24 wait_for_read_to_propagate;
287
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_level, depth / 4, line_num => 287, file_name => "tb_asynchronous_fifo.vhd");
288
289 -- Write some data without setting last, simulating a packet in progress.
290 -- Drop the packet, and then read out the remainder of the previous packet.
291 -- Note that the counts chosen will make the pointers wraparound.
292
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 4 times.
28 run_test(read_count=>0, write_count=>depth / 2, set_last_flag=>false);
293
2/2
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 4 times.
16 pulse_drop_packet;
294
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 548 times.
✓ Branch 6 taken 4 times.
556 run_read(depth / 4);
295
296
2/2
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 4 times.
24 wait_for_read_to_propagate;
297
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, '0', line_num => 297, file_name => "tb_asynchronous_fifo.vhd");
298
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_level, 0, line_num => 298, file_name => "tb_asynchronous_fifo.vhd");
299
300 -- Clear the data in the reference queues. This will be the data that was written, and then
301 -- cleared. Hence it was never read and therefore the data is left in the queues.
302
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 clear_queue(data_queue);
303
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 clear_queue(last_queue);
304
305 -- Write and verify a packet. Should be the only thing remaining in the FIFO.
306
2/2
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 4 times.
28 run_write(4);
307
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_level, 4, line_num => 307, file_name => "tb_asynchronous_fifo.vhd");
308
309
2/2
✓ Branch 2 taken 52 times.
✓ Branch 3 taken 4 times.
60 run_read(4);
310
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_valid, '0', line_num => 310, file_name => "tb_asynchronous_fifo.vhd");
311
2/2
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 4 times.
24 wait_for_read_to_propagate;
312
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
12 check_equal(write_level, 0, line_num => 312, file_name => "tb_asynchronous_fifo.vhd");
313
314
2/2
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 13 times.
15 elsif run("test_drop_packet_in_same_cycle_as_write_last_should_drop_the_packet") then
315
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
4 check_equal(write_level, 0, line_num => 315, file_name => "tb_asynchronous_fifo.vhd");
316
317
2/2
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
6 push_axi_stream(net, write_master, tdata=>x"00", tlast=>'0');
318
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
4 push_axi_stream(net, write_master, tdata=>x"00", tlast=>'1');
319
320 -- Time the behavior of the AXI-Stream master. Appears to be a one cycle delay.
321
2/4
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
6 wait until rising_edge(clk_write);
322
323 -- The first write happens at this rising edge.
324
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 2 times.
8 wait until rising_edge(clk_write);
325
326 -- Set drop signal on same cycle as the "last" write
327
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
2 drop_packet <= '1';
328
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 2 times.
8 wait until rising_edge(clk_write);
329
330
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
4 check_equal(write_level, 1, line_num => 330, file_name => "tb_asynchronous_fifo.vhd");
331
1/2
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
4 check_equal(write_ready and write_valid and write_last and drop_packet, '1', line_num => 331, file_name => "tb_asynchronous_fifo.vhd");
332
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 2 times.
8 wait until rising_edge(clk_write);
333
334 -- Make sure the packet was dropped
335
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
4 check_equal(write_level, 0, line_num => 335, file_name => "tb_asynchronous_fifo.vhd");
336
2/2
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 2 times.
18 wait_for_write_to_propagate;
337
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
6 check_equal(read_valid, '0', line_num => 337, file_name => "tb_asynchronous_fifo.vhd");
338
339
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 9 times.
13 elsif run("test_levels_full_range") then
340 -- Check empty status
341
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_level, 0, line_num => 341, file_name => "tb_asynchronous_fifo.vhd");
342
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_level, 0, line_num => 342, file_name => "tb_asynchronous_fifo.vhd");
343
344 -- Fill the FIFO
345
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 4 times.
28 run_write(depth);
346
347 -- Check full status. Must wait a while before all writes have propagated to read side.
348
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_level, depth, line_num => 348, file_name => "tb_asynchronous_fifo.vhd");
349
2/2
✓ Branch 2 taken 29 times.
✓ Branch 3 taken 4 times.
37 wait_for_write_to_propagate;
350
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_level, depth, line_num => 350, file_name => "tb_asynchronous_fifo.vhd");
351
352 -- Empty the FIFO
353
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 2132 times.
✓ Branch 6 taken 4 times.
2140 run_read(depth);
354
355 -- Check empty status. Must wait a while before all reads have propagated to write side.
356
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(read_level, 0, line_num => 356, file_name => "tb_asynchronous_fifo.vhd");
357
2/2
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 4 times.
24 wait_for_read_to_propagate;
358
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
12 check_equal(write_level, 0, line_num => 358, file_name => "tb_asynchronous_fifo.vhd");
359
360
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 5 times.
9 elsif run("test_write_almost_full") then
361
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_almost_full, '0', line_num => 361, file_name => "tb_asynchronous_fifo.vhd");
362
363
3/4
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 4 times.
28 run_write(almost_full_level - 1);
364
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_almost_full, '0', line_num => 364, file_name => "tb_asynchronous_fifo.vhd");
365
366
2/2
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 4 times.
28 run_write(1);
367
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
8 check_equal(write_almost_full, '1', line_num => 367, file_name => "tb_asynchronous_fifo.vhd");
368
369
2/2
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 4 times.
36 run_read(1);
370
2/2
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 4 times.
24 wait_for_read_to_propagate;
371
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
12 check_equal(write_almost_full, '0', line_num => 371, file_name => "tb_asynchronous_fifo.vhd");
372
373
1/2
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
45 elsif run("test_read_almost_empty") then
374
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
10 check_equal(read_almost_empty, '1', line_num => 374, file_name => "tb_asynchronous_fifo.vhd");
375
376
2/2
✓ Branch 2 taken 25 times.
✓ Branch 3 taken 5 times.
35 run_write(almost_empty_level);
377
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
10 check_equal(read_almost_empty, '1', line_num => 377, file_name => "tb_asynchronous_fifo.vhd");
378
379
2/2
✓ Branch 2 taken 25 times.
✓ Branch 3 taken 5 times.
35 run_write(1);
380
2/2
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 5 times.
48 wait_for_write_to_propagate;
381
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
10 check_equal(read_almost_empty, '0', line_num => 381, file_name => "tb_asynchronous_fifo.vhd");
382
383
2/2
✓ Branch 2 taken 35 times.
✓ Branch 3 taken 5 times.
45 run_read(1);
384
1/2
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
15 check_equal(read_almost_empty, '1', line_num => 384, file_name => "tb_asynchronous_fifo.vhd");
385 end if;
386
387
4/6
✓ Branch 0 taken 82633 times.
✓ Branch 1 taken 165165 times.
✓ Branch 2 taken 82592 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 123 times.
✗ Branch 7 not taken.
340403 test_runner_cleanup(runner, allow_disabled_errors=>true);
388 end process;
389
390
391 ------------------------------------------------------------------------------
392 41 read_status_tracking : process
393 41 variable read_transaction : std_logic := '0';
394 begin
395
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 165165 times.
✓ Branch 6 taken 82592 times.
✓ Branch 7 taken 82573 times.
330390 wait until rising_edge(clk_read);
396
397 -- If there was a read transaction last clock cycle, and we now want to read but there is no data available.
398
2/2
✓ Branch 4 taken 9480 times.
✓ Branch 5 taken 73112 times.
82592 if read_transaction and read_ready and not read_valid then
399
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 9480 times.
✓ Branch 2 taken 9480 times.
✗ Branch 3 not taken.
9480 has_gone_empty_times <= has_gone_empty_times + 1;
400 end if;
401
402
3/4
✓ Branch 0 taken 82240 times.
✓ Branch 1 taken 164363 times.
✓ Branch 2 taken 82199 times.
✗ Branch 3 not taken.
493986 read_transaction := read_ready and read_valid;
403 end process;
404
405
406 ------------------------------------------------------------------------------
407 41 write_status_tracking : process
408 41 variable write_transaction : std_logic := '0';
409 begin
410
3/4
✗ Branch 3 not taken.
✓ Branch 4 taken 164363 times.
✓ Branch 6 taken 82199 times.
✓ Branch 7 taken 82164 times.
328802 wait until rising_edge(clk_write);
411
412 -- If there was a write transaction last clock cycle, and we now want to write but the fifo is full.
413
2/2
✓ Branch 4 taken 8019 times.
✓ Branch 5 taken 74180 times.
82199 if write_transaction and write_valid and not write_ready then
414
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 8019 times.
✓ Branch 2 taken 8019 times.
✗ Branch 3 not taken.
8019 has_gone_full_times <= has_gone_full_times + 1;
415 end if;
416
417 164398 write_transaction := write_ready and write_valid;
418 end process;
419
420
421 ------------------------------------------------------------------------------
422 41 axi_stream_slave_inst : entity vunit_lib.axi_stream_slave
423 generic map(
424 slave => read_slave
425 )
426 port map(
427 aclk => clk_read,
428 tvalid => read_valid,
429 tready => read_ready,
430 tdata => read_data,
431 tlast => read_last
432 );
433
434
435 ------------------------------------------------------------------------------
436 41 axi_stream_master_inst : entity vunit_lib.axi_stream_master
437 generic map(
438 master => write_master)
439 port map(
440 aclk => clk_write,
441 tvalid => write_valid,
442 tready => write_ready,
443 tdata => write_data,
444 tlast => write_last
445 );
446
447
448 ------------------------------------------------------------------------------
449
5/10
✗ Branch 3 not taken.
✓ Branch 4 taken 41 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 41 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 41 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 41 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 41 times.
82 dut : entity work.asynchronous_fifo
450 generic map (
451 width => width,
452 depth => depth,
453 almost_full_level => almost_full_level,
454 almost_empty_level => almost_empty_level,
455 enable_packet_mode => enable_packet_mode,
456 enable_last => enable_last,
457 enable_drop_packet => enable_drop_packet
458 )
459 port map (
460 clk_read => clk_read,
461 read_ready => read_ready,
462 read_valid => read_valid,
463 read_data => read_data,
464 read_last => read_last,
465 --
466 read_level => read_level,
467 read_almost_empty => read_almost_empty,
468 --
469 clk_write => clk_write,
470 write_ready => write_ready,
471 write_valid => write_valid,
472 write_data => write_data,
473 write_last => write_last,
474 --
475 write_level => write_level,
476 write_almost_full => write_almost_full,
477 --
478 drop_packet => drop_packet
479 );
480
481 end architecture;
482