when ONE particular uvm_analysis_imp is connected to multiple uvm_analysis_port then how to know from which port uvm_analysis_imp got item?
Assuming the analysis_port / analysis_imp is parameterized with class Txn .
You can add another property ( eg : string name ) in the class Txn .
So before you call
my_analysis_port.write ( txn_handle ) ;
You could do ::
txn_handle.name = my_analysis_port.get_name() ;
// The name() arg. during instantiation of analysis_port is assigned to LHS
In the write() method of the class which has analysis_imp you can check the name property .
Based on the name arg. ( assuming they are unique ) you can know which analysis_port called it .
NOTE :: There’s a chance you would have the name() args same .
In this case ::
txn_handle.name = my_analysis_port.get_full_name() ;
// This would guarantee a Unique String assigned to LHS ALWAYS !! .
// get_full_name() could be a long string based on hierarchy !!