UVM Config DB Interview Questions
Deep dive into Configuration Database usage, debugging, and best practices.
Beginner Level
What is the `uvm_config_db` used for?
It acts as a global lookup table to pass data (configurations, virtual interfaces) from higher levels (Test/Env) to lower levels (Driver/Monitor) without connecting them via ports.
Write the syntax for `set` and `get`.
uvm_config_db#(type)::set(context, "inst_path", "field_name", value); uvm_config_db#(type)::get(context, "inst_path", "field_name", value);
Intermediate Level
Explain the Precedence rules (Winner logic).
1. Hierarchy Wins: A `set()` from `uvm_test` (Top) overrides a `set()` from `uvm_env` (Lower).
2. Time Wins: If two components at the same level call set(), the last one executes wins.
Advanced Level
What is `uvm_resource_db`? How does it differ from `config_db`?
`uvm_config_db` is actually a wrapper around `uvm_resource_db`.
- config_db: Hierarchical lookup (Scoping). Best for parent-child config.
- resource_db: Global pool (Name based). Best for shared resources anywhere.
Config DB is preferred 99% of the time due to hierarchy support.
How do you debug Config DB issues (e.g. get failing)?
Run simulation with `+UVM_CONFIG_DB_TRACE`. This prints all set/get operations to the log, allowing you to see typos in paths or types.