config文件:
`ifndef xxx_CFG_SV
`define xxx_CFG_SV
class xxx_cfg extends uvm_object;
`uvm_object_utils(layer_agent_cfg)
bit is_active = 1;
//virtual rst_if vif;
//string REPORT_TAG = "XXX_CFG"
function new(string name="xxx_cfg");
super.new(name);
endfunction
endclass
`endif
- 一般env一个cfg文件;uvc一个cfg文件;使用两个层次的config;
- env_cfg包含uvc_cfg;
- 具体示例参考 UVM糖果爱好者教程 - 8.配置
传递config class
env中set
xxx_cfg cfg; //声明
//build_phase
cfg = xxx_cfg::type_id::create("cfg");
cfg.is_active = 1;
uvm_config_db#(xxx_cfg)::set(this, "agt*","cfg",cfg);
//uvm_config_db#(xxx_cfg)::set(this, "agt*.*","cfg",cfg); //报错,不要使用
agent中get
//agent build_phase
if(!uvm_config_db#(xxx_cfg)::get(this,"","cfg",cfg))
`uvm_error(get_type_name(),"do not get config")
if(cfg.is_active == 1) begin