当前位置:网站首页>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的冗余。
边栏推荐
- 3-wire SPI screen driving mode
- 建模规范:环境设置
- Review the old and know the new -- constant renewal at normal temperature
- 可视化介绍 Matplotlib 和 Plotnine
- 清华&智源 | CogView2:更快更好的文本图像生成模型
- 其他服务注册与发现
- Skills needing attention in selection and purchase of slip ring
- Beyond lithium battery -- the concept of battery in the future
- ESP32-SOLO开发教程,解决CONFIG_FREERTOS_UNICORE问题
- Kept to implement redis autofailover (redisha) 16
猜你喜欢

Statistical Hypothesis Testing

getReader() has already been called for this request

XSS笔记(下)

Modeling specifications: environment settings

3-wire SPI screen driving mode

Two days of beautiful butterfly animation

使用NetworkX对社交网络进行系统的分析:Facebook网络分析案例
![Count the logarithm of points that cannot reach each other in an undirected graph [classic adjacency table building +dfs Statistics - > query set optimization] [query set manual / write details]](/img/cc/a0be58eddc72c22a9a6ee5c61eb81a.png)
Count the logarithm of points that cannot reach each other in an undirected graph [classic adjacency table building +dfs Statistics - > query set optimization] [query set manual / write details]
![自定义JSP[if,foreach,数据,select]标签](/img/a2/fc75c182d572d86f4466323e31d6c3.png)
自定义JSP[if,foreach,数据,select]标签

30 MySQL tutorial MySQL storage engine overview
随机推荐
CH423要如何使用,便宜的国产IO扩展芯片
memcached基础7
memcached基础5
Keepalived 实现 Redis AutoFailover (RedisHA)13
XML learning notes
Amazon ElastiCache 飞速搭建缓存服务集群,这才叫快
memcached基础6
Memcached foundation 4
XSS笔记(下)
Play OLED, u8g2 animation, increasing numbers, random triangles, etc
Amazon elasticache quickly builds a cache service cluster, which is fast
自定义JSP[if,foreach,数据,select]标签
Great vernacular with high concurrency (I)
JSON解析,ESP32轻松获取时间气温和天气
07 | workflow design: how to design a reasonable multi person development mode?
leetcode 1143. Longest common subsequence (medium)
The most difficult 618 in history, TCL won the first place in both jd.com and tmall.com shares in the TV industry
memcached基础4
寻找旋转排序数组中的最小值 II[经典抽象二分 + 如何破局左中右三者相等]
如何把老式键盘转换成USB键盘并且自己编程?