路科验证的个人空间 https://blog.eetop.cn/1561828 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

SV及UVM高级话题篇之四:OVM到UVM的移植(续1)

已有 1464 次阅读| 2018-6-29 19:01 |个人分类:验证系统思想|系统分类:芯片设计

OVM到UVM的代码自动转换


在完成上面的检视和修改之后,我们可以运行UVM安装包自带的脚本ovm-to-uvm10.pl,这一脚本会将.sv/.svh后缀扩展名文件代码中的OVM关键词转换为UVM关键词。通过这个脚本我们可以完成下面的自动化替换:

  • 在.sv/.svh后缀名文件中的ovm字符会被替换为uvm字符。

  • 文件名本生含有ovm的文件会被替换为uvm。

  • 一个替换记录报告文件会生成,其中记录所有的替换历史即转换前后的不同。

  • 用户可以通过--backup选项来决定是否需要备份替换前的文件,或者通过--write来决定是否需要直接在原文件上修改。

  • --all_text_files选项会将目录中其它的文件例如脚本文件中的ovm关键词也替换为uvm。


替换OVM phase方法


在完成了上面的基本替换之后,我们还需要考虑哪些OVM中的特性无法只通过替换关键词来实现转换步骤的。接下来在第三个步骤中需要替换OVM phase方法。下面是OVM和UVM中的一段例码:


OVM中phase的代码

class my component extends ovm_component      `ovm_component_utils(my_component)    

  ...   

  extern function void build();   

  extern function void connect();   

  extern task run; 

endclass 

 

function void my_component::build();    

    super.build();   

    ... 

  endfunction 

  ...


UVM中phase代码

class my component extends uvm_component

  `uvm_component_utils(my_component)   

  ...  

  extern function void build_phase(uvm_phase phase);  

  extern function void connect_phase(uvm_phase phase);  

  extern task run_phase(uvm_phase phase);

endclass 

 

function void my_component::build_phase(uvm_phase phase);

  super.build_phase(phase);  

  ...

endfunction 

...


对于两种方法学都熟悉的用户可以从上面的不同中看出,在迁移到UVM之后,建议将原有的phase方法名添加后缀“<name>_phase”,同时给添加参数“uvm_phase phase”。


替换OVM objection方法


在UVM中,原本在OVM中适用的stop()和global_stop_request()方法已经废弃,取而代之的是通过在phase阶段中挂起objection来控制仿真的结束。例如,在原来顶层的OVM test中,会使用global_stop_request()在序列发送完来结束仿真,而在UVM中需要使用uvm_phase来控制。


OVM中使用global_stop_request

task run();   

  seq.start( m_virtual_sequencer );   

  global_stop_request(); 

endtask


UVM中使用uvm_phase

task run_phase( uvm_phase phase );

  phase.raise_objection( this );  

  seq.start( m_virtual_sequencer );  

  phase.lower_objection( this ); 

endtask

类似地,以前通过uvm_test_done对象来实现全局控制结束的方式,在UVM中也交给了uvm_phase的控制,这就使得objection机制保持了风格统一。


OVM中使用ovm_test_done

task run();   

  ovm_test_done.raise_objection( this );   

  seq.start( m_virtual_sequencer );   

  ovm_test_done.drop_objection( this ); 

endtask


UVM中使用run_phase

task run_phase( uvm_phase phase );

  phase.raise_objection( this , "started sequence" );  

  seq.start( m_virtual_sequencer );  


点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 253

    粉丝
  • 25

    好友
  • 33

    获赞
  • 45

    评论
  • 访问数
关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-25 01:02 , Processed in 0.023095 second(s), 12 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部