【UVM源码学习】uvm_registry

简介: 【UVM源码学习】uvm_registry

如果对每个factory注册的component/object都创建其实例,内存、仿真/编译的开销会很大。


为了减小这种开销,可以采用uvm_registry对factory注册的componnet/object类创建一个轻量级的代理(仅含有get/get_type/get_type_name等方法),只有使用到该component/object时才手动创建其实例(type_name::type_id::create(name,parent),只有使用uvm_component_utils这类宏注册的才能使用type_name:;type_id::create,type_def直接定义的没有type_id)。


 uvm_registry.svh 中主要实现了两个类,uvm_component_registry及uvm_object_registry,分别为component及object的代理类。两个类均直接派生自uvm_object_wrapper。类中实现的主要方法有:


image.png


可以采用以下方法来注册component代理:


type_def uvm_component_registry #(mycomp, “mycomp”) type_id;




不同仿真器实现方法或存在不同,常用方法是采用以下宏:


`uvm_component_utils(mycomp)  //非参数化的类
`uvm_component_param_utils(mycomp, #(T)) // 参数化的类:



对于参数化的类,由于传进来的type_name不固定,因而采用uvm_component_param_utils及uvm_object_param_utils宏注册参数化类的时候,没有实现get_type_name的方法,即采用以上两个宏注册的参数化的类不能使用get_type_name。


参数化的类本意是通过传入参数消除多个type_name相同的类之间的干扰,因而不建议通过type_name在uvm_factory中查找相关类。



目录
相关文章
|
索引
【UVM源码学习】uvm_packer
【UVM源码学习】uvm_packer
641 0
|
测试技术 数据库 容器
【UVM源码学习】uvm_resource
【UVM源码学习】uvm_resource
150 0
【UVM源码学习】uvm_resource
【UVM源码学习】uvm_comparer
【UVM源码学习】uvm_comparer
472 0
【UVM源码学习】uvm_comparer
|
安全
【UVM源码学习】uvm_links
【UVM源码学习】uvm_links
125 0
【UVM源码学习】uvm_links
【UVM源码学习】uvm_heartbeat
【UVM源码学习】uvm_heartbeat
183 0
【UVM源码学习】uvm_heartbeat
【UVM源码学习】uvm_object
【UVM源码学习】uvm_object
113 0
【UVM源码学习】uvm_object
|
存储 C语言
【UVM源码学习】uvm_misc
【UVM源码学习】uvm_misc
110 0
【UVM源码学习】uvm_misc
【UVM源码学习】uvm_event
【UVM源码学习】uvm_event
249 0
【UVM源码学习】uvm_event
|
算法
【UVM源码学习】uvm_spell_chkr
【UVM源码学习】uvm_spell_chkr
154 0
【UVM源码学习】uvm_spell_chkr
【UVM源码学习】uvm_recorder
【UVM源码学习】uvm_recorder
178 0
【UVM源码学习】uvm_recorder