Part 7 · Environment & Tests · Intermediate

Interface config_db: Path-Safe Virtual Interface Handoff

Reliable set/get contracts for virtual interfaces, including type/key/path alignment and fast-fail diagnostics.

Core Contract

Keep this startup boundary deterministic, observable, and fail-fast.

Treat startup as reusable infrastructure: ownership, ordering, and liveness checks must be explicit.

diagram
[UVM][ENV] vif publication contract

set in top:
  type + key + path

get in agent/env:
  same type + key + reachable scope

contract mismatch => null handle
diagram
[UVM][ENV] boundary model

boundary A: ownership and lifecycle
boundary B: publication and path scope
boundary C: first-activity liveness proof

fix the first broken boundary first
  • Document ownership and ordering assumptions in code, not only slides.

  • Make startup diagnostics actionable and low-noise.

  • Prefer deterministic startup defaults over convenience shortcuts.


Reference Implementation

systemverilog
initial begin
  uvm_config_db#(virtual axi_if)::set(null, "uvm_test_top.env.axi_agt*", "vif", axi_if0);
  uvm_config_db#(virtual apb_if)::set(null, "uvm_test_top.env.apb_agt*", "vif", apb_if0);
  run_test();
end

class axi_agent extends uvm_agent;
  `uvm_component_utils(axi_agent)
  virtual axi_if vif;

  function void build_phase(uvm_phase phase);
    super.build_phase(phase);
    if (!uvm_config_db#(virtual axi_if)::get(this, "", "vif", vif))
      `uvm_fatal("NOVIF", $sformatf("missing vif at %s", get_full_name()));
  endfunction
endclass
diagram
[ENV] implementation audit

- critical startup assumptions validated?
- missing-state paths fail immediately?
- diagnostics include component path and context?
- minimal smoke seed can exercise this boundary?
diagram
[UVM][ENV] startup observability

track timestamps/counters for:
  reset release
  first sequence launch
  first monitor publish
  first checker compare

these markers reduce triage latency dramatically
  • Keep startup code simple enough to audit in code review.

  • Use fatal failures for non-recoverable startup contract violations.

  • Expose startup metrics in report_phase for CI artifacts.


Debug Workflow

Triage order

  1. Reproduce with one seed and startup tracing enabled.

  2. Verify startup boundary counters and first-activity markers.

  3. Classify failure by boundary before deep waveform analysis.

  4. Fix root boundary and rerun identical seed to confirm.

bash
simv +UVM_TESTNAME=smoke_test        +UVM_VERBOSITY=UVM_LOW        +UVM_CONFIG_DB_TRACE        +UVM_OBJECTION_TRACE
diagram
[UVM][ENV] quick diagnosis

fails before build:
  run_test/factory/config publish issue

build passes, no traffic:
  reset/sequence launch gating issue

monitor active, checker idle:
  connect/subscriber pipeline issue

Key takeaways

  • Type, key, and path must match exactly between set and get.

  • Failing fast on missing vifs saves hours of downstream debug.

  • Scoped paths are safer than broad wildcards for large envs.

  • A deterministic startup workflow improves regression trust and team velocity.

Common pitfalls

  • Ignoring get() return values and debugging null later.

  • Over-broad wildcard paths leaking wrong interfaces.

  • Renaming hierarchy without updating set scopes.

  • Skipping startup smoke and finding setup regressions only in long runs.


Applied Patterns

Use this reusable grid before landing startup-related changes.

diagram
[UVM][ENV] startup pattern grid

contract:
  ownership + ordering + liveness documented

implementation:
  fail-fast checks and deterministic defaults

observability:
  milestone counters and concise logs

verification:
  smoke seed + boundary-first triage + closure checklist
systemverilog
function void startup_health_report();
  `uvm_info("STARTUP_SUMMARY",
    $sformatf("rst=%0t seq=%0t mon=%0t cmp=%0t",
      first_reset_release_time,
      first_sequence_start_time,
      first_monitor_publish_time,
      first_scoreboard_compare_time),
    UVM_LOW)
endfunction
  • Treat startup updates as infrastructure API changes.

  • Keep code and checklist language aligned.

  • Require stable startup summaries in regression logs.