User guide
24-182
SystemVerilog Testbench Constructs
Mailbox Methods
Mailboxes use the following methods:
new()
Along with the mailbox keyword, declares a new mailbox. You
cannot yet specify the maximum number of messages with this
method.
num()
Returns the number of messages in the mailbox.
put(expression)
Puts another message in the mailbox.
get(variable)
Assigns the value of the first message to the variable. VCS
removes the first message so that the next message becomes
the first method. If the mailbox is empty, VCS suspends simulation
of the process (initial block, task, etc.) until a put method put a
message in the mailbox.
try_get(variable)
Assigns the value of the first message to the variable. If the
mailbox is empty, this method returns the 0 value. If the message
is available, this method returns a non-zero value. After returning
the value, VCS executes the next statement.
peek(variable)
Assigns the value of the first message to the variable without
removing the message. If the mailbox is empty, VCS suspends
simulation of the process (initial block, task, etc.) until a put
method put a message in the mailbox.