I’ve poked around with mailbox questions and haven’t seen this directly addressed. I’ve inherited a testbench that used a lot of mailboxes to pass data around between verification models and the top level testbench. Upon running this I get a few errors like:
Error (suppressible): (vsim-12457) A mailbox method 'put/try_put' is called on a NULL mailbox.
and
Fatal: (vsim-131) <filename> Null instance encoutnered when dereferencing 'axi_mst_mb'
Is this a case where the mailbox variable has not yet been created, and yet the code is trying to do something with the mailboxes? If so I need to check for that before actions are taken and at the least I imagine I could just wrap some of these in a if (my_mb) <do mailbox action>;.
If it’s something else though, I suppose I’ll have to have a more elaborate fix.
For the AXI one I discovered two things. Unlike the other mailboxes, that one did not have an initial value of new(). Typo or oversight I believe. I also added wait (mb); in the process that was using that one (it was an initial block) and between the two all mailbox errors have disappeared. I might take away the wait – I have a sneaking suspicion it was the lack of new().
Well that’s what it’s for as far as I know waiting until the expression evaluates as a logical true. Non-null is boolean true so wait will be satisfied.
That said, seems like the new() by itself was the complete solution, the other is just unnecessary waiting in this particular testbench. Onwards to the next issue!