[I] I have a parameterized test with a type Parameter .
class user_test #( type T = int ) extends uvm_test ;
`ifdef M1
typedef uvm_component_registry #( user_test#(T) , $sformatf("user_test#(%0s)" , $typename( T ) ) ) type_id ; // Valid Syntax ??
`else
typedef uvm_component_registry #( user_test #(T) , $sformatf("user_test" ) ) type_id ; // Non - unique String across different T !!
`endif
.............
endclass
[Q1] Via +define+M1 ::
Is there an issue with 2nd argument to uvm_component_registry as :: $sformatf(“env#(%0s)” , $typename( T ) ??
I see different Output across simulators . Some allow it others throw Compilation error
The issue with running code without any +define is string registration isn’t unique ( giving a warning message for 2 specializations of class user_test )
[Q2] How do I achieve unique string registration ?
typedef user_test #( int ) user_test_int ; // Specialization 1
typedef user_test #(bit [3:0] ) user_test_bit_3_0 ; // Specialization 2
typedef user_test #(bit signed [31:0]) user_test_bits_3_0 ; // Same as Specialization1
typedef user_test #(logic signed [31:0]) user_test_logic_31_0 ; // Specialization3
[II] I have a parameterized test with a value Parameter .
class C #( BITWIDTH ) extends uvm_component ;
localparam string type_name = $sformatf( "C#(%0d)" ,BITWIDTH ) ;
typedef uvm_component_registry #( C #( BITWIDTH ) , type_name ) type_id ;
localparam is elaboration time constant whereas factory registration takes place before Time 0 ( may take place at elaboration time too as per this_link )
[Q3] Is there an implicit guarantee the parameter constant is initialized with correct value before factory registration takes place ?
Thanks .