Eleven high-frequency questions on create versus new, type and instance overrides, config_db precedence, wildcards, +UVM_TESTNAME and command-line config, with weak and senior answers.
On this page
This round is where interviewers separate people who have used the factory from people who have debugged it. Almost every question has a confident wrong answer that sounds right: "the more specific path wins", "the last override wins", "run_test's argument picks the test". Each of those is false in the library, and the interviewer knows it.
A senior answer states the rule as the library implements it, says why the rule exists, and names how you would prove it on a live bench (a factory print, a config trace). The DMA bench supplies the examples: a type override that cuts packets short, an instance override that swaps one agent, and a passive agent that only stays passive if super.build_phase() runs.
The questions
Why type_id::create() instead of new()? Is new() illegal on a component?
A derived class has no registration macro. What happens when you create it or override to it?
Two instance overrides match the same path. Which one wins? And two type overrides?
When must an override be registered for it to take effect?
The env and the test both set the same config_db field for the agent. Which value does the agent get?
You set is_active with the path "env.agt.*". Does the agent see it?
The top calls run_test("dma_smoke_test") and the command line has +UVM_TESTNAME=dma_rand_test. Which test runs?
You pass +uvm_set_config_int=uvm_test_top.env,num_jobs,5 and the env's config_db#(int)::get misses it. Why?
Your agent's build_phase skips super.build_phase(). What breaks?
One config object per agent, or many scalar config_db entries?
How do you prove which class the factory actually built?
Rapid fire
Check yourselfThe env sets max_len to 16 at the end of its build_phase; the test set it to 64 earlier in its own build_phase. What does the agent read, and would it change if the env set it in run_phase?
64 during build: the test's set has precedence 999 against the env's 998, whatever the order. In run_phase the rule changes: the last set wins, so a get after the env's run-time set reads 16.
Check yourselfA derived test adds set_inst_override for env.out_agt to a new monitor-only agent, but the base test already overrode *.out_agt. Which agent is built?
The base test's choice. Instance overrides are matched in registration order and the first match wins; the base test's build_phase registered its override first.
Check yourselfA test calls super.build_phase() (where the base test creates the env) and only then registers a type override for the stream driver. Does the override apply to the driver? Would an override of the env type apply?
The driver override applies: the env object exists, but its build_phase, which creates the agents and their drivers, runs after the test's build_phase returns. An env-type override does not, because the env was already created. Register overrides before super.build_phase() so the answer never depends on who creates what.