I have an ovm_object class which instantiates other ovm_objects. What is the correct way to create the sub objects? I tried creating them inside the new() function but that showed an interesting problem.
//Lets say I have a parent object class
class parent_obj extends ovm_object;
rand child_obj ch1,ch2;
function new( string name="parent_obj");
// Do I create child objects here? The name argument always takes the default value
ch1 = child_obj::type_id::create("child1",,name);
ch2 = child_obj::type_id::create("child2",,name);
If I instantiate parent_obj as
p1 = parent_obj::type_id::create("type_A_parent_obj");
The name argument will still be parent_obj for the children.
To give some background, I have multiple instances of parent obj and I am trying to do set_inst_override for child objects of one parent obj only, which is why I need to provide name in the context field of create function