Part 2 · Phases & Lifecycle · Intermediate
Phase Trace Tools: PHASE_TRACE, Topology, Objection Dump
Command-line and in-code debug tools for observing phase traversal, component topology, and live objection state.
Command-line traces
UVM provides built-in command-line switches that log phase and objection activity without modifying testbench code. Use them on every hang investigation.
# Standard debug invocation
simv +UVM_TESTNAME=my_test \
+UVM_PHASE_TRACE \
+UVM_OBJECTION_TRACE \
+UVM_VERBOSITY=UVM_MEDIUM \
-l sim.log+UVM_PHASE_TRACE — logs START/END for every phase on every component.
+UVM_OBJECTION_TRACE — logs raise/drop with reason string and running count.
+UVM_VERBOSITY — increase to UVM_HIGH for surrounding context.
In-code inspection
function void end_of_elaboration_phase(uvm_phase phase);
super.end_of_elaboration_phase(phase);
`uvm_info("TOPOLOGY", "=== component tree ===", UVM_LOW)
uvm_top.print_topology();
endfunction// Dump objection state mid-phase (debug only)
task run_phase(uvm_phase phase);
super.run_phase(phase);
phase.raise_objection(this, "work");
#1us;
`uvm_info("OBJ_DBG", phase.phase_done.convert2string(), UVM_NONE)
do_work();
phase.drop_objection(this, "work done");
endtask[PHASE][UVM] what to look for in PHASE_TRACE
expected:
build (top-down) → connect (bottom-up) → ... → run_phase START
red flags:
connect_phase before build_phase completes
run_phase END at time 0
same phase START twice without END (re-entry bug)Key takeaways
Run PHASE_TRACE + OBJECTION_TRACE on every hang — non-negotiable.
print_topology in end_of_elaboration catches missing components early.
convert2string() shows who still objects at any snapshot.
Common pitfalls
Filtering sim.log verbosity so PHASE_TRACE lines are lost.
Reading trace without correlating simulation time stamps.
Log grep patterns
# Find last objection raise without drop
grep OBJECTION sim.log | tail -20
# Confirm run_phase duration
grep "run_phase" sim.log | head -5
grep "run_phase" sim.log | tail -5
# Find phase ordering anomalies
grep "PHASE" sim.log | grep -E "START|END"