Skip to content

Commit

Permalink
Merge branch 'VUnit:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMartinPhios authored Aug 28, 2024
2 parents 5a9b915 + 80bba05 commit 755f5d4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
2 changes: 2 additions & 0 deletions docs/news.d/1054.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added timeout parameter to the `wait_until_idle` procedure in the synchronization verification component interface.
A timeout will result in a failure.
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

0 comments on commit 755f5d4

Please sign in to comment.