Query is regarding difference in Mailboxes and TLM

Hi All,
I have gone through this forum as well to get my query clarified, but i was not able get it.
I do understand that TLM is a abstract class base concept called
pure virtual interface(not related to system verilog keyword
Interface").But ultimately it does what a mailbox can do it.
So, can anybody please explain me regarding it.

Thanks

Only the tlm_fifo does what a mailbox can do. And although they behave the same, they connect to your environment very differently.

Using the simple producer/consumer example where you have the producer thread doing **put()**s and a consumer thread doing **get()**s, let us look at the difference between the mailbox and the tlm_fifo class.

When using a mailbox, the producer and consumers classes need a handle to the same mailbox object if they are to communicate. That’s fine as long as both producer and consumer’s agree to use a mailbox for communication. But now you want to change the consumer class to instead of being a thread, you want it to just function call that is activated by each producer put call. You you would have to change the producer class to instead of calling the mailbox put() method, to call a method directly in the consumer.

The point of TLM is to make code re-usable by isolating code from these kind of changes. By using the abstract class mechanism, the producer just needs a handle to an abstract class that has a put() method defined. It doesn’t need to know whether that put() is going to a put implemented in a tlm_fifo, or a put implemented directly in the consumer class. Now the producer class has been made more re-usable.

Hope that helps. The OVM Cookbook has more examples of this. See http://www.verification-academy.com

Dave

But now you want to change the consumer class to instead of being a thread, you want it to just function call that is activated by each producer put call. You you would have to change the producer class to instead of calling the mailbox put() method, to call a method directly in the consumer.
Dave

Hi Dave,
I have gone through the cook book examples of tlm and I am not getting the above quote.Please can you elaborate.

Thanks