Skip to content

Commit 755f5d4

Browse files
Merge branch 'VUnit:master' into master
2 parents 5a9b915 + 80bba05 commit 755f5d4

File tree

5 files changed

+22
-4
lines changed

5 files changed

+22
-4
lines changed

docs/news.d/1054.feature.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Added timeout parameter to the `wait_until_idle` procedure in the synchronization verification component interface.
2+
A timeout will result in a failure.

vunit/vhdl/com/src/com.vhd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ package body com_pkg is
447447

448448
check(position /= -1, null_message_error);
449449

450+
-- For testing purposes when logger is mocked and the check procedure returns
451+
if position = -1 then
452+
return;
453+
end if;
454+
450455
get_message(net, source_actor, position, mailbox_id, reply_msg);
451456
end;
452457

vunit/vhdl/verification_components/src/sync_pkg-body.vhd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
package body sync_pkg is
88
procedure wait_until_idle(signal net : inout network_t;
9-
handle : sync_handle_t) is
9+
handle : sync_handle_t;
10+
timeout : delay_length := max_timeout) is
1011
variable msg, reply_msg : msg_t;
1112
begin
1213
msg := new_msg(wait_until_idle_msg);
13-
request(net, handle, msg, reply_msg);
14+
request(net, handle, msg, reply_msg, timeout);
1415
delete(reply_msg);
1516
end;
1617

vunit/vhdl/verification_components/src/sync_pkg.vhd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ package sync_pkg is
1616
-- Handle to talk to a VC implementing the sync VCI
1717
alias sync_handle_t is actor_t;
1818

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

2325
-- Non-blocking: Make VC wait for a delay before starting the next operation
2426
procedure wait_for_time(signal net : inout network_t;

vunit/vhdl/verification_components/test/tb_sync_pkg.vhd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ begin
3333
wait_until_idle(net, actor);
3434
check_equal(now - start, 37 ms, "wait for time mismatch");
3535

36+
mock(com_logger, failure);
37+
start := now;
38+
wait_for_time(net, actor, 37 ms);
39+
wait_until_idle(net, actor, 10 ms);
40+
check_log(com_logger, "TIMEOUT.", failure, start + 10 ms);
41+
check_only_log(get_logger("vunit_lib:com"), "NULL MESSAGE ERROR.", failure, start + 10 ms);
42+
unmock(com_logger);
43+
3644
test_runner_cleanup(runner);
3745
end process;
3846

0 commit comments

Comments
 (0)