Part 3 · Factory & Configuration · Intermediate

Field Macro Performance: FLAGS Tuning for Hot Paths

How UVM_ALL_ON print, compare, and pack affect regression throughput, and which FLAGS to trim on high-frequency transaction classes.

Performance impact model

Field automation runs on every print, copy, compare, and pack call . On high-frequency transactions, UVM_ALL_ON across large members dominates simulation time and log volume.

diagram
[UVM] hot-path cost drivers

  sprint() in monitor/scoreboard loop     -> do_print per field
  compare() on every observed txn         -> field-by-field walk
  pack() for recording                    -> array serialization

high frequency x many fields x UVM_ALL_ON = regression pain
systemverilog
// Heavy payload: trim automation on non-checker fields
`uvm_field_array_int(payload, UVM_NOCOPY | UVM_NOPACK | UVM_NOPRINT | UVM_NOCOMPARE)
`uvm_field_int(addr,         UVM_ALL_ON)
`uvm_field_int(len,          UVM_ALL_ON)
`uvm_field_int(pkt_id,       UVM_ALL_ON | UVM_NOCOMPARE)

Key takeaways

  • Default to minimal FLAGS on large arrays and queues.

  • Keep full automation only on fields scoreboards actually compare.

  • Move verbose sprint to UVM_HIGH or conditional compile guards.

Common pitfalls

  • Logging sprint() at UVM_MEDIUM inside monitor run loops.

  • UVM_ALL_ON on 4KB payload arrays printed every cycle.

  • Auto-compare on fields that change cosmetically but not semantically.


Tuning checklist and alternatives

Profile before tuning: identify which transaction classes appear in hot paths, then trim FLAGS surgically.

FLAGS tuning matrix

diagram
[UVM] field category -> recommended FLAGS

checker-critical scalars     UVM_ALL_ON
timestamps / sim time        UVM_ALL_ON | UVM_NOCOMPARE
large payload arrays         UVM_NOPRINT | UVM_NOPACK | UVM_NOCOMPARE
debug-only diagnostics       UVM_NOPRINT (enable via `ifdef DEBUG_TXN)
nested config objects        UVM_ALL_ON on uvm_field_object (clone path)
  • Gate verbose print behind plusarg-controlled verbosity.

  • Use custom do_compare with early exit on key fields only.

  • Consider hand-written do_print for one-line summary in hot paths.

Measurement pattern

systemverilog
int compare_count;
function bit do_compare(uvm_object rhs, uvm_comparer comparer);
  compare_count++;
  return super.do_compare(rhs, comparer);
endfunction

function void report_phase(uvm_phase phase);
  super.report_phase(phase);
  `uvm_info("PERF", $sformatf("compare_count=%0d", compare_count), UVM_LOW)
endfunction
diagram
[CONFIG] regression perf smoke

1) run nightly seed with default verbosity
2) note compare_count and log size
3) trim FLAGS on top offender class
4) rerun same seed — compare_count and log bytes should drop

Common pitfalls

  • Disabling compare on fields the scoreboard still checks manually.

  • Tuning FLAGS without rerunning the same seed for A/B comparison.

  • Hand-writing do_print that duplicates every field anyway.