I have a base class and at least 2 derived classes that extend the base class :
class base_class extends uvm_sequence_item;
class der_class1 extends base_class;
class der_class2 extends base_class;
I have an analysis port in my monitor of base class type :
uvm_analysis_port#(base_class) base_class_ap;
My monitor constructs only the different derived class objects. Can I just pass the derived class to the base class analysis port?
der_class1 tr1;
… construct and populate …
base_class_ap.write(tr1);
or
der_class2 tr2;
… construct and populate …
base_class_ap.write(tr2);
On the export end I assume I would need to do a $cast(der_class1_obj, base_class_obj) to convert the transactions back to their correct derived class?
Any corrections to what I have here?