HomeDay 24

UVM Config

Config Database (No Hardcodes)

Pass configuration without hardcoding parameters:

// In test, before build uvm_config_db #(int)::set(null, "env.drv", "delay", 5); uvm_config_db #(string)::set(null, "env", "mode", "stress"); // In component, read during build_phase class my_driver extends uvm_driver; int delay; function void build_phase(uvm_phase phase); super.build_phase(phase); if(!uvm_config_db #(int)::get(this, "", "delay", delay)) begin delay = 0; // default end endfunction endclass

Testbench with Config

class my_test extends uvm_test; virtual function void build_phase(uvm_phase phase); super.build_phase(phase); // Configure agent for different scenarios uvm_config_db #(int)::set(this, "env.agt*", "mode", STRESS); uvm_config_db #(int)::set(this, "env.agt*", "num_txns", 10000); // Hierarchical config: can override per-agent uvm_config_db #(int)::set(this, "env.agt0", "mode", SANITY); uvm_config_db #(int)::set(this, "env.agt1", "mode", STRESS); endfunction endclass

Key Takeaways

Day 25: Complete UVM testbench wrap-up and methodology review.