You are on page 1of 3

How to generate coverage in VCS (SNPS) , QUESTA and NC


STEP1: Compile your design files with your selected coverage
QuestaSim > vlog +cover <bcst> -f design_file_list
+cover [=s b c e f t x] Enable code coverage metrics by specifying one or more of the
s - Statement
b - Branch
c - Condition
e - Expression
f - Fsm
t - Toggle
x - Extended toggle
Note: If no character is specified, sbceft is the default.

Simulate with the coverage option
QuestaSim > vsim -coverage file_testbench.v
and the run -all

You can enable it using GUI Mode also.
Go to Compile > Compile Options and select the Coverage tab.Another option
is,you have to just right-click on your design file at "Project" and choose "Properties". Now, you
can see coverage tab. After running the simulation and you will be able to see the coverage tabs
for analysis.
If you are running regression and you have to save the coverage report of the first
test (UCDB file) and merge to the next UCDB of the next test till the regression finishes.And
finally you will be able to the see total Code Coverage.
vsim -c -do "coverage save -onexit <TESTSET_CODE_COVER>.ucdb ; run
-all;exit" -coverage -voptargs="+cover=bcfst" <otherOptions> <TOP>
Here we tell vsim to
1. Enable code coverage (-coverage),
2. The types of coverage to collect (via -voptargs=+cover= bcefst").
3. To produce a coverage database file on the exit of simulation (do "coverage save -onexit
4. Continue the step1 and Step2 till the regression ends
Further if you have multiple coverage databases, you can merge them into a single
database by using:
vcover merge <ucdbFile1>.ucdb <ucdbFile2>.ucdb ... <ucdbFileN>.ucdb

cov 2.ucdb NC SIM ncverilog <OTHER_ARGUMENTS> +nccoverage+all +nccov58 +nccovworkdir+cov_work +nclexpragma +nccovtest+<testcase_name> +nccovoverwrite +nccovdut+worklib..dut_top -T test_top.rpt VCS 1. //*********************dut_cov. > detail. To generate functional coverage % urg -dir simv.cmd //********************* iccr1...cmd **********************// load_test cov_work/design/* report_summary -instance -cgopt top.cmd **********************// merge cov_work/design/test* -output merged_dir reset_coverage load_test cov_work/design/merged_dir report_detail -instance -betsafd -cgopt top.cmd OR iccr -keywords+dontmerge iccr3.. To view coverage: iccr -keywords+detail iccr1. select_functional select_fsm //************************************************// Note : During simulation use : covoverwrite -covtest mycov. For switching coverage ON : Use +nccovfile+dut_cov..cmd **********************// merge cov_work/design/test* -output merged_dir reset_coverage load_test cov_work/design/merged_dir report_summary -instance -cgopt top..cmd OR iccr -keywords+summary iccr2.rpt //********************* iccr3.txt while compiling..The finally you can generate a HTML report: vcover report -html -htmldir <dirToOutput> -verbose -threshL 50 -threshH 90 <ucdbFileResult>.. > 1.vdb .. > summary.rpt //********************* iccr2.txt****************// select_coverage -all -module top ....

cm -cm_name XXX -cm_report summary .2. To generate code coverage % vcs -cm_pp -cm_dir simv.