Normally, in OOL there are two kinds of clear notations.
First, for
See Inheritance on Wikipedia for more information.
•Class Inheritance relations
○ Father/Parent/base class → class A;
○ Child/sub/derived class → class B extends A;
Second,
See Nested classes (not supported in all languages)
• Class Hierarchy relations/NESTED CLASSES
○ Wrapper/enclosing/Outer Class /master Class → class B; A instance_A; endclass;
○ Instanced/member/nested/inner/serve Class → class A;
You can create the sub instanced class doing “new” inside the inner class or you can assign a handler from outside to a inner member of a class, as showed below.
class topclass;
A top_Ainst= new();
B wrapperclass=new();
wrapperclass.instance_A=top_Ainst; //here, an outer class called wrapperclass is assigned (a member) with another class (inner class in respect to the wrapperclass), both classes are created in a supertop class
endclass;
The previous picture showed that we can’t have an inner class instanced in the “heap”. This is allowed in systemverilog. This picture example is for java and ilustration purposed.
In UVM i have realized that it seems there is a mixture of parent<->child notation with outer<->inner class notation in constructors of UVM components.
e.g. using new of the UVM components
function new(name,parent);//provide a "name" and a "parent". The "parent" is, in fact, the outer/wrapper class of this class, for this component
super.new(name, parent); //super here generates inheritance base class recursively for the same outerclass.
//"Super" is an inheritance operation and has nothing to do with the handler provided with "parent" which is used to pass the hierarchy to base class.
// UVM components needs the outerclass in the new constructor and not a father inheritance handler.
endfunction;
Components in UVM use “name”,“parent” inputs in the constructors and they are used/assigned each time the UVM “create method” is called.
The “super” keyword is used from within a derived class to refer to properties of the base class (inheritance) of the current class. The term “parent” in the new function is confusing because it has nothing to do with inheritance. Is it correct? or did i miss something?
The question is:
would it be not a better and proper notation to call in UVM these inputs again with “name” and the “outerclasshandle” (“parent” is a inheritance and in my opinion wrong notation used in UVM)?
I am looking forward your opinion and answers to see if my view is wrong.