coverage merge
参考1
参考2
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 <filename> 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目录下。
- -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.
只对指定层次的模块,以及该层次下的模块,统计coverage。level_number,表示从该层次模块,向下统计coverage的层次。0表示统计所有,1表示只统计当前层,2表示统计当前层和下一层,之后依次类推。
3.2 -tree instance_name [level_number]
VC VCS exclude this instance from coverage and other instances under it. These instances can be Verilog module or VHDL entity instances. VCS include all other instances in 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, and so on.If the subhierarchy includes instances in the other HDL, VCS does not exclude these instances.
只对指定层次的模块,以及该层次下的模块,不统计coverage。level_number,表示从该层次模块,向下不统计coverage的层次。0表示不统计所有,1表示只不统计当前层,2表示不统计当前层和下一层,之后依次类推。
3.3 +module module_name | entity_name
VCS compiles all instances of the specified Verilog module or VHDL entity definition, and excludes all other definitions under it, for coverage.
只对指定模块统计coverage。
3.4 -module module_name | entity_name
VCS does not compile all instances of the specified Verilog module or VHDL entity definition, and includes all other definitions under it, for coverage.
只对指定模块不统计coverage
3.5 +file file_name
VCS compile for coverage only the code in this file. If the file is not in the current directory, specify the path name of the file.
对指定的文件,统计该文件内模块的coverage。如果file_name不是当前路径下,那么需要使用绝对路径。
3.6 -file file_name
VCS exclude the code in this file from coverage. If the file is not in the current directory, specify the path name of the file.
对指定的文件,不统计该文件内模块的coverage。如果file_name不是当前路径下,那么需要使用绝对路径。
3.7 +filelist file_name
VCS compile for coverage only the source files listed in the specified file.
只对file_name文件,统计该文件里面指定的源文件中模块的coverage。
3.8 -filelist file_name
VCS exclude from coverage the source files listed in the specified file.
只对file_name文件,不统计该文件里面指定的源文件中模块的coverage。
3.9 +moduletree module_name [level_number]
VCS provides coverage metrics for all instances of the specified module and for all module instances in the hierarchy below the specified module. In other words, each hierarchy tree starting at each instance of the specified module will have coverage metrics provided. The coverage metrics are only provided for the number of levels of hierarchy specified by the optional level_number.
对指定的模块,以及该模块下的模块,统计coverage。level_number,表示从该模块,向下统计coverage的层次。0表示统计所有,1表示只统计当前层,2表示统计当前层和下一层,之后依次类推。
3.10 -moduletree module_name [level_number]
VCS excludes coverage metrics for all instances of the specified module and for all module instances in the hierarchy below the specified module. In other words, each hierarchy tree starting at each instance of the specified module will have coverage metrics excluded. The coverage metrics are only excluded for the number of levels of hierarchy specified by the optional level_number.
对指定的模块,以及该模块下的模块,不统计coverage。level_number,表示从该模块,向下统计coverage的层次。0表示统计所有,1表示只统计当前层,2表示统计当前层和下一层,之后依次类推。
3.11 +/-node
Excludes or includes a signal in toggle coverage.
去除或者包括对指定信号toggle coverage的统计。后面跟信号的绝对路径,可以使用通配符*。
如:
+node top.cnt_inst.out[7:5] //对该信号,不统计toggler-node top.cnt_inst.out[4:0] //对该信号,统计toggler
比如我们想收集,tb_top.aaa.bbb.ccc 这个模块,以及模块之下的coverage,那config文件内容如下:
+tree tb_top.aaa.bbb.ccc 0
比如我们想收集,ccc 这个模块,以及模块之下的coverage,那config文件内容如下:
+moduletree ccc 0
如果只想收集ccc这个模块呢:
+moduletree ccc 1
四、查看coverage
- dve
如果使用dve,使用如下命令查看coverage数据:
dve -full64 -cov -dir simv.vdb
如果使用verdi,使用如下命令查看coverage数据:
verdi -cov -cov_dir simv.vdb
urg
urg命令,可以将coverage数据,转换成html。
urg -dir simv.vdb
在当前目录下,会生成 urgReport 目录,里面有生成的html文件,使用浏览器即可查看这些文件。
映射覆盖---摘自《覆盖技术参考手册》。
代码覆盖率数据是按模块和实例收集的。如果
设计层次结构的改变,模块或实例的列表
使用map可以把来自不同的设计环境下的覆盖率合并。
使用map可以把来自不同设计环境下的覆盖率合并。可以在不同的环境下编译一个设计(或是设计的一部分),但是任然可以获取合并的覆盖率,只有当设计的subtree在进行合并的所有不同版本的设计中保持一致才可以。 在以下情况下可以使用map进行覆盖率的合并:。
1)从block level收集部分覆盖率,且又从system level收集部分覆盖率时;。
2)验证流程设计替换不同的顶层试验台,这些试验台例化设计时;。
可以合并来自一些非相同地区的覆盖数据。
使用映射的设计。您可以编译一个设计(或一个设计的一部分)。
设计)与多个不同的语境,并仍然合并覆盖面
数据,但只针对设计的子树,这些子树在所有的
的版本,您要合并的设计。当一些
在区块一级收集覆盖数据,并收集该区块的其他数据。
块在系统级仿真中被收集,或者当检验
这个过程涉及到交换不同的顶层测试平台,这些测试平台是
每一个实例化设计。
可以在2个不同的设计环镜下例化较低层次的模块,即例化subhierarchy(设计中的模块实例,以及此模块实例下的所有子模块)。可以从2个设计的仿真结果中看到subhierarchy结合的覆盖率coverage。
你可以实例化一个子层次(设计中的模块实例,以及此模块实例下的所有子模块)。
以及该实例下的所有模块实例的层次结构)中的
两种不同的设计,并查看合并后的覆盖范围。
使用-map选项来map 多个设计环境下subhierarchy的覆盖率。
使用-map选项来map 多个设计环境下subhierarchy的覆盖率。在文件hierarchy.html文件中会产生全路径(绝对路径)。-map选项可以再code coverage和assertion coverage中使用,不可以在group coverage中使用。
使用-map选项可以映射一个设计中的子层次覆盖率。
到另一个。完整的层次结构应在
hierachy.html文件。这个选项在代码覆盖和
断言覆盖,但不支持群体覆盖。
-map选项的语言如下
urg -dir [BaseDesign].vdb -dir [InputDesign].vdb -map
也可以理解为
urg -dir [fullchip].vdb -dir [standalone].vdb -map
第一个.vdb文件来自BaseDesign,第二个.vdb文件来自InputDesgin。InputDesign的覆盖率合并到BaseDesign中。合并后的coverage可以再BaseDesign的覆盖率目录中找到。
以我merge coverage实例来说,在fullchip和standalone的coverage进行merge时,需要把fullchip的database放在前面,standalone的放在后面。
以我merge覆盖实例来说,在fullchip和standalone的覆盖进行merge时,需要把fullchip的database放在前面,standalone的放在后面。
第二个提供给URG命令行的目录是Input design。
输入的设计覆盖范围将被合并到基础设计中。
累计覆盖率将与基础设计覆盖率目录一起提供。
指定subhierarchy顶层模块名字,但不顶层模块名字前不可加上路径。
从一个设计到另一个设计map覆盖率时,源文件名字必须一致。
从一个设计到另一个map设计覆盖率时,源文件名字必须一致。
子级。不要把顶层的层级名称写成
的模块实例。
如果模块不是来自默认的逻辑库,则模块的名称为
必须在模块名前加上库名(大写)。
例如:
% urg -map HDL_WORK.su_top ...
注意:
当您把一个设计的覆盖范围映射到另一个设计上时,源文件
文件名必须相同。例如,考虑以下内容
图例
如第38页图5-6所示,有两种设计。
实例化一个共同的子层级,标记为sub1。的代码。
子层次结构,在这两种设计中,都是在名为sub1.v的源文件中。
中的顶层模块的模块名(标识符)。
子层级为sub1。这个图示显示了映射覆盖率
从模拟设计2到该子层次的信息。
该子层级的覆盖信息从模拟的。
设计1。子层级可以有多个实例,在
覆盖率信息映射的设计(映射)。
设计)。) 然而,只能有一个实例的
设计中的子层次,其中覆盖信息是指
映射(基础设计)。
下面的程序说明如何映射覆盖信息。
- 编译覆盖的基础设计,然后模拟该
设计,同时监测覆盖率。例如
cd /net/design1
vcs -cm line sub1.v sub2.v sub3.v sub4.v main.v test.v
simv -cm line - 编制覆盖范围的映射设计,然后模拟该设计。
设计,同时监测覆盖率。例如
cd /net/design2
vcs -cm line sub1.v sub5.v main.v test.v
simv -cm line
3 运行URG,指定顶层模块的名称,在
子级。同时,指定覆盖目录为基础的
设计,然后指定映射的设计。例如
urg -dir /net/design1/simv.vdb /net/design2/simv.vdb -。
地图sub1
使用上面的命令,生成的报告文件只含有
的模块实例的部分。这些模块
实例通过其在第一个(或第二个)层次结构名称来识别。
基础)设计。这些部分的覆盖信息是
的覆盖信息。
如果您还包含了 -hier 编译时选项,以指定一个更大的
的子层级,其中包括你想要的子层级。
绘制的覆盖范围,由此产生的报告文件包含了以下部分: 1.
模块实例,但在这个更大的层次结构中,
在较小的子层级中,也就是具有以下特征的子层级中的实例
覆盖范围,也包含来自其他国家的覆盖信息。
设计。
####################################################################
如果您为中间数据文件指定了不同的位置,那么在
运行时,您必须使用-dir
选项为URG,当生成报告时,所有的目录都可以是...。
也用一个-dir选项列出。
例如,-dir db1.vdb db2.vdb。
命名中间数据文件
默认情况下,当VCS监控任何类型的覆盖范围时,它记录的是
结果在中间数据文件中命名为 "test",并带有各种
扩展,如下所示。
-
line.verilog.data.xml用于行覆盖率
-
fsm.verilog.data.xml for FSM coverage
-
用于条件覆盖的 cond.verilog.data.xml。
-
tgl.verilog.data.xml,用于切换覆盖范围。
-
分支覆盖率的 branch.verilog.data.xml。
默认情况下,VCS将这些文件写入./simv.vdb/snps/。
coverage/db/testdata目录。URG将这些文件读取到
显示覆盖结果。 -
在编译时包含-cm_name选项。例如
vcs source.v -cm line -cm_name testm
此命令行编译成可执行文件的名称为
可执行文件在写入中间数据文件时将会使用。
仿真结束后,simv.vdb/snps/coverage/db/testm
目录中包含行.verilog.data.xml文件。 -
例如,在运行时加入-cm_name选项。
simv -cm line -cm_name testm
您可以覆盖您所拥有的目录名(testm)。
在编译过程中,通过提供一个不同的目录
名称与simv命令行选项(如testn)。
你不能使用选项-cm_name来指定不同的位置。
为这些文件。使用-cm_dir选项让simv将这些文件放置在
生成的文件在不同的目录下。
URG读取./simv.vdb/snps/中的所有测试数据文件。
coverage/db目录下,并将报告文件用
合并结果在 urgReport 目录中。