Skip to content

Commit 6ec1486

Browse files
committed
Add support for non-byte tdata widths in AXI stream VCs.
This is non-standard and must explicitly be enabled. The difference from the standard implementation is with respect to the length of tkeep and tstrb which is calculated as (tdata'length + 7) / 8 rather than tdata'length / 8 .
1 parent 4e30fa1 commit 6ec1486

File tree

9 files changed

+169
-77
lines changed

9 files changed

+169
-77
lines changed

docs/news.d/1127.breaking.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
The AXI stream standard requires tdata to be a multiple of 8 bits. VUnit VCs allowed non-standard widths but the tkeep and tstrb
2+
signals didn't cover the most significant bits beyond the last full byte. For example, if the tdata width was 12 bits, tkeep and tstrb
3+
were one bit corresponding to the least significant byte in tdata. The 4 most significant bits didn't have a corresponding tkeep
4+
bit.
5+
6+
Starting in VUnit v5.0.0-dev2, the check features for AXI stream were updated such that comparison of the actual tdata value with the
7+
expected one, only considers bytes for which tkeep and tstrb are set. As a consequence, the upper bits of non-standard width tdata,
8+
for which there is no tkeep and tstrb bits, were not considered for comparison.
9+
10+
The VCs have now been updated to extend tkeep and tstrb in these cases such that all bits in tdata are considered for comparison.
11+
Since this is a standard violation, non-standard widths must be enabled in the call to the VC constructor (the new function) by setting
12+
the allow_arbitrary_data_length parameter to true. Existing testbenches using non-standard widths will have to be updated.
13+

vunit/vhdl/verification_components/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def gen_avalon_master_tests(obj, *args):
134134
for id_length in [0, 8]:
135135
for dest_length in [0, 8]:
136136
for user_length in [0, 8]:
137-
for data_length in [8, 16]:
137+
for data_length in [0, 3, 8, 11, 16]:
138138
for test in TB_AXI_STREAM.get_tests("*check"):
139139
test.add_config(
140140
name=f"id_l={id_length} dest_l={dest_length} user_l={user_length} data_l={data_length}",
@@ -150,7 +150,7 @@ def gen_avalon_master_tests(obj, *args):
150150

151151
TB_AXI_STREAM_PROTOCOL_CHECKER = LIB.test_bench("tb_axi_stream_protocol_checker")
152152

153-
for data_length in [0, 8, 32]:
153+
for data_length in [0, 3, 8, 11, 32]:
154154
for test in TB_AXI_STREAM_PROTOCOL_CHECKER.get_tests("*passing*tdata*"):
155155
test.add_config(name="data_length=%d" % data_length, generics=dict(data_length=data_length))
156156

vunit/vhdl/verification_components/src/axi_stream_master.vhd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ entity axi_stream_master is
3737
tready : in std_logic := '1';
3838
tdata : out std_logic_vector(data_length(master)-1 downto 0) := (others => '0');
3939
tlast : out std_logic := '0';
40-
tkeep : out std_logic_vector(data_length(master)/8-1 downto 0) := (others => '1');
41-
tstrb : out std_logic_vector(data_length(master)/8-1 downto 0) := (others => '1');
40+
tkeep : out std_logic_vector(keep_strb_length(master)-1 downto 0) := (others => '1');
41+
tstrb : out std_logic_vector(keep_strb_length(master)-1 downto 0) := (others => '1');
4242
tid : out std_logic_vector(id_length(master)-1 downto 0) := (others => '0');
4343
tdest : out std_logic_vector(dest_length(master)-1 downto 0) := (others => '0');
4444
tuser : out std_logic_vector(user_length(master)-1 downto 0) := (others => '0')
@@ -55,8 +55,8 @@ architecture a of axi_stream_master is
5555

5656

5757
procedure drive_invalid_output(signal l_tdata : out std_logic_vector(data_length(master)-1 downto 0);
58-
signal l_tkeep : out std_logic_vector(data_length(master)/8-1 downto 0);
59-
signal l_tstrb : out std_logic_vector(data_length(master)/8-1 downto 0);
58+
signal l_tkeep : out std_logic_vector(keep_strb_length(master)-1 downto 0);
59+
signal l_tstrb : out std_logic_vector(keep_strb_length(master)-1 downto 0);
6060
signal l_tid : out std_logic_vector(id_length(master)-1 downto 0);
6161
signal l_tdest : out std_logic_vector(dest_length(master)-1 downto 0);
6262
signal l_tuser : out std_logic_vector(user_length(master)-1 downto 0))

vunit/vhdl/verification_components/src/axi_stream_monitor.vhd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ entity axi_stream_monitor is
2424
tready : in std_logic := '1';
2525
tdata : in std_logic_vector(data_length(monitor) - 1 downto 0);
2626
tlast : in std_logic := '1';
27-
tkeep : in std_logic_vector(data_length(monitor)/8-1 downto 0) := (others => '1');
28-
tstrb : in std_logic_vector(data_length(monitor)/8-1 downto 0) := (others => 'U');
27+
tkeep : in std_logic_vector(keep_strb_length(monitor)-1 downto 0) := (others => '1');
28+
tstrb : in std_logic_vector(keep_strb_length(monitor)-1 downto 0) := (others => 'U');
2929
tid : in std_logic_vector(id_length(monitor)-1 downto 0) := (others => '0');
3030
tdest : in std_logic_vector(dest_length(monitor)-1 downto 0) := (others => '0');
3131
tuser : in std_logic_vector(user_length(monitor)-1 downto 0) := (others => '0')

0 commit comments

Comments
 (0)