In reply to sanketshah:
You need to accept that you cannot add extra arguments to the write method of an analysis port/analysis_imp. But let’s assume for the moment that you could add an extra argument. The code for the class that calls the write method, and the class that implements the write method both have to know about the existence of that extra variable argument and it’s type, along with the type of the original tx transaction. If these types were parameterize, you would have to parameterize the calling and called classes as well.
So now, going back to the fact that you can only have one argument, you have to encapsulate the knowledge about the two arguments you want into a signal argument. You can do that by extending the tx class and adding the extra variable as an extended class member, or you can create a new class that contains two class members representing the tx and extra variable. In either case, you can parameterize the variable’ type by parameterizing the class.
The problem with the container method is an extra level of indirection and the fact that every implementation connected to the analysis port has to know that it is being passed a container containing a transaction, instead of just the transaction.