NOTE :: The following isn’t a doubt but rather a suggestion for UVM Base Class Library Code ( BCL ) .
Consider a T.B where we have around 1000 - 1500 user defined object / sequence / component classes with 100 Overrides registered
UVM Factory being a singleton holds ALL types ( object / sequence / component ) .
It also contains a Type Override queue ’ m_type_overrides ’ which is shared between all classes .
Whenever User calls create , internally factory function find_override_by_type is called which iterates over queue ’ m_type_overrides ’ .
So whenever create is called on a Type which doesn’t have an Override registered for it , it would still iterate over queue ’ m_type_overrides ’ .
**Each type that doesn’t have an Override registered for it would Iterate 100 times !!
So if we have 800 Non - Overridden types we would have 800 x 100 Iterations !!**
I believe this is unnecessary and results in lot of unnecessary iterations .
A similar wastage of CPU time results when user call super.build( phase ) for base classes which calls function apply_config_settings() .
So I thought of adding the following in BCL ::
// Within abstract class uvm_object_wrapper ::
pure virtual function bit override ( bit overridden = 1 ) ;
pure virtual function bit is_overridden() ;
// Within proxy classes :: uvm_object_registry N uvm_component_registry ::
protected static bit override_done ; // Exists for Each Specialization !!
virtual function bit is_overridden() ;
return override_done ;
endfunction
virtual function bit override ( bit overridden = 1 ) ;
override_done = overridden ;
endfunction
// Within Factory function set_type_override_by_type ::
m_type_overrides.push_back(override); // BCL registers Type Override
// Added following in BCL after Registering Override ::
original_type.override(1) ; // original_type is I/P argument of type ' uvm_object_wrapper '
// Within Factory function find_override_by_type ::
// Added the following 2 lines ::
if ( ! requested_type.is_overridden() )
return requested_type ; // Return Original_type if No Override exists
...............................................
// If Override Exists ONLY then Iterate Over queue ' m_type_overrides '
foreach (m_type_overrides[index]) // Now it would Iterate ONLY when an Override actually exists !!
begin
........
Considering that UVM is Open Source , can the end user suggest changes in BCL ?
I know that the BCL isn’t efficient in itself so if we could suggest changes
chances are it would be efficient over time .
PS :: Have verified that the Code works !!