Factory and Test Selection¶
Pick the test at run time¶
Choose the test when you run the simulation, as in standard UVM:
vvp vw_ivl_ivl_uvm.vvp +UVM_TESTNAME=my_test
You can also pass the name in the source:
initial run_test("my_test");
The name comes from the first of these that is set:
+UVM_TESTNAMEon the command line (it overrides the argument, as in standard UVM)the argument of
run_testthe
UVM_TESTNAMEmacro at compile time (its default,uvm_test, counts as no name)
If the name is not registered, the run stops with
UVM_FATAL [INVTST] Requested test ... not found.
With no name at all, no test is created and the components created before the call are run. If
there are none, the run stops with UVM_FATAL [NOCOMP]. A second run_test call that names a
test stops with UVM_FATAL [TTINST].
A test class¶
A test registers itself with the same macro you use in standard UVM. You write no registration call.
package test_pkg;
import ivl_uvm_pkg::*;
class my_test extends uvm_test;
`uvm_component_utils(my_test)
function new (string name = "my_test", uvm_component parent = null);
super.new(name, parent);
endfunction : new
endclass : my_test
endpackage : test_pkg
module top;
import ivl_uvm_pkg::*;
import test_pkg::*;
initial begin
run_test();
$finish;
end
endmodule : top
uvm_test is abstract, as in standard UVM, so every test needs a class like my_test.
The constructor must take (name, parent).
run_test returns after the phases have run, so the module ends the simulation with $finish.
Without it the simulation runs on until the global timeout and reports a timeout error.
The factory¶
factory is a global handle, as in UVM.
Method |
Purpose |
|---|---|
|
Create a registered component |
|
Create a component from its |
|
Create a registered object |
|
Create an object from its |
|
Check that a type is registered |
|
List the registered types in the standard UVM format |
Example:
uvm_component c;
c = factory.create_component_by_name("my_test", "", "t0", null);
factory.print();
Things to know¶
The type name is the class name as written in
uvm_component_utilsoruvm_object_utils.At time 0 the factory builds one prototype instance of each registered class (named
m_ivl_proto), passingparent = null. Keep the constructor of a registered class free of side effects and do not useparentthere without checking it.my_class::type_id::create(name, parent)works for components andtype_id::create(name)for objects, as in standard UVM.type_id::get(),get_type()andget_object_type()work too.Type and instance overrides are not available yet. See Differences from Standard UVM.