Since the UVM Base Class Library is same I am unable to understand the reason for different O/P
**SIMULATOR1 OP ::**
**UVM_INFO @ 0: reporter [RNTST] Running test my_test…
UVM_INFO @ 0: uvm_test_top [uvm_test_top] In build_phase of my_test
UVM_INFO @ 0: uvm_test_top.comp_h [comp_h] In build_phase of env #( 5)
**
**SIMULATOR2 OP ::**
Error-[SV-ACCNBI] An abstract class cannot be instantiated
/tools/synopsys-/vcs/Q-2020.03-SP1/etc/uvm-1.2/base/uvm_registry.svh, 64
uvm_pkg, "obj = new(name, parent);"
Instantiation of the object 'obj' can not be done because its type 'base_comp' is an abstract base class.
Instance stack trace: uvm_component_registry#($unit::base_comp,"base_comp")
SV basics dictate I can’t call new() on abstract class handle , but in this
code since Factory Override is registered , shouldn’t the Code work ??
You cannot do this in UVM 1.2 or earlier because the factory macros inserts class with a create method that calls new() on the abstract class, which is illegal
IEEE UVM 1800.2-2020 adds a new abstract class factory registration mechanism.
Dave , for better understanding I was going through the Base Class Library for the control flow during create() ::
[1] create() internally calls factory.create_component_by_type()
[ As create() uses Type - Based factory ] .
[2] Function create_component_by_type() calls find_override_by_type() which would return
an overridden type if factory Override is registered ( as in our case ) .
[3] Finally virtual function create_component() ( of the Proxy class Specialized to the overridden type ) gets called which calls new() .
It seems there are tool differences in the check for calling the constructor of an abstract class. When the LRM says you cannot “call” the constructor, some have interpreted that as a compile time check, and others have interpreted that as a run-time check.
The registration and override mechanism is separate from the creation mechanism. But uvm_component_registry class contains both. 1800.2-2020 separates the mechanisms to make it tool independent.
The tool that did not produce a compiler error correctly overrode base_comp with env#(4) and it overrode env#(4) with env#(5). So only the env#(5) constructor gets called.
(1) Some tools throw compilation - error since function create_component in the
proxy class calls new() internally ( although the override ensures it doesn’t ) .
UVM LRM 1800.2 , Section 8.2.5.1.2 says ::
**"As abstract classes cannot be constructed, this method shall generate an error and return null"**
So for abstract proxy class uvm_abstract_component_registry , within the function create_component :
**(Q1) Source Code won’t call new ( unlike non-abstract proxy class ) thereby avoiding the simulator dependency .
If called ( when no override exists ) it would throw an UVM_ERROR Message .
Is my understanding correct ?**
(Q2) Where can I observe the source code as per UVM LRM 1800.2-2017 ?
Is this the next version of UVM i.e UVM 1.3 ?