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 or tstrb if
allow_x_in_non_data_bytes is set.
  • Loading branch information
bewimm authored and LarsAsplund committed Nov 1, 2023
1 parent c80b0d3 commit e0e10e9
Show file tree
Hide file tree
Showing 2 changed files with 36 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 @@ -146,7 +146,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_non_data_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,35 @@ begin
end loop;
end;

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

for i in valid_values'range loop
for j in 0 to data_length/8*2-1 loop
for l in meta_values'range loop
k <= (k'range => '1');
s <= (s'range => '1');
if j < data_length/8 then
k(j) <= '0';
p := j;
else
p := j-data_length/8;
end if;
d <= (d'range => valid_values(i));
s(p) <= '0';
d(p*8+7 downto p*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,7 +344,12 @@ 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
tkeep <= (others => '1');
tstrb <= (others => '1');
fail_unknown_test(tdata, tvalid, tready, ":rule 5", "tdata", "tvalid");

elsif run("Test passing check of that tlast must not be unknown when tvalid is high") then
Expand Down

0 comments on commit e0e10e9

Please sign in to comment.