3

I am wondering if it is possible to override test specified in command line via +UVM_TESTNAME by +uvm_set_type_override.

I have tried it and this is what i see in prints in log. 
UVM_INFO @ 0: reporter [RNTST] Running test Test1...
UVM_INFO @ 0: reporter [UVM_CMDLINE_PROC] Applying type override from the command line: +uvm_set_type_override=Test1,Test2

So it seems to me that test component is created first and then factory overrides are applied?

I see in uvm_root.svh following pieces of code

 // if test now defined, create it using common factory
 if (test_name != "") begin
   if(m_children.exists("uvm_test_top")) begin
     uvm_report_fatal("TTINST",
         "An uvm_test_top already exists via a previous call to run_test", UVM_NONE);
     #0; // forces shutdown because $finish is forked
  end
   $cast(uvm_test_top, factory.create_component_by_name(test_name,
         "", "uvm_test_top", null));

It is using the factory, but i don't know if actully overrides are put in. I also see code in following.

 begin
  if(test_name=="") 
     uvm_report_info("RNTST", "Running test ...", UVM_LOW); 
  else if (test_name == uvm_test_top.get_type_name())
     uvm_report_info("RNTST", {"Running test ",test_name,"..."}, UVM_LOW); 
  else
     uvm_report_info("RNTST", {"Running test ",uvm_test_top.get_type_name()," (via factory override for test \"",test_name,"\")..."}, UVM_LOW);
 end

I am wondering if the "else" part in above is ever executed? or under what condition is it executed?

Gautam
  • 375
  • 2
  • 6
  • 23

2 Answers2

0

It seems that there is an issue with command line processing ordering in the UVM—UVM_TESTNAME gets processed separate before all the other options.

It is possible to set an override before calling run_test() in the initial block.

But what is the point of setting up the test name, and then overriding it on the same command line? Why not use the overridden test name as the test?

dave_59
  • 39,096
  • 3
  • 24
  • 63
  • thanks for the answer, i agree not much of a use case for such things. Only place such thing i think is useful is there are layers of scripts which prepare a simulation command line and somewhere in mid way there is +UVM_TESTNAME=<> and we wanted to be sure to override with the required test name. Again, not much of a use case. I just wondered if anything registered with factory could be overridden. – Gautam Feb 11 '19 at 18:13
-1

In general, anything registered with the UVM Factory can be overridden at runtime with a runtime command line switch.

In the case of test names, there is a command line switch called +UVM_TESTNAME=selected_test_name_here.

Typically,

  • We may have the base test name as the default in the run(your_base_test_name) in the top module,
  • And then we can select various tests at runtime, without compiling as we run each test (as long as each test has been included in the compile
  • And the +UVM_TESTNAME=selected_test_at_runtime as we typically cycle through test names when running regressions or switching tests as we debug our design with each different test.
cursorrux
  • 1,382
  • 4
  • 9
  • 20