Module 8 — UVM Basics
The Universal Verification Methodology, from the ground up: why it exists, its layered architecture, the uvm_object/uvm_component split, factory-based construction, config_db, TLM communication, and every core component — sequences, drivers, monitors, agents, environment, scoreboard, test, and phases.
📑 Table of Contents
60Why UVM
Before UVM, teams built testbenches with ad-hoc SystemVerilog class hierarchies, or used competing proprietary methodologies (VMM, OVM, e-based Specman). UVM (built on OVM, standardized by Accellera and later IEEE 1800.2) solved the fragmentation problem: a single, standardized, reusable base-class library and set of conventions for building constrained-random, coverage-driven testbenches.
| Problem Without UVM | How UVM Solves It |
|---|---|
| Every team reinvents driver/monitor/scoreboard patterns | Standard base classes (uvm_driver, uvm_monitor, etc.) with proven structure |
| Hard to reuse verification IP (VIP) across projects | Factory + config_db make components swappable/configurable without editing code |
| Manual, error-prone testbench-to-DUT wiring | TLM ports/exports standardize component communication |
| No standard simulation lifecycle | Built-in phasing (build, connect, run, etc.) synchronizes setup and execution |
| Vendor lock-in (proprietary methodologies) | IEEE-standardized, supported across all major simulators |
UVM exists so that verification engineers stop rebuilding the same testbench plumbing from scratch every project, and can instead focus effort on the DUT-specific stimulus, checking, and coverage logic.
61UVM Architecture
A UVM testbench is a layered hierarchy of reusable components, mirroring the DUT's interface structure, with clear separation between stimulus generation, driving, monitoring, and checking.
Stimulus generation (sequences) is decoupled from stimulus driving (drivers) via the sequencer, and checking (scoreboard) is decoupled from observation (monitor) via analysis ports — this separation is what makes UVM components independently reusable across projects.
62UVM Components
"Component" in UVM specifically refers to classes extending uvm_component — the structural, persistent building blocks of the testbench hierarchy (as opposed to transient uvm_object-based data like transactions).
| Component | Base Class | Role |
|---|---|---|
| Driver | uvm_driver | Converts transactions into pin-level DUT activity |
| Monitor | uvm_monitor | Observes pin activity, reconstructs transactions |
| Sequencer | uvm_sequencer | Arbitrates and feeds transactions to the driver |
| Agent | uvm_agent | Groups sequencer+driver+monitor for one interface |
| Environment | uvm_env | Groups agents, scoreboard, coverage collectors |
| Test | uvm_test | Top of the hierarchy; configures env and starts sequences |
| Scoreboard | uvm_scoreboard (or uvm_component) | Checks DUT behavior against a reference model |
63uvm_object
uvm_object is the base class for all transient, data-like UVM classes — transactions, configuration objects, sequences — anything created, used, and destroyed dynamically rather than persisting as part of the fixed testbench structure.
Because everything inherits from uvm_object, UVM can provide generic, reusable utilities like .copy(), .compare(), .print(), .clone(), and factory-based creation for ANY derived class, as long as the field macros or manual overrides are provided.
64uvm_component
uvm_component is the base class for structural, persistent testbench building blocks — drivers, monitors, agents, environments, tests. Unlike uvm_object, its constructor takes a parent handle to establish hierarchy, and it participates in the phasing mechanism.
| Aspect | uvm_object | uvm_component |
|---|---|---|
| Lifetime | Transient — created/destroyed freely | Persistent — built once, lives for the whole test |
| Constructor Args | string name | string name, uvm_component parent |
| Participates in Phasing? | No | Yes (build_phase, run_phase, etc.) |
| Examples | Transactions, sequences, config objects | Driver, monitor, agent, env, test, scoreboard |
65Factory
The UVM factory is a registry-based object creation mechanism — instead of directly calling new(), components and objects are created via ::type_id::create(), which allows any registered class to be transparently substituted (overridden) at runtime without editing existing code.
The factory is what makes UVM VIP truly reusable: a base environment can be dropped into a new test unmodified, and specific components swapped out per test using overrides — no editing of the reusable environment/agent code required.
66Configuration Database
The uvm_config_db is a global, hierarchical key-value store used to pass configuration data (virtual interfaces, knobs, objects) top-down through the testbench hierarchy without hardcoding paths or manually threading arguments through every constructor.
Forgetting the uvm_config_db::set() call in the top module — or getting the instance path wildcard wrong — is the single most common cause of a "virtual interface is null / not set" fatal error at simulation start. Always get() with a fatal check as shown above so the failure is immediate and obvious.
67TLM
Transaction-Level Modeling (TLM) ports/exports/analysis-ports are UVM's standardized inter-component communication mechanism — components exchange whole transactions (not signal-level pin toggling) through typed, connectable interfaces.
The driver-sequencer connection uses a different TLM flavor: seq_item_port (driver side) and seq_item_export (sequencer side), with request/response semantics (get_next_item/item_done) rather than the broadcast-style analysis port used for monitor→scoreboard communication.
68Sequences
A uvm_sequence generates a stream of transactions and sends them to a driver through a sequencer — sequences are where randomized, scenario-specific stimulus logic lives, kept cleanly separate from the driver's pin-wiggling responsibilities.
These bracket exactly where sequencer arbitration and randomization happen — start_item() waits for the sequencer to grant this sequence access, and finish_item() sends the (typically just-randomized) item to the driver and blocks until item_done() is called back.
69Drivers
A uvm_driver pulls transactions from the sequencer and converts them into actual pin-level activity on the DUT interface, cycle by cycle — it's the only component that should ever directly wiggle DUT signals for stimulus.
70Monitors
A uvm_monitor passively observes DUT interface pins (never drives them), reconstructs transactions from the observed signal activity, and broadcasts them via an analysis port for scoreboards and coverage collectors to consume.
A monitor should never drive any DUT signal — its only job is observation. This separation is what lets the same monitor be reused whether the agent is configured active (driving stimulus) or passive (checking-only, e.g. for a bus already driven by another VIP).
71Agents
A uvm_agent packages the sequencer, driver, and monitor for one DUT interface/protocol into a single reusable unit, with an is_active knob to switch between fully active (drives + monitors) and passive (monitor-only) operation.
72Environment
A uvm_env is the container above agents — it groups one or more agents plus shared components like the scoreboard and coverage collector, and typically represents "the whole reusable verification environment for this DUT."
A well-built uvm_env should be droppable into many different tests unmodified — all per-test variation (which sequences run, which knobs are set) belongs in the test class, not the environment.
73Scoreboard
A scoreboard checks DUT correctness by comparing actual observed outputs (from monitors) against expected outputs (from a reference model or predicted values) — the component where pass/fail correctness checking actually happens.
74Test
A uvm_test sits at the very top of the hierarchy — it builds (or configures) the environment, applies test-specific factory overrides, and starts the sequence(s) that define this particular test scenario.
75Phases
UVM phasing synchronizes the setup and execution lifecycle across every component in the hierarchy automatically — build first, then connect, then run, then cleanup — so components don't need custom hand-written synchronization to know when it's safe to, say, access a child that hasn't been constructed yet.
| Phase | Type | Typical Use |
|---|---|---|
| build_phase | Function (top-down) | Construct child components via the factory |
| connect_phase | Function (bottom-up) | Connect TLM ports/exports between components |
| end_of_elaboration_phase | Function | Final setup/sanity checks after full hierarchy exists |
| start_of_simulation_phase | Function | Last chance for setup right before time advances |
| run_phase | Task (consumes simulation time) | Main stimulus generation and checking activity |
| extract_phase | Function | Extract results/scoreboard data after run_phase ends |
| check_phase | Function | Final correctness checks (e.g. no pending transactions) |
| report_phase | Function | Print final pass/fail summary |
"Why is run_phase a task and not a function?" — Because it's the only phase (among the standard ones) allowed to consume simulation time (via #delay, @(posedge clk), wait, etc.); build/connect and the other structural phases must complete instantaneously at time 0 so the entire hierarchy is fully built and wired before any stimulus begins.
🎯 Module 8 Recap
- UVM standardizes testbench structure so verification IP is reusable across projects instead of rebuilt from scratch each time.
uvm_object= transient data (transactions, sequences);uvm_component= persistent structural hierarchy (driver, monitor, agent, env, test).- The factory (
::type_id::create()) enables transparent class substitution via overrides, without touching existing code. - config_db passes configuration (especially virtual interfaces) top-down through the hierarchy — a null/unset vif is the most common UVM runtime error.
- TLM analysis ports let a monitor broadcast to any number of subscribers (scoreboard, coverage) with a single
write()call. - Data flow: sequence generates transactions → sequencer arbitrates → driver drives pins → monitor passively observes → scoreboard checks correctness.
- Agent bundles sequencer+driver+monitor with an active/passive switch; environment bundles agents + scoreboard + coverage; test configures everything and starts sequences.
- Phasing (build → connect → run → check → report) automatically synchronizes setup order across the entire hierarchy — build_phase runs top-down, connect_phase runs bottom-up.
📚 Next up — Module 9: Advanced UVM (callbacks, objections, virtual sequences, register model, sequence library, report server, factory overrides, resource database)
↑ Back to Table of Contents
Comments
Post a Comment