Skip to content

Commit

Permalink
Add a test for X data in the AXI stream protocol.
Browse files Browse the repository at this point in the history
This test checks that no errors are reported for
tdata bytes that are masked by tkeep if allow_x_in_null_bytes is set.
  • Loading branch information
bewimm committed Feb 28, 2022
1 parent 97972c2 commit 31b7024
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vunit/vhdl/verification_components/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def gen_avalon_master_tests(obj, *args):

TB_AXI_STREAM_PROTOCOL_CHECKER = LIB.test_bench("tb_axi_stream_protocol_checker")

for data_length in [0, 8]:
for data_length in [0, 8, 32]:
for test in TB_AXI_STREAM_PROTOCOL_CHECKER.get_tests("*passing*tdata*"):
test.add_config(name="data_length=%d" % data_length, generics=dict(data_length=data_length))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ architecture a of tb_axi_stream_protocol_checker is
constant logger : logger_t := get_logger("protocol_checker");
constant protocol_checker : axi_stream_protocol_checker_t := new_axi_stream_protocol_checker(
data_length => tdata'length, id_length => tid'length, dest_length => tdest'length, user_length => tuser'length,
logger => logger, actor => new_actor("protocol_checker"), max_waits => max_waits
logger => logger, actor => new_actor("protocol_checker"), max_waits => max_waits, allow_x_in_null_bytes => true
);
constant meta_values : std_logic_vector(1 to 5) := "-XWZU";
constant valid_values : std_logic_vector(1 to 4) := "01LH";
Expand Down Expand Up @@ -168,6 +168,29 @@ begin
end loop;
end;

procedure pass_masked_unknown_test(
signal d, k, s : out std_logic_vector;
signal e1, e2 : out std_logic) is
begin
wait until rising_edge(aclk);
e1 <= '1';
e2 <= '1';

for i in valid_values'range loop
for j in k'range loop
for l in meta_values'range loop
k <= (k'range => '1');
s <= (s'range => '1');
k(j) <= '0';
s(j) <= '0';
d <= (d'range => valid_values(i));
d(j*8+7 downto j*8) <= (others => meta_values(l));
wait until rising_edge(aclk);
end loop;
end loop;
end loop;
end;

procedure fail_unknown_test(
signal d: out std_logic_vector;
signal e1, e2: out std_logic;
Expand Down Expand Up @@ -315,6 +338,9 @@ begin
elsif run("Test passing check of that tdata must not be unknown when tvalid is high") then
pass_unknown_test(tdata, tvalid, tready);

elsif run("Test passing check of that valid tdata bytes must not be unknown when tvalid is high") then
pass_masked_unknown_test(tdata, tkeep, tstrb, tvalid, tready);

elsif run("Test failing check of that tdata must not be unknown when tvalid is high") then
fail_unknown_test(tdata, tvalid, tready, ":rule 5", "tdata", "tvalid");

Expand Down

0 comments on commit 31b7024

Please sign in to comment.