RTL Studio Open IDE

4.5 · UVM CLASS

Configuration object for agent settings

Bundle agent and env settings into one config object and pass it via uvm_config_db.

Watch on YouTube

What you practice

Configuration object for agent settings (4.5). Bundle agent and env settings into one config object and pass it via uvm_config_db. It is in Config object — Part 4 · Advanced UVM of the UVM Masterclass. Factory, config objects, virtual sequences, and pipelined drivers for large SoC verification.

The UVM bench compiles in that same browser SystemVerilog simulator. You edit the test in the IDE, run Verilator, and read the log beside the waveform.

What you will learn

Today you will bundle agent and environment settings into a single configuration object and pass it through uvm_config_db, enabling clean separation between test and environment configuration.

Learning objectives

  • Create a custom configuration object (fifo_env_config) to hold agent and env settings.
  • Set the configuration object from the test using uvm_config_db#(fifo_env_config)::set.
  • Retrieve the configuration object in the environment using uvm_config_db::get.
  • Understand why passing configuration via uvm_config_db improves testbench modularity.

Theory

UVM encourages centralizing configuration using uvm_object-derived classes like uvm_config_db. This avoids hard-coded values and supports reuse across tests.

ConceptPurpose
uvm_config_db#(T)::setPublishes a configuration object into the database at a specific hierarchy path
uvm_config_db#(T)::getRetrieves a configuration object from the database for a given instance
uvm_active_passive_enumStandard enum (UVM_ACTIVE, UVM_PASSIVE) used in agent configs

Configuration objects are typically instantiated in the test’s build_phase and set before the environment’s build_phase runs. The path string in set/get must match (e.g., "env" in test → "env" in env).

Practice

Open RtlStudio and select this chapter. Confirm files appear in Explore.

  1. Open golden/tb/env/fifo_env_config.sv to inspect the configuration object definition.
  2. Open student/tb/tb_top.sv — locate the __env_cfg object instantiation and uvm_config_db#(fifo_env_config)::set call.
  3. In student/tb/tb_top.sv, ensure the set call uses path "env" and field name "cfg".
  4. Run Simulation and verify the Log panel shows INFO: === Config object === and INFO: PASS.

Summary

Students defined a fifo_env_config class to bundle agent and environment settings such as the virtual interface and transaction count. They created and populated this configuration object in the test’s build_phase and passed it through uvm_config_db to the environment. The environment successfully retrieved the configuration, enabling clean, hierarchical configuration management without hardcoding values. This pattern reinforces UVM best practices for modularity and testbench reusability.

Run it in the Verilog IDE

  1. Open the UVM workspace in the IDE. The DUT and the testbench compile together in the browser.
  2. Run the SystemVerilog simulation with Verilator and read the phase and scoreboard lines in the log.
  3. When the check is on pins rather than a print, open the VCD next to that log.
  4. Edit the sequence, driver, or scoreboard in the IDE and rerun. You stay in the same simulator.

The lesson is done when the simulation matches Configuration object for agent settings. Change the source, run the Verilog simulator again, and read the waveform without leaving the IDE. Simulation guide · Yosys guide.