system-verilog

Is using ref as direction type for get task for the mailbox have intended usage here?


In SystemVerilog LRM 1800-2017 , section 15.4.5., the declaration of the get task for mailbox is the following:

task get( ref singular message );

Why is the direction type ref, not output?


Solution

  • It was done to be consistent with try_get(message) which has the same argument prototype. It's argument needs to be unmodified if no message is available in the mailbox. Ideally, they should have used the inout argument direction which is less restrictive. But that detail was not caught in time before it went into the LRM.