UVM Testbench Architecture: A Complete Walkthrough
How a UVM testbench is built end to end — test, environment, agent, sequencer, driver, monitor, scoreboard and coverage — with a diagram, code and the questions interviewers ask.
The Universal Verification Methodology (UVM) is the industry-standard SystemVerilog library for building reusable, constrained-random verification environments. Because verification consumes roughly 70% of a modern design cycle, UVM structure is the single most-tested topic in Design Verification interviews. This guide walks the whole testbench top to bottom.
Key idea. A UVM testbench is really one idea repeated: small, reusable components that talk over standard TLM interfaces, so the same environment scales from a single block up to a full SoC.
The big picture
Read it top-down. The test picks a configuration and starts a stimulus sequence. It builds an environment that contains one or more agents. Each agent bundles the three components that touch the pins — a sequencer, a driver and a monitor — while the scoreboard and coverage collector sit alongside and judge the result.
The components you must know
| Component | Responsibility |
|---|---|
| uvm_test | Top-level: selects config + starts the top sequence. |
| uvm_env | Container that wires agents, scoreboard and coverage together. |
| uvm_agent | Reusable bundle: sequencer + driver + monitor for one interface. |
| uvm_sequencer | Arbitrates sequences and hands transactions to the driver. |
| uvm_driver | Converts transactions into pin-level activity on the DUT. |
| uvm_monitor | Passively samples pins and broadcasts observed transactions. |
| uvm_scoreboard | Compares observed behaviour against a reference model. |
| coverage collector | Subscribes to the monitor and samples functional coverage. |
How a transaction flows
- A sequence creates a transaction (a
uvm_sequence_item) and callsstart_item/finish_item. - The sequencer arbitrates and hands the item to the driver.
- The driver calls
get_next_item, wiggles the DUT pins per the protocol, then callsitem_done. - The monitor samples those pins independently and reconstructs a transaction.
- The monitor broadcasts it on an analysis port; the scoreboard and coverage collector both receive it.
- The scoreboard compares against a reference model; coverage samples the bins that were hit.
task my_driver::run_phase(uvm_phase phase);
forever begin
seq_item_port.get_next_item(req); // block until a transaction
drive_transfer(req); // wiggle the pins
seq_item_port.item_done(); // release the sequencer
end
endtaskActive vs passive agents
An agent's is_active field decides whether it drives. UVM_ACTIVE builds the sequencer and driver (it stimulates the interface); UVM_PASSIVE builds only the monitor. This one switch is why UVM reuses so well: a block-level agent that drove an interface becomes a passive checker when the block is dropped into an SoC and driven by real neighbours.
Phasing in one minute
Components run through ordered phases. build_phase constructs children (top-down), connect_phase wires TLM ports (bottom-up), and the time-consuming run_phase is where stimulus actually happens. A test stays alive by raising an objection at the start of run_phase and dropping it when done.
Watch out. The three classic UVM bugs interviewers probe: forgetting to register a component with the factory (the uvm_component_utils macro), passing handles by hand instead of the config_db, and never raising or dropping objections so the test ends at time 0.
Common interview questions
- What is the difference between a driver and a monitor, and why is the monitor always passive?
- Walk me through the sequencer–driver handshake (
get_next_itemvsitem_done). - What do UVM_ACTIVE and UVM_PASSIVE change, and when would you flip an agent to passive?
- How does a monitor get data to both the scoreboard and coverage — analysis port vs export?
- Why use the factory and config_db instead of
new()and direct handles? - How do objections control when the run phase ends?
Put this into practice
Drill Design Verification questions from real interview loops, then book a mock with a mentor who runs them.