Part 11 · Senior Prep · Intermediate

Factory & Config Interview Hub: Model Answers

Hub — senior interview Q&A on UVM factory registry, type/instance overrides, config_db, virtual interfaces, resources, and scenario wiring.

Overview

Factory and config questions test decoupling and wiring discipline — can you swap behavior at test time without editing env code, and can you debug a config_db get failure in under two minutes?

Sub-lessons in this topic

  1. factory-registry-create-qa — type_id::create, registry, new() vs create().

  2. type-instance-overrides-qa — type vs instance scope, override ordering.

  3. config-db-set-get-qa — path/name/type matching, wildcards, ordering.

  4. virtual-interface-qa — vif propagation from top to driver, timing.

  5. resource-field-macros-qa — resource_db, field macros, uvm_config_db sugar.

  6. factory-config-scenario-qa — end-to-end test wiring whiteboard scenarios.

diagram
[INT][SENIOR][UVM] MODEL ANSWER CHAIN

1. MECHANISM   — what it is / how it works (one sentence)
2. MOTIVATION  — why UVM needs this
3. WHEN-TO-USE — when you choose it AND when you skip it
4. PITFALL     — the mistake juniors make
5. EXAMPLE     — one concrete testbench scenario
diagram
[INT][SENIOR][UVM] factory + config propagation (whiteboard)

  test.build_phase:
    set_type_override(my_driver, err_driver)
    uvm_config_db#(virtual axi_if)::set(null, "env.agt*", "vif", axi_vif)
    uvm_config_db#(env_cfg)::set(this, "env*", "cfg", cfg)
         │
         ▼
  env.build  agt.build  drv.build (get vif, get cfg)
                                │
                                ▼
                         drv.run_phase (uses vif + cfg)

Key takeaways

  • Always create() via type_id — or factory overrides silently fail.

  • config_db get fails on path, name, type, or set/get ordering.

  • Prefer instance overrides for scenario isolation in multi-agent envs.

Common pitfalls

  • Using new() instead of type_id::create() — classic factory failure.

  • Wildcard set('*','*',...) masking path bugs until chip integration.

  • Setting vif after build_phase — driver already constructed without it.


Interview framing

When asked 'why not just use new()' , answer with regression reuse and override auditability — not 'because UVM says so'.

  • Draw the set/get path on the whiteboard — interviewers watch hierarchy matching.

  • Offer trade-off: factory flexibility vs debug complexity of override chains.

  • Say when you would skip factory: single directed block, one driver type.