Part 2 · Phases & Lifecycle · Intermediate

Phase Domain Concept: Independent Runtime Schedules

uvm_domain fundamentals — common domain, set_domain(), runtime-only scope, and how the scheduler tracks multiple phase pointers.

What is a phase domain?

A uvm_domain owns a complete copy of the UVM runtime phase schedule: pre_reset through post_shutdown. Every component belongs to exactly one domain. The common domain is the default — all components start there unless moved with set_domain().

diagram
[PHASE][UVM] domain state machine (per domain)

each domain tracks its own current runtime phase:

  domain A: main_phase        (running stimulus)
  domain B: reset_phase       (still in reset)

both advance independently unless sync() aligns them
  • Function phases (build, connect, extract, check) are global — not domain-specific.

  • Only the 12 runtime sub-phases and run_phase parallelism are domain-scoped.

  • A component's domain is set in build_phase before run-time starts.


API essentials

systemverilog
uvm_domain common = uvm_domain::get_common_domain();
uvm_domain custom = new("my_domain");

// Move subtree onto custom domain (in build_phase)
my_subenv.set_domain(custom);

// Query
uvm_domain d = my_agent.get_domain();
`uvm_info("DOM", d.get_name(), UVM_MEDIUM)
systemverilog
// Domain assignment must happen before run-time phases begin
function void build_phase(uvm_phase phase);
  super.build_phase(phase);
  island_env = island_env_c::type_id::create("island_env", this);
  uvm_domain island_dom = uvm_domain::get_domains()["island_dom"];
  if (island_dom == null) begin
    island_dom = new("island_dom");
  end
  island_env.set_domain(island_dom);
endfunction

Key takeaways

  • One domain = one independent runtime phase pointer.

  • set_domain() in build_phase moves a subtree off the common schedule.

  • Function phases remain global across all domains.

Common pitfalls

  • Calling set_domain after run-time has started — too late.

  • Creating a new domain per agent instead of per subsystem subtree.

  • Expecting domains to isolate build_phase ordering — they do not.


Mental model

diagram
[PHASE][UVM] two-domain timeline (same sim time)

sim time 
common:  |--reset--|--configure--|----main----|--shutdown--|
island:  |-----reset-----|--configure--|---main---|

sync at reset_phase: both domains wait until both reach reset