在test.env中get:class my_env extends uvm_env;my_config cfg;...function void bulid_phase(uvm_phase phase);...if(!uvm_config_db#(my_config)::get(this,"","cfg",cfg))begin`uvm_fatal(" get config object failed")end...endfunctionendclass ...
cfg_db用于用于在UVM验证平台间传递参数。 cfg_db一般在build_phase中完成。 在高层set,子层get。 set函数的第三个参数必须与要get函数中变量的名字相一致
uvm_config_db#(uvm_object)::get(this,"","cfg", tmp); void'($cast(cfg, tmp)); `uvm_info("SETVAL", $sformatf("cfg.val1 is %d after get", cfg.val1),UVM_LOW) `uvm_info("SETVAL", $sformatf("cfg.str1 is %s after get", cfg.str1),UVM_LOW) endfunction endclass classtest1...
uvm_config_db #( apb_agent_config )::get(this, "", "apb_agent_config",m_cfg) ) `uvm_fatal(...) // Monitor is always present m_monitor = apb_monitor::type_id::create("m_monitor", this); // Only build the driver and sequencer if active if(m_cfg.active == UVM_ACTIVE) ...
`uvm_field_object(cfg,UVM_ALL_ON|UVM_REFERENCE) `uvm_component_utils_end extern task main_phase(uvm_phase phase); endclass task mac_driver::main_phase(uvm_phase phase); super.main_phase(phase); while(1) begin seq_item_port.get_next_item(req); ...
uvm_config_db#(config_obj)::get(this, "", "cfg", cfg); `uvm_info("GETOBJ", $sformatf("after config get, cfg.comp2_var = %0d", cfg.comp2_var), UVM_LOW) `uvm_info("BUILD", "comp2 build phase exited", UVM_LOW)
cfg=apb_config::create("cfg"); end //getvirtualinterface if(!uvm_config_db#(virtualapb_if)::get(this,"","vif",vif))begin `uvm_fatal("GETVIF","cannotgetvifhandlefromconfigDB") end monitor=apb_master_monitor::create("monitor",this); ...
`uvm_info("SETVAL", $sformatf("cfg.str1 is %s after get", cfg.str1), UVM_LOW) endfunction endclass class test1 extends uvm_test; `uvm_component_utils(test1) comp1 c1, c2; config1 cfg1, cfg2; function new(string name, uvm_component parent); ...
if(!uvm_config_db# (virtual my_if)::get(this, "", "vif", vif)) `uvm_fatal("my_driver", "virtual interface must be set for vif !!!") endfunction task void my_driver:: main_phase(uvm_phase phase); //略去 endtask top_tb代码示例: ...
`uvm_warning("GETCFG","cannot get config object from config DB") cfg = apb_config::create("cfg"); end // get virtual interface if( !uvm_config_db#(virtual apb_if)::get(this,"","vif", vif)) begin `uvm_fatal("GETVIF","cannot get vif handle from config DB") ...