Mailboxes Mailbox is a communication mechanism that allows
Mailboxes ▪ Mailbox is a communication mechanism that allows messages to be exchanged between different processes. ▪ Data can be sent to a mailbox by one process and retrieved by another Verification with System Verilog 6/4/2021 1
Mailboxes ▪ Mailbox is a communication mechanism that allows messages to be exchanged between different processes. ▪ Data can be sent to a mailbox by one process and retrieved by another ▪ Why do we need it? ▪ Generator can call driver task – but becomes hardcoded ▪ The communication channel should allow both source and sink to operate asynchronously ▪ Similar to a HW FIFO Verification with System Verilog 6/4/2021 2
Mailbox Types ▪ Mailboxes can be classified as: ▪ Unbounded mailboxes ▪ No restrictions placed on size of mailbox. ▪ put() will never block. ▪ Ex: mailbox m = new (); ▪ Bounded mailboxes ▪ ▪ Number of entries is determined when the mailbox is created. Bound value should be positive. put() will be blocked if the mailbox is full. Ex: mailbox m = new (5); // mailbox of depth = 5 Verification with System Verilog 6/4/2021 3
Mailbox Methods Method Use new() Create a new mailbox. put() Place a message in a mailbox. get() Retrieve a message from mailbox. try_get()/ try_peek() Try to retrieve a message from the mailbox without blocking. try_put() Try to place a message in mailbox without blocking. Useful only for bounded mailboxes. peek() Copies a message from mailbox without actually removing it. 6/4/2021 4
Mail box Example
Mail box Example
- Slides: 6