Factory Classes

As the name implies, the ovm_factory is used to manufacture (create) OVM objects and components.  Only one instance of the factory is present in a given simulation.

User-defined object and component types are registered with the factory via typedef or macro invocation, as explained in ovm_factory::Usage.  The factory generates and stores lightweight proxies to the user-defined objects and components: ovm_object_registry #(T,Tname) for objects and ovm_component_registry #(T,Tname) for components.  Each proxy only knows how to create an instance of the object or component it represents, and so is very efficient in terms of memory usage.

When the user requests a new object or component from the factory (e.g.  ovm_factory::create_object_by_type), the factory will determine what type of object to create based on its configuration, then ask that type’s proxy to create an instance of the type, which is returned to the user.

class ovm_factory
As the name implies, ovm_factory is used to manufacture (create) OVM objects and components.
Using the factory involves three basic operations
class ovm_object_registry #(
   type T = ovm_object,
   string Tname = "<unknown>"
) extends ovm_object_wrapper
The ovm_object_registry serves as a lightweight proxy for an ovm_object of type T and type name Tname, a string.
class ovm_component_registry #(
   type T = ovm_component,
   string Tname = "<unknown>"
) extends ovm_object_wrapper
The ovm_component_registry serves as a lightweight proxy for a component of type T and type name Tname, a string.
function ovm_object create_object_by_type (ovm_object_wrapper requested_type,  
string parent_inst_path = "",
string name = "")