Skip to content

Commit

Permalink
removed no longer used variable 'reset_cycles' from axi_stream_master…
Browse files Browse the repository at this point in the history
….vhd

applied same construction to realign to clock edge to the axi_stream_slave as was done in axi_stream_master.
  • Loading branch information
Olaf van den Berg committed Dec 18, 2018
1 parent e9bfb35 commit 3e098f5
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ begin
bus_process : process
variable msg : msg_t;
variable msg_type : msg_type_t;
variable reset_cycles : positive := 1;
begin
if drive_invalid then
tdata <= (others => drive_invalid_val);
Expand Down
77 changes: 55 additions & 22 deletions vunit/vhdl/verification_components/src/axi_stream_slave.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,32 @@ entity axi_stream_slave is
end entity;

architecture a of axi_stream_slave is

signal notify_bus_process_done : std_logic := '0';
constant message_queue : queue_t := new_queue;

begin

main : process
variable request_msg : msg_t;
variable msg_type : msg_type_t;
begin
receive(net, slave.p_actor, request_msg);
msg_type := message_type(request_msg);

if msg_type = stream_pop_msg or msg_type = pop_axi_stream_msg then
push(message_queue, request_msg);
elsif msg_type = wait_for_time_msg then
push(message_queue, request_msg);
elsif msg_type = wait_until_idle_msg then
wait on notify_bus_process_done until is_empty(message_queue);
handle_wait_until_idle(net, msg_type, request_msg);
else
unexpected_msg_type(msg_type);
end if;
end process;

bus_process : process
variable reply_msg, msg : msg_t;
variable msg_type : msg_type_t;
variable axi_stream_transaction : axi_stream_transaction_t(
Expand All @@ -45,32 +69,41 @@ begin
tuser(tuser'range)
);
begin
receive(net, slave.p_actor, msg);
msg_type := message_type(msg);
-- Wait for messages to arrive on the queue, posted by the process above
wait until rising_edge(aclk) and (not is_empty(message_queue));

handle_sync_message(net, msg_type, msg);
while not is_empty(message_queue) loop
msg := pop(message_queue);
msg_type := message_type(msg);

if msg_type = stream_pop_msg or msg_type = pop_axi_stream_msg then
tready <= '1';
wait until (tvalid and tready) = '1' and rising_edge(aclk);
tready <= '0';

axi_stream_transaction := (
tdata => tdata,
tlast => tlast = '1',
tkeep => tkeep,
tstrb => tstrb,
tid => tid,
tdest => tdest,
tuser => tuser
);
if msg_type = wait_for_time_msg then
handle_sync_message(net, msg_type, msg);
wait until rising_edge(aclk);
elsif msg_type = stream_pop_msg or msg_type = pop_axi_stream_msg then
tready <= '1';
wait until (tvalid and tready) = '1' and rising_edge(aclk);
tready <= '0';

reply_msg := new_axi_stream_transaction_msg(axi_stream_transaction);
reply(net, msg, reply_msg);
axi_stream_transaction := (
tdata => tdata,
tlast => tlast = '1',
tkeep => tkeep,
tstrb => tstrb,
tid => tid,
tdest => tdest,
tuser => tuser
);

else
unexpected_msg_type(msg_type);
end if;
reply_msg := new_axi_stream_transaction_msg(axi_stream_transaction);
reply(net, msg, reply_msg);
else
unexpected_msg_type(msg_type);
end if;
end loop;

notify_bus_process_done <= '1';
wait until notify_bus_process_done = '1';
notify_bus_process_done <= '0';

end process;

Expand Down

0 comments on commit 3e098f5

Please sign in to comment.