The code that you provided works with Questasim 10.1 and later, so you should check your error message and code to make sure that they are related.
Some suggestions are:
- Don’t use program blocks. There are several threads on the Verification Academy which discuss the origin of them and why they shouldn’t be used.
- Your mailbox should be typed to prevent any inadvertent misuse of the mailbox by placing an object of an unexpected type into it causing problems.
- UVM has these TLM capabilities built into the methodology. Is there a reason you aren’t using UVM?