当前位置:网站首页>UVM中uvm_config_db在sequence中的使用
UVM中uvm_config_db在sequence中的使用
2022-06-27 00:46:00 【Alfred.HOO】
在UVM中使用get_full_name()可以得到一个component的完整路径,同样的,此函数也可以在一个sequence中被调用,尝试在一个sequence的body中调用此函数,并打印出返回值,其结果大体如下:uvm_test_top.env.i_agt.sqr.case0_sequence
这个路径是由两个部分组成,此sequence的sequencer的路径,即实例化此sequence时传递的名字。
在sequence中get参数
//my_case0.sv
function void my_case0::build_phase(uvm_phase phase);
...
uvm_config_db#(int)::set(this, "env.i_agt.sqr.*", "count", 9);
...
endfunction
set函数的第二个路径参数里面出现了通配符,这是因为sequence在实例化名字一般是不固定的,而且有时是未知的,所以使用通配符。
在sequence中以如下方式调用config_db::get函数。
//my_case0.sv
class case0_sequence extends uvm_sequence#(my_transaction);
...
virtual task per_body();
if(uvm_config_db#(int)::get(null, get_full_name(), "count", count)
`uvm_info("seq0", $sformatf("get count value %0d via config_db", count), UVM_MEDIUM)
else
`uvm_error("seq0", "cannot get count value!")
endtask
...
endclass
在get函数原型中,第一个参数必须是一个component,而sequence不是一个component,所以这里不能使用this指针,只能使用null或uvm_root::get()。前面已经提到过,当使用null是,UVM会自动将其替换为uvm_root:get(),再加上第二个参数get_full_name(), 就可以完整地得到此sequence的路径,从而得到参数。
在sequence中set参数
//my_case0.sv
class drv0_seq extends uvm_sequnece #(my_transaction);
...
virtual task body();
void'(uvm_config_db#(bit)::get(uvm_root::get(), get_full_name(), "first_start", first_start));
if(first_start)
`uvm_info("drv0_seq", "this is the first start of the sequence", UVM_MEDIUM)
else
`uvm_info("drv0_seq", "this is not the first start of the sequence", UVM_MEDIUM)
uvm_config_db#(bit)::set(uvm_root::get(), "uvm_test_top.v_sqr.*", "first_start", 0);
endtask...
endclass
需要注意的是,由于此sequence在virtual sequence中被启动,所以其get_full_name的结果应该是uvm_test_top.v_seq.,而不是uvm_test_top.env0.i_agt.sqr.,所以在设置时,第二个参数应该是前者。
边栏推荐
- Keepalived 实现 Redis AutoFailover (RedisHA)12
- Flink practical problems (VII): no watermark (watermarks are only available eventtime is used)
- Bootstrapblazor + FreeSQL actual combat chart usage (2)
- 自定义类加载器对类加密解密
- 30 MySQL tutorial MySQL storage engine overview
- ESP32-添加多目录的自定义组件
- flutter系列之:flutter中的flow
- Memcached foundation 5
- 史上最难618,TCL夺得电视行业京东和天猫份额双第一
- Esp32 experiment - self built web server distribution network 02
猜你喜欢
Review the old and know the new -- constant renewal at normal temperature
getReader() has already been called for this request
美团:踩雷好几年,才总结出的数据治理避坑攻略
3线spi屏幕驱动方式
About Random Numbers
统计无向图中无法互相到达点对数[经典建邻接表+DFS统计 -> 并查集优化][并查集手册/写的详细]
清华&智源 | CogView2:更快更好的文本图像生成模型
LeetCode 142. Circular linked list II
Processing of slice loss in ArcGIS mosaic dataset
Other service registration and discovery
随机推荐
Central Limit Theorem
Generate flow chart with code, and how to use markdown
How to convert an old keyboard into a USB keyboard and program it yourself?
One click acceleration of Sony camera SD card file copy operation, file operation batch processing tutorial
Beyond lithium battery -- the concept of battery in the future
Timing mechanism of LwIP
数据库面试题+sql语句解析
3-wire SPI screen driving mode
leetcode 1143. Longest common subsequence (medium)
在线文本数字识别列表求和工具
Unable to create a folder to save the sketch: MKDIR sketch
Gaussian and Summary Stats
memcached基础2
自定义JSP[if,foreach,数据,select]标签
MySQL之账号管理、建库以及四大引擎+案例
buuctf-pwn write-ups (6)
Encapsulation of unified result set
memcached基础7
memcached基础1
理想L9产品力分析:售价45.98万,采用四缸发动机,续航1315公里