Work it through
Change mode between transactions
Create an error-capable driver during build, then request a mode change while a packet is stalled.
Apply the new policy at a documented item boundary; preserve the current stalled packet.
Your next page is on its way.
Chapter 2 · Factory & stimulus
Use late binding deliberately, trace one sequence item through arbitration and pin-level driving, and coordinate multiple interfaces without hiding ownership.

A worked mechanism
A factory request chooses a class once. A configuration handle can remain shared afterward.
base_driver → error_driver
An override installed before create selects an assignment-compatible implementation.
driver.handle stays the same
A later factory override changes future creation, not this driver.
cfg.mode: NORMAL → INJECT
A live object can expose mutable policy, but consumers need a defined safe point to apply it.
Work it through
Create an error-capable driver during build, then request a mode change while a packet is stalled.
Apply the new policy at a documented item boundary; preserve the current stalled packet.
Replacing a config handle in config_db does not update handles already cached by consumers.
Record the resolved type, instance path, configuration version, and packet at which each change takes effect.
Question directory
Open an authored answer here, then follow its diagram and implementation example in context.
Use the factory to replace types at creation time and the configuration database to deliver typed settings by scope, while keeping both mechanisms predictable.
The environment still requests base_driver. The factory selects the compatible override before creation.
The component type is unchanged. A typed value, often a config object or virtual interface, controls its behavior.
A factory override changes what gets created. A config_db entry changes how an existing component behaves. Both must be installed before the consumer needs them.
The factory separates the type requested by reusable code from the type actually created, so a test can substitute behavior without editing the environment.
type_id::create() asks the factory to resolve that proxy using type and instance overrides.create() call. Factory debug output is the fastest way to prove what the resolver selected.Register both classes, install an override in the test before the environment creates the driver, and keep the environment's base_driver::type_id::create() call unchanged.
new(), a late override, or a mismatched instance path.function void build_phase(uvm_phase phase);
base_driver::type_id::set_type_override(
error_injecting_driver::get_type()
);
// The base test creates env after the override is installed.
super.build_phase(phase);
endfunctionuvm_config_db is a typed, scope-aware interface over the UVM resource database. It lets a producer configure a descendant without compiling against that descendant's exact handle path.
// Test or top-level environment
uvm_config_db#(virtual axi_if)::set(
this, "env.axi_agent*", "vif", axi_vif
);
// Agent or child component
if (!uvm_config_db#(virtual axi_if)::get(
this, "", "vif", vif)) begin
`uvm_fatal("NO_VIF", "axi_if was not configured")
endThe utils macros declare the conventional factory registry and type-introspection plumbing for a user class. The begin/end variants can also add field automation.
type_id proxy and methods such as get_type() and get_type_name() needed by the common factory workflow.do_copy, do_compare, and related methods are often clearer for important classes.Trace arbitration, request delivery, pin driving, completion, and multi-interface coordination without confusing sequences, sequencers, items, or drivers.
start_item()wait for grantfinish_item()send requestget_next_item()receive requestdrive()honor protocolitem_done()release sequenceThe sequence creates intent, the sequencer arbitrates, the driver converts the granted item to signal activity, and the DUT sees only the interface protocol.
The item is one transaction, the sequence generates or coordinates transactions, and the sequencer arbitrates access from one or more sequences to a driver.
body() creates items or starts child sequences to express a scenario.| Type | Role | UVM base |
|---|---|---|
| Sequence item | One transaction | uvm_object |
| Sequence | Scenario or item stream | uvm_object |
| Sequencer | Arbitration and transport | uvm_component |
| Driver | Transaction to pins | uvm_component |
start_item() waits for a sequencer grant. finish_item() sends the prepared request and waits for driver completion. The driver receives it with get_next_item() and releases the sequence with item_done().
start_item() returns, randomize or fill the item without consuming simulation time, then call finish_item().get_next_item() blocks until a request has been sent. The driver converts the item to signal activity and calls item_done(), optionally supplying a response.finish_item() returns after completion. The sequence can then issue another item or retrieve a separate response when the protocol uses one.// Sequence
start_item(req); // waits for grant
assert(req.randomize());
finish_item(req); // sends, then waits for item_done
// Driver
seq_item_port.get_next_item(req);
drive_one_transfer(req);
seq_item_port.item_done();A virtual sequence coordinates child sequences across multiple interface sequencers so a system-level scenario can express ordering and concurrency in one place.
m_sequencer is the base-class handle set when a sequence starts. The uvm_declare_p_sequencer macro declares a typed p_sequencer handle and casts m_sequencer into it.
m_sequencer preserves generic sequence behavior because its type is uvm_sequencer_base.p_sequencer gives convenient access to subtype-specific fields, especially leaf-sequencer handles in a virtual sequencer.