uvm set/get的理解

1,问题

在env里边set了qlen_db的virtual intf, 在qlen_db中使用的时候出现错误:

Error: uninitialized virtual interface object

错误分析: 肯定是qlen_db中没有拿到这个intf,所以才会出现uninitialized的问题


2,解决方法

在使用的时候,重新get一下。


3,注意事项

get和set都是在build_phase做的,build_phase是自顶向下的顺序执行的,其他的phase是自底向上执行的。



参考:

http://www.testbench.in/UT_05_UVM_CONFIGURATION.html

Configuration is a mechanism in UVM that higher level components in a hierarchy can configure the lower level components variables. Using set_config_* methods, user can configure integer, string and objects of lower level components. Without this mechanism, user should access the lower level component using hierarchy paths, which restricts reusability. This mechanism can be used only with components. Sequences and transactions cannot be configured using this mechanism. When set_config_* method is called, the data is stored w.r.t strings in a table. There is also a global configuration table. 
Higher level component can set the configuration data in level component table. It is the responsibility of the lower level component to get the data from the component table and update the appropriate table.

Using get_config_* methods, user can get the required data if the data is available in the table.

http://www.synopsys.com/Services/Documents/hierarchical-testbench-configuration-using-uvm.pdf 

UVM中,可以使用uvm_config_db的set和get方法来设置和获取配置信息。这些方法可以用于在不同的组件之间传递数据。引用\[1\]中的代码示例展示了如何使用uvm_config_db的set方法来设置一个接口数组。在这个例子中,使用了一个for循环来遍历接口数组,并将每个接口设置到配置数据库中。引用\[2\]中的代码示例展示了set方法的另一种用法,其中第一个参数是一个环境对象,第二个参数是一个字符串,用于指定配置的位置,第三个参数是配置的名称,第四个参数是配置的值。引用\[3\]中提到,在传递虚拟接口时,可以将第一个参数设置为null,UVM会自动将其替换为uvm_root::get(),即替换为uvm_top。uvm_top是uvm_root的一个唯一实例,是UVM的树根,也是一个全局变量,可以直接使用。 #### 引用[.reference_title] - *1* [UVMinterface数组的set,get](https://blog.csdn.net/zhajio/article/details/101195556)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [uvm_config_db的set()与get()方法](https://blog.csdn.net/weixin_42294124/article/details/125016224)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值