coverage report
转载:http://blog.sina.cn/dpool/blog/s/blog_7853c3910102yn77.html
VCS仿真可以分成两步法或三步法, 对Mix language, 必须用三步法。我呢,因为运用都是简单的非mix language,所以经常用一步法,因为这样省劲,但是对于跑regression最好还是两步法。VCS对应的waveform工具有DVE和Verdi, DVE因为是原生的,所以VCS对DVE非常友好。但DVE已经过时了,其对uvm等新feature支持的不好。Verdi是Debussy公司的产品,现在已被Synopsys收购并着力发展,说以Verdi是未来的潮流。所以此文的dump fsdb波形和查看coverage都用verdi. 具体来说VCS两步是:
1. 编译verilog文件成为一个可执行的二进制文件命令为:vcs source_files
2. 运行该可执行文件:./simv
当然,类似于NC,也有一步运行方式,那就是加-R,表示编译后立即执行。
VCS使用使用实例
我的此例子涉及task和$value$plusargs等verilog语法,这里(https://blog.csdn.net/limanjihe/article/details/52325930)可以复习下。此例子的vcs命令是:
vcs --sverilog -R -fsdb -ucli -do run_vcs.tcl -cm line+tgl+branch+assert -cm_name test1 +test_name=test1 tb_top.v
vcs -sverilog -R -fsdb -ucli -do run_vcs.tcl -cm line+tgl+branch+assert -cm_name test2 +test_name=test2 tb_top.v
verdi -cov -covdir simv.vdb/ &
简单解释一下这里的选项:
-sverilog是说支持sv语法;
-R表示编译后立即执行;
-fsdb表示dump fsdb文件
-ucli -do run_vcs.tcl表示要执行这个仿真tcl控制;
-cm line+tgl+branch+assert表示 coverage覆盖line/toggle/branch/assert ;
-cm_name test1表示生成coverage的一个test的目录名称test1(仿真后会生成simv.vdb/snps/coverage/db/testdata/test1);
+test_name 表示要传递给TB一个test_name 参数。
例子的verilog代码文件top_tb.v :
module tb_top();
reg clk, rst, load;
wire [3:0] out;
always #5 clk=~clk;
reg [255:0] test_name;
initial
begin
clk=1'b0; rst=1'b0; load=0;
#30;
$value$plusargs('test_name=%s',test_name);
if(test_name=='test1')
test1;
else if(test_name=='test2')
test2;
#70;
$finish;
end
task test1;
rst=1'b1;
#10 load=0;
endtask
task test2;
rst=1'b1; load=1;
#10 load=0;
endtask
counter u_counter(.reset(rst),
.clk(clk),
.load(load),
.load_value(4'h8),
.q(out));
endmodule
module counter(reset,clk,load,load_value,q);
input reset,clk;
input load;
input [3:0] load_value;
output[3:0] q;
reg[3:0]q;
reg[3:0]count;
always@(posedge clk)
if(!reset)
q<=4'h0;
else if(load)
q<= load_value;
else if(q==4'b1111)
q<=4'b0;
else
q<=q+1;
endmodule
run_vcs.tcl:
config timebase 1ns
scope tb_top
run 1ns
call \$fsdbDumpfile('counter.fsdb');
call \$fsdbDumpvars(0,tb_top);
call \$fsdbDumpSVA;
# Run to completion
run
quit
这个例子运行后,产生simv.vdb/snps/coverage/db/testdata/test1 和simv.vdb/snps/coverage/db/testdata/test2两个 test的coverage文件,用verdi打开是这样的界面:

VCS仿真和多个test用urg工具生成coverage文件,verdi查看VCS中的覆盖率分析
VCS在仿真过程中,也可以收集Coverage Metric。其中覆盖率类型有:
1. Code Coverage:包括line,condition, branch, toggle和FSM coverage。
2. Functional Coverage:包括covergroup,assert 。
Coverage Database的产生:包含所有的有关coverage的信息,默认放在simv.vdb文件夹下。db中的默认路径是:
snps/coverage/db/testdata/line.verilog.data.xml
fsm/cond/tgl/branch等xml信息。
在编译命令中:
vcs [cover_options] [compile_options] source.v
[cover_options]可以是:
-cm line+cond+tgl+fsm+branch+assert
-cm_dir在compile options中改变simv.vdb文件夹的位置。
-cm_name指定testname。主要改变testname在db中的命名。
在仿真过程中:
simv [cover_options] [run_options]
[cover_options]可以是:-cm line+cond+tgl+fsm+branch+assert
[run_options]指定runtime options。
Coverage Reports的产生:
使用工具URG(Unified Report Generator)产生html格式文件。
urg -dir dir1 [urg_option] -dbname merge
使用DVE的GUI界面。
dve -cov -dir
使用verdi的gui界面。
verdi -cov -covdir
verdi -cov -h,打印coverage mode下的帮助信息
其他的vcs编译和仿真中的option:
-cm_hier,在编过程中,指定收集coverage的scope。(格式可以包含正则表达式,语句可以+tree -tree -moduletree等)
-cm_assert_hier,在编译过程中,只是指定不收集coverage的assert hier。其中hier的表示,+/- module,+/- tree,+/-assert
-cm_count,在gui和urg report中,显示次数,比如toggle的次数。
-cm_glitch period,不收集一定范围的glitch的coverage。simulation option
-cm_start/stop,指定coverage收集的时间,simulation option coverage group相关的option;
-covg_disable_cg,关闭所有的coverage group的收集urg生成report中的option:
-dir,指定需要拿到的db的hier,
-dbname,指定输出的merge db的hier
-elfile,指定exclusive的file,这样更好计算coverage。
-elfilelist 忽略中每一个.el文件。(Specifies a file containing a list of exclude files)
-noreport,不输出最终的report,只是merge db
-format text/both,指定report的输出格式
-matric [line,cond,fsm,tgl,branch,assert]执行计算的coverage类型
-parallel,并行merge
-full64,以64bit的程序进行merge
-plan,-userdata,-userdatafile,-hvp_no_score_missing,指定hvp相关的生成信息。
实际工程中urg除了生成coverage报告,还经常要把几个仿真产生的vdb文件merge到一起,三个目的:
1. 实现比较高的coverage
2. 让verdi load coverage速度大大提高(我们几百个test下来,merge后load只要几分钟,而不merge需要半个到一个小时)
3. 不同level testbench跑出来的结果需要merge到一起(前公司用过把block的merge到system level)
这个merge+生成coverage命令大体是这样的
urg -full64 -metric line+tgl+cond+fsm+assert+branch -warn none -dbname .vdb -dir simv.vdb -elfile
注意:其中-dir之后的第一个vdb会被认为是base data,如果产生其他vdb的RTL与base不同,将不能被Merge进来
verdi查看coverage命令:**verdi -cov -covdir .vdb &**
如下是某个工程中使用的生成coverage并merge若干vdb文件到vcs_sim_exe_total.vdb的命令:
urg -full64 -parallel -show ratios -show tests -dir /proj/vcs_sim_exe_merge.vdb /proj/vcs_sim_exe _bak.vdb -hier /proj/dut_hier -elfilelist /proj/elfilelist.el -plan /proj/vplan/DUT.hvp -dbname /proj/vcs_sim_exe_total.vdb -report /proj/rpt/4332 -log /proj/gen_cov_dut.log
这里特别说明下这个选项: -hier /proj/dut_hier
-hier表示只针对dut_hier中定义的(URG has an option, -hier, that accepts a subset of the controls that can be used in the compile-time -cm_hier file.)spec说不太常用。
参考文献:
https://www.baidu.com/link?url=DCf5uEsmPEps3u-422ETdJSLGaD6mlBwI6smTGOq7AkUtxUSVq1X4UGqDvym6-NK55EcCVAsDEPjqRUTsh4G4a&wd=&eqid=995ddaf40000e04a000000055e65da74
https://blog.csdn.net/wonder_coole/article/details/79618696
https://www.cnblogs.com/-9-8/p/4478833.html
https://blog.csdn.net/kevindas/article/details/81462217
https://blog.csdn.net/gsjthxy/article/details/88429983
coverage report的更多相关文章
- AngularJS unit test report / coverage report
参考来源: http://www.cnblogs.com/vipyoumay/p/5331787.html 这篇是学习基于Angularjs的nodejs平台的单元测试报告和覆盖率报告.用到的都是现有 ...
- Python 代码覆盖率统计工具 coverage.py
coverage.py是一个用来统计python程序代码覆盖率的工具.它使用起来非常简单,并且支持最终生成界面友好的html报告.在最新版本中,还提供了分支覆盖的功能. 官方网站: http://ne ...
- [Webpack 2] Ensure all source files are included in test coverage reports with Webpack
If you’re only instrumenting the files in your project that are under test then your code coverage r ...
- Jenkins integration for AngularJS code coverage
Install Jenkins plugins 'Cobertura' and 'HTML Publisher' 1. add Post-build Actions "Publish HTM ...
- jenkins综合cobertura,来电显示cobertura的report
我的项目是使用maven作为构建工具.左右maven如何整合jenkins请参阅: http://blog.csdn.net/yaominhua/article/details/40684355 本文 ...
- CI集成phpunit Error: No code coverage driver is available 的解决
CI集成phpunit时,运行报No code coverage driver is available的错误,如下图: yanglingdeMacBook-Pro:tests yangling$ p ...
- 使用Coverage进行代码覆盖率的测试
软件测试实验报告 一.实验目的: 使用软件测试代码覆盖率. 二.实验工具: Windows10.Python3.6.3.Coverage. 三.实验内容: 1.编写准备测试的代码main.py和测试代 ...
- SV coverage
covergroup是对coverage model的一种包装,每个covergroup可以包含: 1) sync event来触发采样, 2) 很多coverpoint, 3) cross cove ...
- python 代码覆盖率 coverage用法
先装coverage: D:\test_python\e8_test>pip install coverageCollecting coverage Downloading https://f ...
随机推荐
- Java(65-80)【方法、数组】
1.方法的三种调用:单独调用.打印调用.赋值调用 单独调用就是调用方法并不进行输出: 打印调用就是对方法进行输出 赋值调用就是将结果赋值给一个变量再进行输出 void是没有返回值的,因此只能进行赋值单 ...
- 关于SpringBoot结合mybatis后遇到的坑
先放出我遇到的出错信息,真的出错了可以先看看出错信息,就能更加高效准确的搜索到信息 我的报错日志: org.springframework.beans.factory.UnsatisfiedDepen ...
- 集群,lvs负载均衡的四种工作模式
集群 集群的三种分类以及用途 负载均衡: 分配流量(调度器),提升速度 高可用: 关键性业务 高性能: 开发算法,天气预报,国家安全 负载均衡的集群 lvs(适用于大规模) haproxy(适用于中型 ...
- 转载:微信小程序view布局
https://www.cnblogs.com/sun8134/p/6395947.html
- 播放视频插件swfobject.js与Video Html5
播放视频的方法: 方法一. 使用HTML5播放 <video src="./files/Clip_480_5sec_6mbps_h264.mp4" width="1 ...
- MetaWeblog访问地址
MetaWeblog访问地址 https://rpc.cnblogs.com/metaweblog/csnd
- hdu2489-DFS+最小生成树
题意: 给你n个点,和任意两点的距离,让你在这N个点中找到一个有m个点并且ratio最小的树. ratio = sum(edge) / su ...
- hdu5253最小生成树
题意:(中文题,直接粘过来吧) 连接的管道 ...
- python中实现打印特定字符变换
首先需要将 lib文件 放在该文件同一目录 使用的时候,先导入 from lib.common import print_msg ,然后调用里面的 print_msg() 方法即可! lib文件地址: ...
- 在 Peach 中使用发布者进行调试
0x01 桃子平台 桃子平台(Peach)是一款流行的 Fuzz 平台,主要用作二进制文件及网络协议的模糊测试.其原理遵循基本的模糊测试流程,比较有特色的是它依赖用户所编写的 Pit 文件,同时输入的 ...