vikassinghal21
01-17-2008, 04:28 AM
Code snippet from src/base/ovm_connector_base.svh:
class ovm_connector #( type IF = int ) extends ovm_connector_base;
typedef ovm_connector #( IF ) connector_type;
local int unsigned if_mask;
local ovm_if_container #(IF) m_if_container;
ovm_port_base_base #(IF) port_h;
...
endclass
Lines from src/base/ovm_connector_base.svh: typedef ovm_connector #( IF ) connector_type;
Lines from src/base/ovm_port_base.svh:
function int size(); // function of class ovm_port_base
return m_connector.m_if_container.size();
//return m_connector.size();
endfunctionin the above example m_if_container is defined as local variable in class ovm_connector and this local variable is accessed in the function size of class ovm_port_base, which, I think, is the wrong usage according to the definition of local.
Some lines from LRM:
A member identified as local is available only to methods inside the class. Further, these local members
are not visible within subclasses. Of course, nonlocal methods that access local class properties or methods
can be inherited and work properly as methods of the subclass.
class ovm_connector #( type IF = int ) extends ovm_connector_base;
typedef ovm_connector #( IF ) connector_type;
local int unsigned if_mask;
local ovm_if_container #(IF) m_if_container;
ovm_port_base_base #(IF) port_h;
...
endclass
Lines from src/base/ovm_connector_base.svh: typedef ovm_connector #( IF ) connector_type;
Lines from src/base/ovm_port_base.svh:
function int size(); // function of class ovm_port_base
return m_connector.m_if_container.size();
//return m_connector.size();
endfunctionin the above example m_if_container is defined as local variable in class ovm_connector and this local variable is accessed in the function size of class ovm_port_base, which, I think, is the wrong usage according to the definition of local.
Some lines from LRM:
A member identified as local is available only to methods inside the class. Further, these local members
are not visible within subclasses. Of course, nonlocal methods that access local class properties or methods
can be inherited and work properly as methods of the subclass.