Wednesday, 14 June 2017

run_test() and UVM_TESTNAME

Three are two ways to provide testcase name:
  1. In top module, run_test(<testcase_name>)
  2. Command line argument, UVM_TESTNAME=<testcase_name>
So here we're calling run_test inside top module. Now this run_test is implemented inside the uvm_globals.svh. This method is not defined in any class, this is a method defined in package.

Inside uvm_globals.svh :
--------------------------------------------------------------------------------
task run_test (string test_name="");
  uvm_root top;
  top = uvm_root::get();
  top.run_test(test_name);
endtask
--------------------------------------------------------------------------------
This run_test() is calling run_test of uvm_root and here name of testcase is getting stored inside "test_name" variable.

Implementation of command-line UVM_TESTNAME is also done inside run_test() of uvm_root.

Inside uvm_root file:
--------------------------------------------------------------------------------
task uvm_root::run_test(string test_name="");
...
  test_name_count = clp.get_arg_values("+UVM_TESTNAME=", test_names);

  // If at least one, use first in queue.
  if (test_name_count > 0) begin
    test_name = test_names[0];
    testname_plusarg = 1;
  end
...
endtask
--------------------------------------------------------------------------------

So whenever we pass UVM_TESTNAME it will be stored inside the "test_name" variable of uvm_root, which means if we have passed testcase name using run_test(), it will be overwritten by testcase name passed through UVM_TESTNAME.

Example:
--------------------------------------------------------------------------------
module top();
...
initial begin
run_test("my_test");
end
endmodule: top
--------------------------------------------------------------------------------

Testname passed through command line argument:
--------------------------------------------------------------------------------
./simv +UVM_TESTNAME=user_test
--------------------------------------------------------------------------------

If we have passed testcase name using both the above methods, user_test will be run as it is passed through command line argument.

PS:: Not only run_test() but global_stop_request(), set_global_timeout() [and many more] are also implemented inside uvm_globals.svh

1 comment:

  1. What are the best casinos to play with real money?
    The casino games 제주도 출장안마 are fun 밀양 출장마사지 and easy 화성 출장마사지 to play and you should try them out 제주도 출장안마 and decide for yourself what to do and should 충주 출장마사지 not play on an online

    ReplyDelete