Hardware interview practice
Factory-aware component construction
A test installs a type override from base_agent to coverage_agent before the environment is built, but the instantiated agent is still base_agent. What is the decisive defect?
Starting point
Question code
class env extends uvm_env;
base_agent agt;
function void build_phase(uvm_phase phase);
super.build_phase(phase);
agt = new("agt", this);
endfunction
endclassChoose one
Answer choices
- A. The agent must be created in connect_phase for overrides to work
- B. Direct construction with new bypasses factory lookup; use base_agent::type_id::create
- C. The override must target uvm_agent rather than base_agent
- D. Component type overrides apply only to grandchildren of the test
