当前位置:网站首页>UVM中uvm_config_db非直线的设置与获取
UVM中uvm_config_db非直线的设置与获取
2022-06-27 00:46:00 【Alfred.HOO】
在图3-4所示的UVM树中,driver的路径为uvm_test_top.env.i_agt.drv。在uvm_test_top,env或者i_agt中,对driver中的某些变量
通过config_db机制进行设置,称为直线的设置。但是若在其他component,如scoreboard中,对driver的某些变量使用config_db机制
进行设置,则称为非直线的设置。
在my_driver中使用config_db::get获得其他任意component设置给my_driver的参数,称为直线的获取。假如要在其他的component,如在reference model中获取其他component设置给my_driver的参数的值,称为非直线的获取。
要进行非直线的设置,需要仔细设置set函数的第一个和第二个参数。以在scoreboard中设置driver中的pre_num为例:
文件:src/ch3/section3.5/3.5.6/set/my_scoreboard.sv
18 function void my_scoreboard::build_phase(uvm_phase phase);
…
22 uvm_config_db#(int)::set(this.m_parent, "i_agt.drv", "pre_num", 200);
26 `uvm_info("my_scoreboard", "in my_scoreboard, uvm_test_top.env.i_agt.drv.pre_num is set to 200", UVM_LOW)
27 endfunction
或者:
function void my_scoreboard::build_phase(uvm_phase phase);
super.build_phase(phase);
uvm_config_db#(int)::set(uvm_root::get(), "uvm_test_top.env.i_agt.drv", "pre_num", 200);
endfunction
无论哪种方式,都带来了一个新的问题。在UVM树中,build_phase是自上而下执行的,但是对于图3-4所示的UVM树来说,scb与i_agt处于同一级别中,UVM并没有明文指出同一级别的build_phase的执行顺序。所以当my_driver在获取参数值时,my_scoreboard的build_phase可能已经执行了,也可能没有执行。所以,这种非直线的设置,会有一定的风险,应该避免这种情况的出现。
非直线的获取也只需要设置其第一和第二个参数。假如要在reference model中获取driver的pre_num的值:
文件:src/ch3/section3.5/3.5.6/get/my_model.sv
21 function void my_model::build_phase(uvm_phase phase);
22 super.build_phase(phase);
23 port = new("port", this);
24 ap = new("ap", this);
25 `uvm_info("my_model", $sformatf("before get, the pre_num is %0d", drv_pre_num), UVM_LOW)
26 void'(uvm_config_db#(int)::get(this.m_parent, "i_agt.drv", "pre_num", drv_pre_num));
27 `uvm_info("my_model", $sformatf("after get, the pre_num is %0d", drv_pre_num), UVM_LOW)
28 endfunction
或者:
void'(uvm_config_db#(int)::get(uvm_root::get(), "uvm_test_top.env.i_agt.drv",
"pre_num", drv_pre_num));
这两种方式都可以正确地得到设置的pre_num的值。
非直线的获取可以在某些情况下避免config_db::set的冗余。上面的例子在reference model中获取driver的pre_num的值,如果
不这样做,而采用直线获取的方式,那么需要在测试用例中通过cofig_db::set分别给reference model和driver设置pre_num的值。
同样的参数值设置出现在不同的两条语句中,这大大增加了出错的可能性。因此,非直线的获取可以在验证平台中多个组件
(UVM树结点)需要使用同一个参数时,减少config_db::set的冗余。
边栏推荐
- 通过Rust语言计算加速技术突破图片识别性能瓶颈
- CH423要如何使用,便宜的国产IO扩展芯片
- Gaussian and Summary Stats
- Processing of slice loss in ArcGIS mosaic dataset
- Kept to implement redis autofailover (redisha) 11
- CEC-I 中华学习机使用说明与问答
- XSS attack notes (Part 1)
- 解决unable to create a folder to save the sketch: mkdir sketch
- 解决STC8G1K08程序不能运行的问题和端口配置
- Encapsulation of unified result set
猜你喜欢

LeetCode 142. Circular linked list II

Skills needing attention in selection and purchase of slip ring

Interface test framework practice (I) | requests and interface request construction

How to convert an old keyboard into a USB keyboard and program it yourself?

Law of Large Numbers

理想L9产品力分析:售价45.98万,采用四缸发动机,续航1315公里

Review the old and know the new -- constant renewal at normal temperature

3線spi屏幕驅動方式

30 MySQL tutorial MySQL storage engine overview

IIS deploy static web site and FTP service
随机推荐
memcached基础6
JSON解析,ESP32轻松获取时间气温和天气
Solution of idea hot start failure
Interface test framework practice (I) | requests and interface request construction
2022年地理信息系统与遥感专业就业前景与升学高校排名选择
Object access mechanism and others
Amazon elasticache quickly builds a cache service cluster, which is fast
Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
Hid device descriptor and keyboard key value corresponding coding table in USB protocol
Memcached foundation 5
超越锂电池——未来电池的概念
30 MySQL tutorial MySQL storage engine overview
架构实战营模块五作业
乔治·华盛顿大学 : Hanhan Zhou | PAC:多智能体强化学习中具有反事实预测的辅助价值因子分解
ESP32-添加多目录的自定义组件
Esp32-solo development tutorial to solve config_ FREERTOS_ UNICORE problem
getReader() has already been called for this request
Interface test framework practice (I) | requests and interface request construction
Kept to implement redis autofailover (redisha) 17
Amazon ElastiCache 飞速搭建缓存服务集群,这才叫快