Part 3 · Factory & Configuration · Intermediate

Instance Paths & Wildcards: Scope Without Leaks

Designing instance paths for test-to-agent propagation, wildcard patterns, path specificity, and avoiding over-broad scope.

Path design principles

Instance paths are an interface contract between producers and consumers. Design them for stability, readability, and the narrowest scope that achieves the goal.

diagram
[CONFIG] path granularity spectrum

  MOST SPECIFIC (highest precedence)
    "env.apb0.drv"            one driver only

  AGENT SCOPE
    "env.apb0.*"              all children under apb0 agent

  ENV SCOPE
    "env.*"                   all components under env

  GLOBAL (use sparingly)
    "*"                       entire testbench

  rule: narrowest path that does the job

Wildcard patterns

systemverilog
// Every component under env.agt (driver, monitor, sequencer)
uvm_config_db#(int)::set(this, "env.agt.*", "timeout", 1000);

// Every component in the entire testbench
uvm_config_db#(int)::set(null, "*", "verbosity_knob", 3);

// Exact path — most specific, highest precedence
uvm_config_db#(int)::set(this, "env.agt0.drv", "timeout", 50);
diagram
[CONFIG] specificity example (consumer at env.agt0.drv)

  env.agt0.drv     timeout=50     ◄── wins (exact path)
  env.agt.*        timeout=1000   ◄── wins for agt1 driver
  *                verbosity=3    ◄── global fallback
  • Wildcards are powerful — an over-broad * can configure unintended components.

  • Print get_full_name() in build_phase to verify path strings match expectations.

  • Use localparam constants for path strings and field names in large projects.


Common set patterns

Test sets agent configuration

systemverilog
class base_test extends uvm_test;
  function void build_phase(uvm_phase phase);
    apb_config acfg = apb_config::type_id::create("acfg");
    acfg.is_active = UVM_ACTIVE;
    uvm_config_db#(apb_config)::set(this, "env.apb", "cfg", acfg);
    super.build_phase(phase);
  endfunction
endclass

Agent forwards vif to children

systemverilog
function void build_phase(uvm_phase phase);
  super.build_phase(phase);
  if (!uvm_config_db#(virtual apb_if)::get(this, "", "vif", vif))
    `uvm_fatal("NOVIF", "apb_if not set for agent")
  uvm_config_db#(virtual apb_if)::set(this, "*", "vif", vif);
  drv = apb_driver::type_id::create("drv", this);
  mon = apb_monitor::type_id::create("mon", this);
endfunction

Top module sets virtual interfaces

systemverilog
initial begin
  uvm_config_db#(virtual apb_if)::set(null, "uvm_test_top.env.*", "vif", apb_if_i);
  run_test();
end

Key takeaways

  • Use the narrowest wildcard that covers intended consumers.

  • Exact paths override wildcard paths for the same field.

  • Forward config from agent to children with set(this, "*", ...) after get.

Common pitfalls

  • env.* when you meant env.apb0.* — wrong agents get wrong vif.

  • Path strings that don't match eventual get_full_name() suffix.

  • Global * sets that pollute VIP internals unexpectedly.