.triggered);
// start waiting for e2 to be 1
$display(“
run_first: after event1 triggered
”);
endtask :
run_first
task
run_second
;
$display(“
run_second: before event2 triggered
”);
->
e2
;
// trigger event 2
wait (
e1.
triggered);
// start waiting for e1 to be 1
$display(“
run_second: after event2 triggered
”)
endtask :
run_second
run_first: before event1 triggered
run_second: before event2 triggered
run_first: after event1 triggered
run_second: after event2 triggered
28
[email protected]
Advanced Hardware Design & Verification
SystemVerilog [Verification]
T
his now looking at the state of the event, i.e. it is level triggered.

Threads and Inter
-
Process Communication
event
event
Synchronization Utilities
$wait_order(
event_identifier
{
, event_identifier
}
)
29
[email protected]
Advanced Hardware Design & Verification
SystemVerilog [Verification]
T
he
$
wait_order
system task suspends the calling process until all of the specified events are triggered
(similar to
$
wait_all
), but the events must be triggered in the given order (left to right). If an event is
received out of order, the process unblocks and generates a run-time error.
$wait_any(
event_identifier
{
, event_identifier
}
)
T
he
$
wait_any
system tasks suspends the calling process until any of the specified events are triggered
$wait_order
( a, b, c);
$wait_any
( a, b, c);
suspends the current process until either event a, or event b, or event c is triggered.
suspends the current process until events trigger in the order a
b
c.
$wait_all(
event_identifier
{
, event_identifier
}
)
T
he
$
wait_all
system tasks suspends the calling process until all
of the specified events are triggered.
$wait_all
( a, b, c);
suspends the current process until the 3 events a, b, and c are triggered.

Threads
and Inter
-
Process Communication
mailbox
•
I
nter-Process-Communication (Mailboxes)
•
H
ow the can be used in the verification environment
•
E
xamples
•
B
ounded vs. Un-Bounded Mailboxes
30
[email protected]
Advanced Hardware Design & Verification
SystemVerilog [Verification]

Threads and Inter
-
Process Communication
mailbox
Mailboxes as a Software Concept
I
n software, we use a message passing system to allow processes to communicate with each other without
needing to resort to using some sort of shared data. For example, we could have two processes P and Q,
who would like to send messages to each other. They do so, using a communication link as illustrated
below:
T
here are several mechanisms that this communication link can use for sending and receiving data between the processes.
-
D
irect Communication - Must Explicitly name the recipient
-
Indirect Communication - messages are sent to mailboxes or ports
-
S
ymmetric Communication - Both Sender and Receiver must name each other to communicate
-
Asymmetric Communication
- Only the sender names the recipient
-
Automatic Buffering
–
The link has potentially an infinite number of outstanding or un-read communiqué's (default)
-
E
xplicit Buffering
- The queue has a finite length, it can be zero or more. But it is fixed.
