Part 3 · Factory & Configuration · Intermediate
Factory & Configuration
UVM factory registration, overrides, config_db, virtual interface distribution, and field automation — the two indirection layers for reusable testbenches.
Factory decides which class; config_db decides how it is configured
Reusability comes from not hard-coding decisions in the environment. The factory picks the class at create time; config_db supplies handles and parameters before build_phase.
Factory & config topic map
Legend: [FACTORY] [CONFIG] [HDL] [UVM]
┌─────────────────────────────────────────────────────────────────────────┐
│ FACTORY & CONFIG — 5 topic hubs (each with 5–6 sub-lessons) │
├─────────────────────────────────────────────────────────────────────────┤
│ 1. FACTORY [FACTORY] registry │ type_id::create │ registration │
│ 2. OVERRIDES [FACTORY] type vs instance │ precedence │ timing │
│ 3. CONFIG_DB [CONFIG] set/get │ paths │ wildcards │ resolution │
│ 4. VIF DIST [HDL] static bridge │ single/multi instance patterns │
│ 5. RESOURCES [UVM] resource_db │ field macros │ print/copy/compare │
└─────────────────────────────────────────────────────────────────────────┘Two mechanisms diagram
[HDL] top ──config_db.set(vif)──► [CONFIG]
└── run_test() ──factory.create()──► [FACTORY]
▼
[UVM] test: set_type_override + config_db.set(cfg)
env build: type_id::create() + config_db.get(vif)
FACTORY: WHICH class? CONFIG: WITH WHAT settings?Topics and sub-topics
UVM Factory — 6 sub-lessons on registration, type_id, and create().
Type vs Instance Overrides — 6 sub-lessons on scope, precedence, and Liskov safety.
uvm_config_db — 6 sub-lessons on set/get, paths, wildcards, and resolution.
Virtual Interface Distribution — 6 sub-lessons on HDL→UVM vif patterns.
Resources & Field Macros — 6 sub-lessons on resource_db and field automation.
Key takeaways
Factory = which class is built; config_db = how that instance is configured.
Overrides before create(); config set before consumer build_phase get().
Virtual interfaces cross from static HDL into dynamic UVM via config_db.
How to use this section
Keep factory and config separate in your mental model. Most confusion comes from mixing override timing with config_db path mistakes.
Never use new() for UVM components — always type_id::create() through the factory.
Set config and overrides in test build_phase before env children build.
Use instance paths and wildcards deliberately — sloppy paths cause silent misconfiguration.