josefj Posted November 8, 2013 Report Share Posted November 8, 2013 Hi,I would like to ask UVM familiar users/professionals to get an opinion on the following issue:I am trying to modify uvm_object's internal fields during a run_phase of my testcase (or it could beend_of_elaboration_phase or start_of_simulation_phase, important - environment is already built up).Would you consider it like "this is something that should be working"?- let's assume the object "ga_config" is agent configuration- for simplicity there is only 1 data field "monitor_enable" in itclass ga_config extends uvm_object; // Variable: monitor_enable uvm_active_passive_enum monitor_enable = UVM_PASSIVE; function new (string name = "unnamed-ga_cfg"); super.new(name); this.name = name; endfunction `uvm_object_utils_begin(ga_config) `uvm_field_enum (uvm_active_passive_enum, monitor_enable, UVM_DEFAULT) `uvm_object_utils_endendclass : ga_config- "ga_cfg" is a name registered into uvm database in TB environment (in build phase) ga_cfg = ga_config::type_id::create("ga_cfg"); uvm_config_db#(ga_config)::set(this, "ga_env0*", "ga_cfg", ga_cfg);- "ga_cfg" is sourced from uvm database in agent monitor (in build phase) class ga_monitor extends uvm_monitor; ga_config cfg; ... function void build_phase (uvm_phase phase); ... uvm_config_db#(ga_config)::get(this, "", "ga_cfg", cfg); ... endfunction … endclass i.e I am expecting here to create a pointer to object "ga_cfg"- NOW in testcase for example end_of_elaboration_phase I WANT TO MODIFY "monitor_enable" field class my_testcase extends uvm_test; ... function void end_of_elaboration_phase (uvm_phase phase); uvm_config_db#(uvm_active_passive_enum)::set(this, "tb_env0.ga_env0.ga2.monitor.cfg", "monitor_enable", UVM_ACTIVE); endfunction … endclass Note: assume the path "tb_env0.ga_env0.ga2.monitor.cfg" is something you can extract from hierarchy report (print_topology).Unfortunately this latest command doesn't have desired effect. I’d expect to see monitor_enable value set to UVM_ACTIVE, but I still see UVM_PASSIVE. Can anybody explain why? I have seen some comments regarding issues w/ uvm_object hierarchy and UVM 1.1. Is it related to what I am trying to describe here?Thanks Josef Annossyenudge 1 Quote Link to comment Share on other sites More sharing options...
dave_59 Posted November 8, 2013 Report Share Posted November 8, 2013 You did remember that field automation macros never do a uvm_config_db::get() for you? Most people don't realize this, and many other problems including their performance are why we do not recommend using them. Please see this link. But even if it did to the get(), only the set()s that came before it would have an effect. So at the end of elaboration, you need to get the handle to your ga_cfg and set cfg.montitor_enable = UVM_ACTIVE; Quote Link to comment Share on other sites More sharing options...
Logger Posted November 8, 2013 Report Share Posted November 8, 2013 To be a little more precise here, the field macros do call uvm_config_db::get() for component fields in the component's build_phase. uvm_config_db::get() is not called for non-phased objects like uvm_sequence_items or plain uvm_objects. Quote Link to comment Share on other sites More sharing options...
uwes Posted December 2, 2013 Report Share Posted December 2, 2013 To be a little more precise here, the field macros do call uvm_config_db::get() for component fields in the component's build_phase. uvm_config_db::get() is not called for non-phased objects like uvm_sequence_items or plain uvm_objects. well, the field macros do not call ::get(), it's the uvm_component's apply-config_settings() method which iterates over the defined fields and pulls the values from the config_db and assigns them to the local fields via set_*_local(). the above scenario should work IF the monitor::build_phase() first retrieves the config object and then invokes super.build_phase() to have auto configuration applied. in that particular case ::set(this, "tb_env0.ga_env0.ga2.monitor", "cfg.monitor_enable", UVM_ACTIVE) should set the field as desired.. /uwe Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.