Skip to content

Commit

Permalink
axi_stream: fix back-to-back transfer
Browse files Browse the repository at this point in the history
During the delta-cycle for handling of 'notify_bus_process_done', new
message_queue items may be issued, esp. when running the "other side"
in a "single sample while loop". Checking the queue before sleeping
allows back-to-back reads/writes of the axi-stream.
  • Loading branch information
Marquardt, Daniel authored and LarsAsplund committed Aug 31, 2022
1 parent 77cc839 commit 62654e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions vunit/vhdl/verification_components/src/axi_stream_master.vhd
Expand Up @@ -97,12 +97,15 @@ begin
drive_invalid_output(tdata, tkeep, tstrb, tid, tdest, tuser);
end if;

-- Wait for messages to arrive on the queue, posted by the process above
wait until rising_edge(aclk) and (not is_empty(message_queue) or areset_n = '0');

if (areset_n = '0') then
tvalid <= '0';
wait until areset_n = '1' and rising_edge(aclk);
else
if is_empty(message_queue) then
-- Wait for messages to arrive on the queue, posted by the process above
wait until (not is_empty(message_queue) or areset_n = '0') and rising_edge(aclk);
end if;

while not is_empty(message_queue) loop
msg := pop(message_queue);
msg_type := message_type(msg);
Expand Down
4 changes: 3 additions & 1 deletion vunit/vhdl/verification_components/src/axi_stream_slave.vhd
Expand Up @@ -92,8 +92,10 @@ begin
begin
rnd.InitSeed(rnd'instance_name);
loop
if is_empty(message_queue) then
-- Wait for messages to arrive on the queue, posted by the process above
wait until rising_edge(aclk) and (not is_empty(message_queue));
wait until rising_edge(aclk) and (not is_empty(message_queue));
end if;

while not is_empty(message_queue) loop
msg := pop(message_queue);
Expand Down

0 comments on commit 62654e0

Please sign in to comment.