VMM 中 factory 所用的 copy 和 allocate 方法的区别
来源:互联网 发布:8个灯流水灯单片机程序 编辑:程序博客网 时间:2024/05/17 08:15
在VMM1.1 以及之前,其factory机制的实现是通过以下两种方法实现的
1) copy : 如下
class xxx base_transaction factory; .... factory=new(); .... base_transaction tr; $cast(tr, factory.copy())endclassin test: initial begin env.xxx.factory = real_printend
描述起来就是: 工厂里面已经有现成的模子(实例),我们所做的就是用新的模子替换原有的模子。(替换的模子的基本功能确定,即基类确定)
2) allocate
class xxx base_transaction tr; virtual function new(base_transaction factory); tr= factory.allocate(); endfunction endclasswhen instance xxx: xxx inst; inst =new(real_print); // real_print is instance of extended xxx class.
描述起来就是: 工厂里面没有模子,模子需要外部获得。(但是基本功能确定,即基类确定)
我们在Designware AHB slave VIP 就使用了第二种方法,第二种方法不需要暴露类中的transaction 实例,但是必须暴露参数。
由此,我们在定义 base_transaction的扩展类时,必须实现copy 和 allocate函数。要 提醒大家的是,即使扩展类没有加入新的类成员,只是加了些constraint,但是依然要 加入
`vmm_data_member_begin( xxxxx)`vmm_data_member_end(xxxx)
这样才在扩展类加入了copy 和 allocate 函数的实现
- VMM 中 factory 所用的 copy 和 allocate 方法的区别
- C#中 CopyT0和Copy方法的用法和区别
- ByteBuffer中allocateDirect与allocate的区别
- ByteBuffer的allocate和allocateDirect区别
- Microkernel和VMM的比较
- @property中retain和copy的区别
- IOS中Retain和Copy的区别
- IOS中Retain和Copy的区别
- IOS中Retain和Copy的区别
- opencv中clone和copy的区别
- Factory method 和 Abstract factory的区别
- JAVA字符串中所用的方法
- JAVA字符串中所用的方法
- JAVA字符串中所用的方法
- ByteBuffer.allocate()与ByteBuffer.allocateDirect()方法的区别。
- angularjs中service、factory和provider的区别
- 在 HibernateUtil 中使用的线程安全的实现方法和所用知道的一点点说明
- retain和copy的区别
- 自助Linux之问题诊断工具strace
- Java多线程:线程死锁
- 排序算法(冒泡排序、选择排序、插入排序)
- 数据库学习网址
- 搜索引擎简介
- VMM 中 factory 所用的 copy 和 allocate 方法的区别
- Linux故障处理最佳实践
- 博客正式更名啦
- ehcache版本问题导致的一个错误edu.emory.mathcs.backport...
- Struts2完成文件的下载
- 第三周实验报告二
- SOA实践
- 佛法中是如何解释宇宙和生命的诞生的?
- 总结