From end_of_elaboration_phase() of Test if I write ::
( 1 )
this.print() ;
**V / S**
( 2 )
uvm_top.print_topology() ;
[ I ] Would there be a difference in Output Observed ?
[ II ] Also class uvm_factory has a function :: print()
So this should be used with **argument 0** i.e
factory.print( 0 ) ;
to observe any type N instance override registered in factory right ?
[ III ] While going the UVM library ( UVM 1.1d ) I Observe ::
const uvm_factory factory = uvm_factory::get(); // Global Singleton instance hence can be accessed from anywhere in TB
However in UVM 1.2 I don't observe a similar global instance
as factory is an abstract class . Is there a reason for this ?
In reply to Have_A_Doubt:
- print() is method of the base class uvm_object. It prints the string name and the string type name of the object along with anything else the extend class has set up to print. print_topology is a method of uvm_root only. It is a debugging method.
- The print() method of uvm_factory is set up tp print debug information. Providing argument 0 list all the overrides.
- UVM 1.2 began the process of eliminating direct access to global variables, which is generally consider a bad programing practice. Direct access has problems with time 0 initialization race conditions.
In reply to dave_59:
Hi Dave ,
A few follow up questions
(1) I understand that print and print_topology are functions of different classes .
From Test i.e “uvm_test_top” via both this.print() and uvm_top.print_topology() ,
I observe same output i.e TB Structure .
However from user_env , this.print() would display hierarchy from env and the hierarchy below env
( i.e agent and it’s sub-components i.e driver and sequencer ) whereas
uvm_top.print_topology()would still show the entire TB hierarchy from uvm_test_top
So essentially ::
(a) print function inherited from uvm_object shows the TB hierarchy
from below that component and it’s sub - components .
(b)
uvm_top.print_topology() shows the entire TB hierarchy irrespective from where it’s called
From body() of user_sequence via this.print() the output is different ::
---------------------------------------------------------------------------
Name Type Size Value
---------------------------------------------------------------------------
seq_h user_seq - @637
begin_time time 64 0
depth int 32 'd1
parent sequence (name) string 0 ""
parent sequence (full name) string 0 ""
sequencer string 23 uvm_test_top.env_h.seqr
req user_seq_item - @642
rsp rsp_ext_item - @646
---------------------------------------------------------------------------
( 2 ) Could you please elaborate on
"Direct access has problems with time 0 initialization race conditions."
I understand that static property initialization is undefined in LRM .
To ensure that there exists a Singleton instance of factory , user needs to
call factory static function get .
So doesn't this eliminate the time 0 race conditions ?
In reply to dave_59:
Hello Dave with respections, how do we do print_topology() in UVM 1.2? I actually get this issue now.
In reply to yangshougui:
uvm_root r;
r = uvm_root::get();
r.print_topology();