一、vcs cov cmd
在仿真脚本中设置:
-cm cond+fsm+tgl+branch+line 指定覆盖率收集类型
-cm_hier +tree tb_top 0 指定统计范围,一般将其放置在另一个list文件中,便于更改
-cm_hier -tree tb_top.acc 0 不收集该层覆盖率
-cm_dir 指定存放路径,默认simv.vdb在work目录下
-cm_tgl portsonly 只收集接口覆盖率
二、vcs run
仿真完vcs会打印:
---------------------------------------------------------------------------
VCS Coverage Metrics: during simulation , tgl was monitored
---------------------------------------------------------------------------
Coverage status: End of All Coverages …
在work/simv.vdb/snps/coverage/db下生成以下四个目录:auxiliary design shape testdata
三、verdi打开cov
b verdi -cov -covdir simv.vdb 使用verdi打开单个覆盖率文件
b verdi -cov -covdir *.vdb 使用verdi打开多个覆盖率文件
同时导入多个文件可以合并成一个文件保存,逐个导入多个文件同理。
手动:verdi->tools->coverage->File->Open->Add Datebase
四、verdi合并cov
两个文件合并:b urg -dir simv1.vdb -dir simv2.vdb -dbname merged.vdb
多个文件合并使用filelist:b urg -f ./covvdb.flist -dbname merged.vdb
./covvdb.flist: /xxx/xxx/xxx/simv1.vdb
b urg *.vdb -dbname merged.vdb
五、verdi exclude module
单个module exclude:verdi打开cov后,选中module,右键点击Exclude,Reload即可。
一键Exclude:Tools -> Preference -> Exclusion -> Do not allow covered objects to be excluded;File -> Reload Database;代码顶层,右键 -> Select by Levels -> all;Exclude -> Recalculate -> 所有未被覆盖的项均被exclude,其余项为100%;File -> Save all exclusions导出el文件。
使用VCS生成html和text格式报告:b urg -dir simv.vdb -report both
在both目录下生成dashboard.html。
-dir: 指定 .vdb文件夹的位置
-report: 指定生成报告的格式,报告格式有两种,一种网页格式,一种text格式。这里,both代表生成两种。
六、irun配置文件
set_branch_scoring
set_coverage -bef -instance tb_top.tb_top_u …
set_assign_scoring
select_functional
set_expr_scoring -all *
set_expr_coverable_operators -all
set_fsm_arc_scoring -on
set_fsm_arc_termllimit 9999999
set_fsm_scoring _hold_transition
Coverage Options In Compile/Simulation
xrun打开cov:
setenv CDS_INST_DIR
setenv INCISIV_HOME
b imc &
Report导出html目录,使用firefox html_dir/index.html即可打开。
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
一、基本Option
Option

description

-cm line+cond+fsm+tgl+branch+assert

line : Enable collecting line or statement coverage
cond : Enable collecting condition coverage
fsm : Enable collecting FSM coverage
tgl : Enable collecting toggle coverage
branch : Enable collecting branch coverage
assert : Enable collecting SystemVerilog assertion coverage

-cm_libs yv

yv :Enable collecting coverage source code from Verilog libraries
Default doesn’t collect coverage of the library files.

-cm_dir $directory_path_name

Specify an name and location for simv.vdb

Default is simv.vdb

-cm_log $filename

Specify a log file for monitoring coverage.

Default is cm.log. To suppress the log file, you could re-direct the log file to empty path. (ex, -cm_log /dev/null)

-cm_name $testname

Specify a different location for different simulation, used in dsim flow

-cm_hier $filename

Collect particular instances’ coverage

$filename contents
------------------------------
+/-tree i n s t a n c e n a m e [ instance_name [ instancename[level] //level number of 0 (or no level number) specifies the entire sub-hierarchy
+/-module $module_name

-cm_assert_hier $filename

Collect particular assertion’ coverage

$filename contents
------------------------------
+/-assert my_assert
+/-assert A*
+/-assert $instance_name

-cm_line contassign

Specifies enabling line coverage for Verilog continuous assignments.

-cm_tgl portsonly

Only monitor port of toggle coverage, remove net and variables monitor in modules.

二、常见问题及解法
2.1、UCAPI-MAP-SHAPEMISMATCH
When merge vdb files of local simulation to whole chip, you might get the error as following:

“Warning-[UCAPI-MAP-SHAPEMISMATCH] Shape mismatch in mapping”

导致shape mismatch可能有以下几个原因:

Coverage option mismatch;
Make sure the coverage-related options are the same for both vdbs.
For example:if one vdb is compiled with –cm_line contassign and the other isn’t, it will cause shape mismatch;

$vcs_cov_opts .= " -cm_line contassign ";
RTL mismatch;
Version mismatch;
Tool bug;
2.2、Condition Coverage收不全的问题
有时候我们在分析Condition Coverage的时候,发现有些含有“&&”和“||”的语句没有收到Condition Coverage,究其原因,是因为Code中除了“&&”、“||”之外还含有其他逻辑符号。此时需要检查VCS Option。实测,按照如下Option run Simulation,可以收全Condition Coverage。
在compile option里面加上-cm_cond full或者-cm_cond allops可以收到所有含有“&&”和“||”的表达式的Coverage数据。但是建议用-cm_cond allops; full会统计很多没必要关心的非逻辑条件,而且拆分的很细,像@(posedge clk or negedge rest)这种都会去统计。

$cov_opts = " -cm line+tgl+cond+fsm+assertion+branch -cm_noconst -cm_line contassign ";
$cov_opts .= " -cm_cond full+tf+for+anywidth ";
注意:不建议使用上面的option,因为如果有full选项的话,有达到的Condition Coverage数据会非常多,并且大多是不需要关心的,推荐使用如下设定:-cm_cond allops

三、 Coverage Merge
3.1、urg merge option详解
cmd

description

-dir

Use

as directory for source data;

-report

Generate report in

instead of default directory. default report directory is urgReport;

-metric line

Report line coverage;

-metric fsm

Report fsm coverage;

-metric cond

Report cond coverage;

-metric tgl

Report tgl coverage;

-metric assert

Report coverage for monitored cover directives, events and assertions;

-line nocasedef

Exclude case default lines in line coverage

-tgl portsonly

Only report ports in toggle coverage;

-elfile

Exclude coverable objects specified in for code/assertion/group coverage;

-elfilelist

A containing exclusion file names to be loaded;

-hier

Specify the module definitions,instances,hierarchies,and source files you want to exclude or include for report;

-format both

Generate both HTML and text reports;

-show ratios

Show number of covered objects and total number of objects with each score;

-dbname dirname

Creates a merged database in the directory ‘dirname.vdb’. The

name of the merged test will be ‘test’ by default.

-noreport

Generates only the merged results when used with -dbname; this

option does not generate reports

-mode64 | -full64

Use 64 bit URG;

-map

Report on merging mapped modules coverage;

-xmlplan

Also report HVP in the XML format;

3.2、指定收某个Hierarchy的Coverage
此时需要用VCS Option: -cm_hier xxx_ip_tree.cfg
其中xxx_ip_tree.cfg要按照下面的规则来做
如果是指定收某个Hierarchy的Coverage数据:
+tree top.cm_ctrl_top.en_ctrl
+tree top.cm_ctrl_host_top.host_dec
如果是指定不收某个Hierarchy的Coverage数据:
-tree top.cm_ctrl_top.en_ctrl
-tree top.cm_ctrl_host_top.host_dec

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐