Arayik Babayan, a friend of mine from Armenia asked me what is the use of “apply_config_settings” in OVM. As you may be aware SystemVerilog is a flexible language that can be used for building highly configurable and scalable verification environments. OVM adds a great deal of capabilities on top of plain “system verilog” to make it lot easier to handle that task. One of them is the configuration interface mechanism – usually we use set_config* and get_config* stuff. Internally OVM’s build() takes care of “applying” these settings. automatically usually. What if you want to change few settings across the env after the build? That’s when you use this apply_config_settings explicitly – it internally calls the set_*local for modified settings and viola – you are ready to go!
That’s “advanced OVM” for this week!
Enjoy OVMing..
TeamCVC
apply_config_settings searches for configuration items and updates members.
virtual function void apply_config_settings(bit verbose = 0)
.
Automates the calling of get_config() during the build phase for all registered (using the automation macros) fields. This is really hidden magic, and I am not a big fan, but it does make things “easy”
If you do not want apply_config_settings to be called for a component, then the build() method
should be overloaded and you should not call super.build(). If this case, you must also set the
m_build_done bit. Likewise, apply_config_settings can be overloaded to customize automated
configuration.
When the verbose bit is set, all overrides are printed as they are applied. If the component’s
print_config_matches property is set, then apply_config_settings is automatically called with verbose = 1.
Here is an example of apply_config_settings.
my_test extends ovm_test;
virtual function void build();
super.build();
endfunction : build
virtual function void end_of_elaboration();
root = ovm_root::get();
root.set_config_int(Tb0.env0.virtualSequencer.get_full_name(),
“count”, 1);
root.set_config_string(Tb0.env0.virtualSequencer.get_full_name(),
“default_sequence”, “RtrAllPathsVirtualSequence”);
Tb0.env0.virtualSequencer.apply_config_settings();
endfunction : end_of_elaboration
endclass : my_test
In my_test test case we configure virtual sequencer’s default sequence by RtrAllPathsVirtualSequence virtual sequence at end_of_elaboration phase. Then we call apply_config_settings to apply new configurations.