Search code examples
system-veriloguvm

OVM: how to get test name in a class which declared inside the env?


We are using OVM not UVM:

I have tried using:

ovm_root::get().ovm_test_top.sprint();

But I get this error:

Could not find member 'ovm_test_top' in class 'ovm_root', at
".../ovm_root.svh", 68.

There I see:

/* deprecated */ ovm_component ovm_test_top;

Any ideas what should I do instead?


Solution

  • ovm_test_top is the string name of the top level test. You can do

    ovm_component test;
    string testname;
    test = ovm_root::get().find("ovm_test_top");   
    testname = test.get_type_name();