Uvm_monitor and class parameter

In reply to Lina.Lin:

In reply to verif_learner:
Here is my understanding:
Usually the monitor is used to collect the transactions from the bus interfaces and do checks and coverage etc. there or send the transactions to analysis components like scoreboards through analysis ports. You have freedom to instance the monitor in an agent or in an sub-system environment component which depends on your test bench architecture. You also have freedom to collect one type transaction or multiple type transactions in one monitor.
If you want to have one monitor which can be reused for multiple instances with different transaction type, maybe you can consider to implement your own parameterized monitor.


class my_monitor #(type T) extends uvm_monitor;
T trans;
...
endclass

In general, this will not work, except as a common base class to set up analysis ports, which is exactly what the uvm_driver class does with sequence item ports. You are using different transaction types most likely because they have different fields that you need to fill. So the monitor needs to be specialized to the transaction class it’s going to deal with.