这部分我们将要详细介绍uvm_config_db机制时如何解决uvm_resource_db机制带来的弊端的
首先我们来看看uvm_config_db是如何工作的,
两个核心方法set和get
package UVM_cmd;
import uvm_pkg::*'
`include "uvm_macros.svh"
class unit_agent extends uvm_agent;
int A=10;
int i;
local int b;
uvm_resource#(int) re;
uvm_resource_types::rsrc_q_t rq;
uvm_resource_pool rp;
`uvm_component_utils(unit_agent)
function new(string name);
super.new(name);
endfunction
virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
re=uvm_resource#(int)::get_type();
rp=uvm_resource_pool::get();
rq=rp.lookup_name("abcd","A",re);
`uvm_info("INT",$sformatf("before the config the a is %d",A),UVM_LOW)
if(!uvm_config_db#(int)::get(this,"",“A”,A))
`uvm_error("error","the read is error")
else
`uvm_info("INT",$sformatf("after the config the a is %d",A),UVM_LOW)
`uvm_in

本文详细介绍了UVM中的uvm_config_db机制如何弥补uvm_resource_db的不足,通过设置与获取过程展示了其工作原理。在build_phase中设置资源,并在uvm_agent中通过uvm_config_db::get获取合适资源,遵循UVM的phase机制。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



