Author: (\/)@{-}!
•11:43 AM

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

MODELSIM or QUESTA:

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 characters:
                             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. 

STEP2:      Simulate with the coverage option
                  QuestaSim > vsim  -coverage file_testbench.v
                  and the    run   -all 
         OR, 
                  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 coverage.ucdb)
    4.  Continue the step1 and Step2 till the regression ends

STEP3:
            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   <ucdbFileResult>.ucdb

         
            The finally you can generate a HTML report:
               vcover report  -html  -htmldir  <dirToOutput>  -verbose  -threshL 50  -threshH 90  <ucdbFileResult>.ucdb


NC SIM
ncverilog  <OTHER_ARGUMENTS> +nccoverage+all +nccov58 +nccovworkdir+cov_work +nclexpragma +nccovtest+<testcase_name> +nccovoverwrite +nccovdut+worklib.dut_top -T test_top.sv

1. For switching coverage ON :  Use +nccovfile+dut_cov.txt  while compiling.    //*********************dut_cov.txt****************//
          select_coverage -all -module top
             .......
          select_functional
          select_fsm

    //************************************************//
Note : During simulation use : covoverwrite  -covtest mycov.cov

2. To view coverage:
         iccr -keywords+detail iccr1.cmd        OR
         iccr -keywords+summary iccr2.cmd   OR
         iccr -keywords+dontmerge iccr3.cmd
       
       //********************* iccr1.cmd **********************//
          merge cov_work/design/test* -output merged_dir
          reset_coverage
          load_test cov_work/design/merged_dir                                                                                                    report_detail -instance -betsafd -cgopt top... > detail.rpt
     
      //********************* iccr2.cmd **********************//
          merge cov_work/design/test* -output merged_dir 
          reset_coverage
          load_test cov_work/design/merged_dir                                                                                                    report_summary -instance -cgopt top... > summary.rpt 

      //********************* iccr3.cmd **********************//
          load_test cov_work/design/*
          report_summary -instance -cgopt top... > summary.rpt


VCS

1.  To generate functional coverage
      % urg -dir simv.vdb

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