Out of curiosity I was trying an example of running a parameterized test ( registered via `uvm_component_utils macro ) .
`include "uvm_macros.svh"
`include "uvm_pkg.sv"
import uvm_pkg::* ;
`define COMP function new( string name , uvm_component parent );\
super.new(name,parent);\
endfunction
class test #( BITWIDTH = 128 ) extends uvm_test ;
`uvm_component_utils( test #(BITWIDTH) ) // What would be String Registration ??
`COMP
function void build_phase ( uvm_phase phase ) ;
`uvm_info(get_name(),$sformatf(" In build_phase of test#( %0d ) ", BITWIDTH ) , UVM_NONE)
endfunction
endclass
module top_tb ;
test #( 256 ) test_256 ; // [A] Specialization Needed since Parameterized Class !!
initial begin
run_test("test#(256)"); // Issue with this !!
end
endmodule
I Observe Output ::
UVM_WARNING @ 0: reporter [BDTYP] Cannot create a component of type ‘test #(256)’ because it is not registered with the factory.
UVM_FATAL @ 0: reporter [INVTST] Requested test from call to run_test(test#(256)) not found.
However if I change the string argument to run_test() to ::
run_test("test#(BITWIDTH)"); // This works !!
I understand that String Registration occus via Text Substitution macro ( "
" ) internally .
So shouldn’t the actual value ( 256 ) be used instead of parameter name??
One possibility I see is that macro `uvm_component_utils gets expanded at Compile time whereas the specialization occurs at elaboration time .