RTL Studio Open IDE

Wiki UVM UVM factory

UVM factory

type_id::create and type overrides without editing base tests.

type_id::create("name", parent) allocates through the factory so a test can override the type (set_type_override) without touching production code.

flowchart TB
  test[test] --> ov[set_type_override]
  ov --> fac[factory]
  fac --> create["type_id::create"]
  create --> obj[error_seq or base_seq]
// In the component:
drv = fifo_driver::type_id::create("drv", this);

// In the test:
fifo_seq::type_id::set_type_override(err_seq::get_type());

Always create, never raw new(), for UVM objects you might swap. Registration macros (uvm_object_utils, uvm_component_utils) must be present.

Wrong vs right

Wrong — drv = new("drv", this) then expecting an override to take effect.

Right — type_id::create plus an override in the test.

See also