Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Pass a virtual interface through config_db

Hardware interview practice

Pass a virtual interface through config_db

MediumUVMSystemVerilog

A top module owns bus_if bus(clk), while uvm_test_top.env.agent.drv needs a virtual handle named vif. Implement matching config_db set/get calls and fail clearly if lookup fails.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

top: bus_if bus(clk);
test: uvm_test_top.env.agent.drv
field name: vif
Reviewed example

Work through one case

Input
set(null, "uvm_test_top.env.agent.*", "vif", bus) and get(this, "", "vif", vif)
Expected output
Driver receives the bus handle

The wildcard matches drv and both calls use the same virtual type and field name.

What to cover

Requirements

  1. From top before run-time stimulus, set virtual bus_if bus into uvm_config_db using field name vif for the driver path or a matching wildcard path.
  2. In the driver's build_phase, get virtual bus_if with the same type and field name into the member vif.
  3. Check the get return value and issue uvm_fatal if it is zero; never continue with a null virtual interface.
  4. Use a context and instance path that actually matches uvm_test_top.env.agent.drv.
asic.fyi · Learn silicon end to end.info@asic.fyi