@@ -23,7 +23,7 @@ use osvvm.RandomPkg.all;
2323entity tb_axi_stream is
2424 generic (
2525 runner_cfg : string ;
26- g_data_length : positive := 8 ;
26+ g_data_length : natural := 8 ;
2727 g_id_length : natural := 8 ;
2828 g_dest_length : natural := 8 ;
2929 g_user_length : natural := 8 ;
@@ -42,29 +42,31 @@ architecture a of tb_axi_stream is
4242 constant master_axi_stream : axi_stream_master_t := new_axi_stream_master(
4343 data_length => g_data_length, id_length => g_id_length, dest_length => g_dest_length, user_length => g_user_length,
4444 stall_config => master_stall_config, logger => get_logger(" master" ), actor => new_actor(" master" ),
45- monitor => default_axi_stream_monitor, protocol_checker => default_axi_stream_protocol_checker
45+ monitor => default_axi_stream_monitor, protocol_checker => default_axi_stream_protocol_checker,
46+ allow_arbitrary_data_length => g_data_length mod 8 /= 0
4647 );
4748 constant master_stream : stream_master_t := as_stream(master_axi_stream);
4849 constant master_sync : sync_handle_t := as_sync(master_axi_stream);
4950
5051 constant slave_axi_stream : axi_stream_slave_t := new_axi_stream_slave(
5152 data_length => g_data_length, id_length => g_id_length, dest_length => g_dest_length, user_length => g_user_length,
5253 stall_config => slave_stall_config, logger => get_logger(" slave" ), actor => new_actor(" slave" ),
53- monitor => default_axi_stream_monitor, protocol_checker => default_axi_stream_protocol_checker
54+ monitor => default_axi_stream_monitor, protocol_checker => default_axi_stream_protocol_checker,
55+ allow_arbitrary_data_length => g_data_length mod 8 /= 0
5456 );
5557 constant slave_stream : stream_slave_t := as_stream(slave_axi_stream);
5658 constant slave_sync : sync_handle_t := as_sync(slave_axi_stream);
5759
5860 constant monitor : axi_stream_monitor_t := new_axi_stream_monitor(
5961 data_length => g_data_length, id_length => g_id_length, dest_length => g_dest_length, user_length => g_user_length,
6062 logger => get_logger(" monitor" ), actor => new_actor(" monitor" ),
61- protocol_checker => default_axi_stream_protocol_checker
63+ protocol_checker => default_axi_stream_protocol_checker,
64+ allow_arbitrary_data_length => g_data_length mod 8 /= 0
6265 );
6366
6467 constant protocol_checker : axi_stream_protocol_checker_t := new_axi_stream_protocol_checker(
6568 data_length => g_data_length, id_length => g_id_length, dest_length => g_dest_length, user_length => g_user_length,
66- logger => get_logger(" protocol_checker" ),
67- max_waits => 8
69+ logger => get_logger(" protocol_checker" ), max_waits => 8 , allow_arbitrary_data_length => g_data_length mod 8 /= 0
6870 );
6971
7072 constant n_monitors : natural := 3 ;
@@ -75,8 +77,8 @@ architecture a of tb_axi_stream is
7577 signal tready : std_logic ;
7678 signal tdata : std_logic_vector (data_length(slave_axi_stream)- 1 downto 0 );
7779 signal tlast : std_logic ;
78- signal tkeep, tkeep_from_master : std_logic_vector (data_length (slave_axi_stream)/ 8 - 1 downto 0 );
79- signal tstrb, tstrb_from_master : std_logic_vector (data_length (slave_axi_stream)/ 8 - 1 downto 0 );
80+ signal tkeep, tkeep_from_master : std_logic_vector (keep_strb_length (slave_axi_stream)- 1 downto 0 );
81+ signal tstrb, tstrb_from_master : std_logic_vector (keep_strb_length (slave_axi_stream)- 1 downto 0 );
8082 signal tid : std_logic_vector (id_length(slave_axi_stream)- 1 downto 0 );
8183 signal tdest : std_logic_vector (dest_length(slave_axi_stream)- 1 downto 0 );
8284 signal tuser : std_logic_vector (user_length(slave_axi_stream)- 1 downto 0 );
@@ -447,15 +449,21 @@ begin
447449 check_axi_stream(net, slave_axi_stream, not data, tlast => '0' , tkeep => not keep, tstrb => not strb, tid => id, tdest => dest,
448450 tuser => user, msg => " checking axi stream" );
449451
450- check_log(mocklogger, " TDATA mismatch, checking axi stream - Got " &
451- to_nibble_string(data) & " (" & to_string(to_integer (data)) & " ). Expected " &
452- to_nibble_string(not data) & " (" & to_string(to_integer (not data)) & " )." , error );
453- check_log(mocklogger, " TKEEP mismatch, checking axi stream - Got " &
454- to_nibble_string(keep) & " (" & to_string(to_integer (keep)) & " ). Expected " &
455- to_nibble_string(not keep) & " (" & to_string(to_integer (not keep)) & " )." , error );
456- check_log(mocklogger, " TSTRB mismatch, checking axi stream - Got " &
457- to_nibble_string(strb) & " (" & to_string(to_integer (strb)) & " ). Expected " &
458- to_nibble_string(not strb) & " (" & to_string(to_integer (not strb)) & " )." , error );
452+ if data'length > 0 then
453+ check_log(mocklogger, " TDATA mismatch, checking axi stream - Got " &
454+ to_nibble_string(data) & " (" & to_string(to_integer (data)) & " ). Expected " &
455+ to_nibble_string(not data) & " (" & to_string(to_integer (not data)) & " )." , error );
456+ end if ;
457+ if tkeep'length > 0 then
458+ check_log(mocklogger, " TKEEP mismatch, checking axi stream - Got " &
459+ to_nibble_string(keep) & " (" & to_string(to_integer (keep)) & " ). Expected " &
460+ to_nibble_string(not keep) & " (" & to_string(to_integer (not keep)) & " )." , error );
461+ end if ;
462+ if tstrb'length > 0 then
463+ check_log(mocklogger, " TSTRB mismatch, checking axi stream - Got " &
464+ to_nibble_string(strb) & " (" & to_string(to_integer (strb)) & " ). Expected " &
465+ to_nibble_string(not strb) & " (" & to_string(to_integer (not strb)) & " )." , error );
466+ end if ;
459467 check_log(mocklogger, " TLAST mismatch, checking axi stream - Got 1. Expected 0." , error );
460468 if id'length > 0 then
461469 check_log(mocklogger, " TID mismatch, checking axi stream - Got 0010_0010 (34). Expected 0010_0011 (35)." , error );
@@ -586,16 +594,22 @@ begin
586594
587595 wait until rising_edge (aclk) and tvalid = '1' ;
588596 wait for 1 ps ;
589-
590- check_log(mocklogger, " TDATA mismatch, check non-blocking - Got " &
591- to_nibble_string(data) & " (" & to_string(to_integer (data)) & " ). Expected " &
592- to_nibble_string(not data) & " (" & to_string(to_integer (not data)) & " )." , error );
593- check_log(mocklogger, " TKEEP mismatch, check non-blocking - Got " &
594- to_nibble_string(keep) & " (" & to_string(to_integer (keep)) & " ). Expected " &
595- to_nibble_string(not keep) & " (" & to_string(to_integer (not keep)) & " )." , error );
596- check_log(mocklogger, " TSTRB mismatch, check non-blocking - Got " &
597- to_nibble_string(keep) & " (" & to_string(to_integer (keep)) & " ). Expected " &
598- to_nibble_string(not keep) & " (" & to_string(to_integer (not keep)) & " )." , error );
597+
598+ if data'length > 0 then
599+ check_log(mocklogger, " TDATA mismatch, check non-blocking - Got " &
600+ to_nibble_string(data) & " (" & to_string(to_integer (data)) & " ). Expected " &
601+ to_nibble_string(not data) & " (" & to_string(to_integer (not data)) & " )." , error );
602+ end if ;
603+ if tkeep'length > 0 then
604+ check_log(mocklogger, " TKEEP mismatch, check non-blocking - Got " &
605+ to_nibble_string(keep) & " (" & to_string(to_integer (keep)) & " ). Expected " &
606+ to_nibble_string(not keep) & " (" & to_string(to_integer (not keep)) & " )." , error );
607+ end if ;
608+ if tstrb'length > 0 then
609+ check_log(mocklogger, " TSTRB mismatch, check non-blocking - Got " &
610+ to_nibble_string(strb) & " (" & to_string(to_integer (strb)) & " ). Expected " &
611+ to_nibble_string(not strb) & " (" & to_string(to_integer (not strb)) & " )." , error );
612+ end if ;
599613 check_log(mocklogger, " TLAST mismatch, check non-blocking - Got 1. Expected 0." , error );
600614 if id'length > 0 then
601615 check_log(mocklogger, " TID mismatch, check non-blocking - Got 0010_1010 (42). Expected 0010_1100 (44)." , error );
@@ -685,7 +699,7 @@ begin
685699 tkeep <= tkeep_from_master when connected_tkeep else (others => '1' );
686700 tstrb <= tstrb_from_master when connected_tstrb else (others => 'U' );
687701
688- not_valid <= not tvalid;
702+ not_valid <= not tvalid when g_data_length > 0 else '0' ;
689703
690704 not_valid_data <= '1' when is_x (tdata) else '0' ;
691705 check_true(aclk, not_valid, not_valid_data, " Invalid data not X" );
0 commit comments