Skip to the selected question
ASIC.FYI

ASIC Question Bank

1,000+ hardware interview questions
DescriptionQ758
Page ↗
Q758DVMetaASIC interview problem

Pass a virtual interface through config_db

TechniquesDVUVMconfig_dbVirtual interface
DifficultyMedium
TopicUVM
LanguageSystemVerilog
Requirements4 checkpoints
01

Problem

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.

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

Example input and output

Use this case to check your interpretation
Input
set(null, "uvm_test_top.env.agent.*", "vif", bus) and get(this, "", "vif", vif)
Output
Driver receives the bus handle
Explanation

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

02

Requirements (4)

  • 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.
  • In the driver's build_phase, get virtual bus_if with the same type and field name into the member vif.
  • Check the get return value and issue uvm_fatal if it is zero; never continue with a null virtual interface.
  • Use a context and instance path that actually matches uvm_test_top.env.agent.drv.