Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for timeout in the wait_until_idle call. #1054

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions vunit/vhdl/com/src/com.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,11 @@ package body com_pkg is

check(position /= -1, null_message_error);

-- For testing purposes when logger is mocked and the check procedure returns
if position = -1 then
return;
end if;

get_message(net, source_actor, position, mailbox_id, reply_msg);
end;

Expand Down
5 changes: 3 additions & 2 deletions vunit/vhdl/verification_components/src/sync_pkg-body.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

package body sync_pkg is
procedure wait_until_idle(signal net : inout network_t;
handle : sync_handle_t) is
handle : sync_handle_t;
timeout : delay_length := max_timeout) is
variable msg, reply_msg : msg_t;
begin
msg := new_msg(wait_until_idle_msg);
request(net, handle, msg, reply_msg);
request(net, handle, msg, reply_msg, timeout);
delete(reply_msg);
end;

Expand Down
6 changes: 4 additions & 2 deletions vunit/vhdl/verification_components/src/sync_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ package sync_pkg is
-- Handle to talk to a VC implementing the sync VCI
alias sync_handle_t is actor_t;

-- Blocking: Wait until all operations requested from the VC have been finished
-- Blocking: Wait until all operations requested from the VC have been
-- finished or timeout has been reached. A timeout results in an error.
procedure wait_until_idle(signal net : inout network_t;
handle : sync_handle_t);
handle : sync_handle_t;
timeout : delay_length := max_timeout);

-- Non-blocking: Make VC wait for a delay before starting the next operation
procedure wait_for_time(signal net : inout network_t;
Expand Down
8 changes: 8 additions & 0 deletions vunit/vhdl/verification_components/test/tb_sync_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ begin
wait_until_idle(net, actor);
check_equal(now - start, 37 ms, "wait for time mismatch");

mock(com_logger, failure);
start := now;
wait_for_time(net, actor, 37 ms);
wait_until_idle(net, actor, 10 ms);
check_log(com_logger, "TIMEOUT.", failure, start + 10 ms);
check_only_log(get_logger("vunit_lib:com"), "NULL MESSAGE ERROR.", failure, start + 10 ms);
unmock(com_logger);

test_runner_cleanup(runner);
end process;

Expand Down