Skip to content

Commit

Permalink
Revert to old delta cycle timing.
Browse files Browse the repository at this point in the history
Reduce the risk of breaking existing user tests that depends on delta timing.
  • Loading branch information
LarsAsplund committed Aug 15, 2024
1 parent 320f1b0 commit a27f0c7
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 14 deletions.
50 changes: 40 additions & 10 deletions vunit/vhdl/verification_components/src/axi_stream_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,7 @@ package body axi_stream_pkg is
msg : string := "";
blocking : boolean := true
) is
constant expected_normalized : std_logic_vector(expected'length - 1 downto 0) := expected;
variable got_tdata : std_logic_vector(data_length(axi_stream)-1 downto 0);
variable got_tlast : std_logic;
variable got_tkeep : std_logic_vector(data_length(axi_stream)/8-1 downto 0);
Expand All @@ -738,18 +739,47 @@ package body axi_stream_pkg is
variable got_tdest : std_logic_vector(dest_length(axi_stream)-1 downto 0);
variable got_tuser : std_logic_vector(user_length(axi_stream)-1 downto 0);
variable check_msg : msg_t := new_msg(check_axi_stream_msg);
variable mismatch : boolean;
begin
push_string(check_msg, msg);
push_std_ulogic_vector(check_msg, expected);
push_std_ulogic_vector(check_msg, tkeep);
push_std_ulogic_vector(check_msg, tstrb);
push_std_ulogic(check_msg, tlast);
push_std_ulogic_vector(check_msg, tid);
push_std_ulogic_vector(check_msg, tdest);
push_std_ulogic_vector(check_msg, tuser);
send(net, axi_stream.p_actor, check_msg);
if blocking then
wait_until_idle(net, as_sync(axi_stream));
pop_axi_stream(net, axi_stream, got_tdata, got_tlast, got_tkeep, got_tstrb, got_tid, got_tdest, got_tuser);
mismatch := false;
for idx in got_tkeep'range loop
if got_tkeep(idx) and got_tstrb(idx) then
mismatch := got_tdata(8 * idx + 7 downto 8 * idx) /= expected_normalized(8 * idx + 7 downto 8 * idx);
exit when mismatch;
end if;
end loop;
if mismatch then
check_equal(got_tdata, expected, "TDATA mismatch, " & msg);
end if;

if tkeep'length > 0 then
check_equal(got_tkeep, tkeep, "TKEEP mismatch, " & msg);
end if;
if tstrb'length > 0 then
check_equal(got_tstrb, tstrb, "TSTRB mismatch, " & msg);
end if;
check_equal(got_tlast, tlast, "TLAST mismatch, " & msg);
if tid'length > 0 then
check_equal(got_tid, tid, "TID mismatch, " & msg);
end if;
if tdest'length > 0 then
check_equal(got_tdest, tdest, "TDEST mismatch, " & msg);
end if;
if tuser'length > 0 then
check_equal(got_tuser, tuser, "TUSER mismatch, " & msg);
end if;
else
push_string(check_msg, msg);
push_std_ulogic_vector(check_msg, expected);
push_std_ulogic_vector(check_msg, tkeep);
push_std_ulogic_vector(check_msg, tstrb);
push_std_ulogic(check_msg, tlast);
push_std_ulogic_vector(check_msg, tid);
push_std_ulogic_vector(check_msg, tdest);
push_std_ulogic_vector(check_msg, tuser);
send(net, axi_stream.p_actor, check_msg);
end if;
end procedure;

Expand Down
4 changes: 2 additions & 2 deletions vunit/vhdl/verification_components/test/tb_axi_stream.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ begin
to_nibble_string(keep) & " (" & to_string(to_integer(keep)) & "). Expected " &
to_nibble_string(not keep) & " (" & to_string(to_integer(not keep)) & ").", error);
check_log(mocklogger, "TSTRB mismatch, checking axi stream - Got " &
to_nibble_string(keep) & " (" & to_string(to_integer(keep)) & "). Expected " &
to_nibble_string(not keep) & " (" & to_string(to_integer(not keep)) & ").", error);
to_nibble_string(strb) & " (" & to_string(to_integer(strb)) & "). Expected " &
to_nibble_string(not strb) & " (" & to_string(to_integer(not strb)) & ").", error);
check_log(mocklogger, "TLAST mismatch, checking axi stream - Got 1. Expected 0.", error);
if id'length > 0 then
check_log(mocklogger, "TID mismatch, checking axi stream - Got 0010_0010 (34). Expected 0010_0011 (35).", error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ begin
tkeep <= (others => '1');
pass_unknown_test(tstrb, tvalid, tready);

-- U is reolved to the value of tkeep and should not fail
-- U is reolved to the value of tkeep and should not fail
tvalid <= '0';
tready <= '0';
wait until rising_edge(aclk);
Expand All @@ -560,7 +560,7 @@ begin

elsif run("Test failing check of that tstrb must not be unknown when tvalid is high") then
tkeep <= (others => '1');
-- U is reolved to the value of tkeep and should not fail
-- U is reolved to the value of tkeep and should not fail
fail_unknown_test(tstrb, tvalid, tready, ":rule 18", "tstrb", "tvalid", skip_meta_values => (5 => true, others => false));

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

0 comments on commit a27f0c7

Please sign in to comment.