当前位置:网站首页>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.,所以在设置时,第二个参数应该是前者。
边栏推荐
猜你喜欢

How to control the quality of HD slip ring in the production process

Live review | Ziya &ccf TF: Discussion on software supply chain risk management technology under cloud native scenario

USB协议中HID设备描述符以及键盘按键值对应编码表

What are the skills and methods for slip ring installation

Gaussian and Summary Stats

疫情期间居家办公的总结体会 |社区征文

可视化介绍 Matplotlib 和 Plotnine

BootstrapBlazor + FreeSql实战 Chart 图表使用(2)

通过Rust语言计算加速技术突破图片识别性能瓶颈

flutter系列之:flutter中的flow
随机推荐
Amazon elasticache quickly builds a cache service cluster, which is fast
leetcode 1143. Longest common subsequence (medium)
Unable to create a folder to save the sketch: MKDIR sketch
memcached基础7
一键加速索尼相机SD卡文件的复制操作,文件操作批处理教程
Analysis of ideal L9 product power: the price is 459800 yuan, the four cylinder engine is adopted, and the endurance is 1315km
Employment prospect of GIS and remote sensing specialty and ranking selection of universities in 2022
Kept to implement redis autofailover (redisha) 11
Memcached foundation 1
Topolvm: kubernetes local persistence scheme based on LVM, capacity aware, dynamically create PV, and easily use local disk
做了两天的唯美蝴蝶动画
3線spi屏幕驅動方式
Visual introduction to Matplotlib and plotnine
统计无向图中无法互相到达点对数[经典建邻接表+DFS统计 -> 并查集优化][并查集手册/写的详细]
对象的访问机制及其他
Custom MVC (imported into jar package) + difference from three-tier architecture + reflection + interview questions
Beyond lithium battery -- the concept of battery in the future
Flink 实战问题(七):No Watermark(Watermarks are only available EventTime is used)
USB协议中HID设备描述符以及键盘按键值对应编码表
Amazon ElastiCache 飞速搭建缓存服务集群,这才叫快