vcs产生code coverage与function coverage

原文链接:https://blog.chinaaet.com/weiqi7777/p/5100065684

vcs仿真中,可以产生以下两类coverage:

code coverage
function coverage
对于code coverage,在编译和仿真需要加额外参数。对于function coverage,编译和仿真不需要加额外参数。

一、code coverage

code coverage包含以下一些coverage:

line coverage
toggle coverage
condition coverage
branch coverage
FSM coverage
assert coverage
要使能这些coverage,vcs的-cm选项,来控制,是否产生这些coverage

-cm <cov_metrics_name>

关于cov_metrics_name,有如下选择:

line:使能line coverage
cond:使能cond coverage
tgl:使能toggle coverage
fsm:使能FSM coverage
branch:使能branch coverage
assert:使能assert coverage
多个选项之间,使用+进行连接。例如,要使能line,fsm coverage,使用如下选项:

-cm line+fsm

code coverage选项,在编译和仿真的时候,都必须要有,否则不能正常的生成coverage。

编译如果带有coverage coverage选项,会在编译目录下,生成simv.vdb目录,里面包含了coverage model。

二、function coverage

function coverage,没有选项控制,因为是在代码中指定的。

在编译的时候,不会生成simv.vdb目录,因为function coverage不需要coverage model。

三、coverage其他选项

-cm_dir选项
官方解释:

The -cm_dir <directory_path_name> option enables you to specify an
alternative name or location for saving the default simv.vdb
directory. If not specified, VCS automatically generates the coverage
database with the name simv.vdb or <exe_name>.vdb where, exe_name is
the argument to -o option if included during compilation.

带上coverage选项,vcs编译完毕后,默认会在编译目录,生成simv.vdb文件夹。该文件夹里面,包含了coverage model。

可以通过-cm_dir选项,更改默认的coverage model生成的目录。

仿真的时候,如果没有指定-cm_dir选项,那么使用编译时候指定的simv.vdb的目录。也可以仿真带有-cm_dir选项,修改仿真时,生成的simv.vdb目录位置。

-cm_name选项
官方解释:

The -cm_name option as a compile-time or runtime option
enables you to specify an alternative test name instead of the default
name. The default test name is test
对于每一个test,生成的coverage数据,默认是在simv.vdb/snps/coverage/db/testdata/test目录下

默认coverage数据,是在test目录下,可以通过-cm_name选项,修改默认的test目录。

比如-cm_name load_test,那么coverage数据,就会生成在simv.vdb/snps/coverage/db/testdata/load_test目录下。

3. -cm_hier选项

该选项,在coverage technology reference manual手册上有介绍。

官方解释该选项:

The -cm_hier option is a compile-time option to specify module
definitions, instances and sub-hierarchies, and source files that you
want VCS to either exclude from coverage or exclusively compile for
coverage.
在收集code coverage的时候,工具默认会收集所有模块的coverage。但是有时候,我们只关心某一层模块以及之下的coverage。此时就需要-cm_hier选项来指定层次。

-cm_hier选项,指定一个coverage配置文件。该配置文件,指定了收集coverage的模块。

对于这个coverage配置文件,有如下一些语法:

3.1 +tree instance_name [level_number]
VC VCS compile only the specified instance and the instances under it for coverage. These instances can be Verilog module or VHDL entity instances. VCS exclude all other instances from coverage.

A level number of 0 (or no level number) specifies the entire subhierarchy, 1 specifies only this instance, 2 specifies this instance and those instances directly under this instance, 3 specifies this instance and instances in the subhierarchies that are one and two levels below the specified instance. There is no limit to the integer you specify as the level number.

If the subhierarchy includes instances in the other HDL, VCS does not include these instances.

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值