UVM Coding Practice · Senior
Factory & config_db Tricky Q&A
20 factory/config interview questions.
Q&A bank
Factory/config interview bank.
set_type_override order?
diagram
[INT][SENIOR][UVM-CODE]
Q: set_type_override order?
A:
Before create() of target type — usually in test build.
FOLLOW-UP TRAP: Override after env built.set_inst_override vs type?
diagram
[INT][SENIOR][UVM-CODE]
Q: set_inst_override vs type?
A:
inst: specific path; type: all instances of base.
FOLLOW-UP TRAP: Wrong override granularity.config_db set path null?
diagram
[INT][SENIOR][UVM-CODE]
Q: config_db set path null?
A:
set(null, path, field) broadcasts to subtree.
FOLLOW-UP TRAP: Wrong path string missing agent.get in build vs connect?
diagram
[INT][SENIOR][UVM-CODE]
Q: get in build vs connect?
A:
build: structure; connect: TLM after children exist.
FOLLOW-UP TRAP: get vif in connect when set in child build.Resource pool vs config_db?
diagram
[INT][SENIOR][UVM-CODE]
Q: Resource pool vs config_db?
A:
resource global; config_db hierarchical scoped.
FOLLOW-UP TRAP: Same key collision.Wildcard set?
diagram
[INT][SENIOR][UVM-CODE]
Q: Wildcard set?
A:
uvm_config_db::set(this, "*", "vif", vif) — use sparingly.
FOLLOW-UP TRAP: Wildcard hides wrong path bugs.Null vif symptom?
diagram
[INT][SENIOR][UVM-CODE]
Q: Null vif symptom?
A:
Driver idle forever — no wiggles.
FOLLOW-UP TRAP: Debug driver before config.Factory print?
diagram
[INT][SENIOR][UVM-CODE]
Q: Factory print?
A:
factory debug — see overrides applied.
FOLLOW-UP TRAP: Guess override not applied.create by name vs type_id?
diagram
[INT][SENIOR][UVM-CODE]
Q: create by name vs type_id?
A:
type_id::create preferred — factory aware.
FOLLOW-UP TRAP: new() bypasses override.Override seq item type?
diagram
[INT][SENIOR][UVM-CODE]
Q: Override seq item type?
A:
set_type_override for pkt base → derived pkt.
FOLLOW-UP TRAP: Override sequencer instead.config_db audit?
diagram
[INT][SENIOR][UVM-CODE]
Q: config_db audit?
A:
uvm_config_db::dump(); at end of build.
FOLLOW-UP TRAP: Never dump — mystery get fails.set_inst path example?
diagram
[INT][SENIOR][UVM-CODE]
Q: set_inst path example?
A:
uvm_test_top.env.agent0.driver
FOLLOW-UP TRAP: Typo in instance string.Resource precedence?
diagram
[INT][SENIOR][UVM-CODE]
Q: Resource precedence?
A:
Higher precedence wins — set_precedence.
FOLLOW-UP TRAP: Lower wins assumption.Broken top.sv classic bug?
diagram
[INT][SENIOR][UVM-CODE]
Q: Broken top.sv classic bug?
A:
set vif to wrong path — agent looks uvm_test_top.env.agent.
FOLLOW-UP TRAP: Set in agent not top.Per-test cfg object?
diagram
[INT][SENIOR][UVM-CODE]
Q: Per-test cfg object?
A:
cfg in config_db as object — agent casts in build.
FOLLOW-UP TRAP: Global params package only.Factory override seq?
diagram
[INT][SENIOR][UVM-CODE]
Q: Factory override seq?
A:
Rare — override item or use factory for tests.
FOLLOW-UP TRAP: Override driver only forgetting seq item.Multiple gets same field?
diagram
[INT][SENIOR][UVM-CODE]
Q: Multiple gets same field?
A:
Last set wins in scope — know precedence.
FOLLOW-UP TRAP: Assuming first set permanent.Virtual interface typing?
diagram
[INT][SENIOR][UVM-CODE]
Q: Virtual interface typing?
A:
apb_vif in package; config_db holds virtual apb_vif.
FOLLOW-UP TRAP: Concrete modport mismatch.Whiteboard config_db 10 min?
diagram
[INT][SENIOR][UVM-CODE]
Q: Whiteboard config_db 10 min?
A:
top set null + agent get path diagram.
FOLLOW-UP TRAP: Write full env code.ENV vs TEST config?
diagram
[INT][SENIOR][UVM-CODE]
Q: ENV vs TEST config?
A:
Test sets policy; env sets defaults — document split.
FOLLOW-UP TRAP: Agent reads plusarg directly.