EDA Tool Usage for Coverage


For the purpose of Code Coverage and Functional Coverage generation, we will use the below code fragment (Filename : "top.sv") :

                          
  • The above code contains some random logic like a counter that runs on a clock and resets on a reset signal.
  • The above code also implements some Functional Coverage in the form of an implemented covergroup with a range of bins that account for different values of 'count' variable.
In the previous blog we already discussed and covered on how to simulate and dump Verilog/System-Verilog code on multiple simulators, and generate wave dumps.

A Coverage Dump however is another for of a metric that helps the user understand of how much of the design has actually been covered.

  • Generally tools have their own proprietary dumping formats that they adopt and can have their own set of internal proprietary tools (Specifiec to Individual Vendor).
  • Vendors may also choose to have Coverage Viewing/Analysis integrated as part of their toolchain.
  • Vendors also provide with multiple support tools for dumping coverage metrics in the form of more accessible/readable formats like Text/HTML Pages etc.

Synopsys VCS

In addition to the previously discussed compile time options for vcs, there is the -cm <arguments> switch that is used to specify the type of coverage metrics to compile.

The -cm switch, takes the below mentioned arguments :

ArgumentFunction
lineCompiles for line or statement coverage
condCompiles for condition coverage
fsmCompiles for FSM coverage
tglCompiles for toggle coverage
pathCompiles for path coverage
branchCompiles for branch coverage
assertCompiles for System-Verilog Assertions coverage
Generating a .vdb database

Refer below commandline, that compiles the file for all coverage types :

                          

The command generates the following log :

                          

The command generates a .vdb file by the name simv.vdb in the present directory where the command was fired. This is the required coverage dump generated. .vdb is the proprietary extension and format adopted by Synopsys for their coverage dumps.

Analyzing .vdb database with Verdi

Synopsys Verdi is a multi-utiliy tool that also provides with the functionality of viewing and analyzing coverage data graphically.

If the user has Verdi installed and all respective licenses are loaded properly, then the below verdi command can to used to open a .vdb dump (here the .vdb dump generated was simv.vdb) in verdi and analyze coverage in GUI mode.

                          

This opens the Verdi GUI with the coverage information loaded. Ref fig below.

Could not load fig. Plz refresh
Consolidated Coverage Score in Verdi GUI
Dumping Coverage Report in HTML or Text Format

Synopsys comes with a separate utility called 'urg' which takes cares of managing many coverage related tasks like reporting, merging etc.

urg works with many switches (Details can be accessed using command 'urg -help'). However we are going to discuss only a few basic ones here :

SwitchFunction
-report <dir>Generate report in <dir> instead of default directory. Default report directory is 'urgReport'.
-dir <dir>Use <dir> as directory for source data.
-log <file>Send diagnostics to given file as well as stdout/stderr.
-format text/bothDefault format is HTML. When 'text' is specified as argument, only text reports are generated. When 'both' is specified as argument, both text and HTML reports are generated.
-lcaEnable limited customer availability features and print warning message.
-full64Use 64 bit URG.

Refer, command below for generating both text and HTML coverage reports from the generated simv.vdb file.

The command generates all the coverage reports in a directory named 'cov_reports'. The -lca feature is used as the .vdb was generated to account for path coverage as well, which is a tool specific special feature. the 'simv.vdb' file is specified with the -dir switch and option for dumping both HTML and Text dumps is specified with the -format switch. An output logfile 'cov.log' is also generated for debug.

                          

In the generated cov_reports directory, dashboard.html file can be opened using any web browser application to with the coverage stats. Snippet shown below :

Could not load fig. Plz refresh
Consolidated Coverage Score in Web Browser Window

Text (.txt) reports are also generated in the cov_reports directory. Few shown below :

                          
                          
                          
                          

NOTE : All Cadence Documentation related help can be invoked via the command : cdnshelp

Cadence NCSim/irun/xrun

In addition to the previously discussed compile time options for ncvlog/irun/xrun, there is the -coverage <arguments> switch that is used to specify the type of coverage metrics to compile.

The -coverage switch, takes the below mentioned arguments :

ArgumentFunction
block (b) Enable block coverage
expr (e) Enable expression coverage
fsm (f) Enable FSM coverage
toggle (t) Enable toggle coverage
Functional (u) Enable functional coverage
all (a) Enable all supported coverage types
NOTE : You can specify more than one coverage type by separating the coverage types with a colon. For example : irun -coverage block:fsm
Generating a .ucd database

Refer below commandline, that compiles the file for all coverage types :

                          

The command generates the following log :

                          

The command generates a directory cov_work in the same directory where the command was fired. The command also generates a .ucd file in /cov_work/scope/test which is the generated coverage database.

Analyzing .ucd database with IMC (Incisive Metrics Center)

Cadence uses the IMC (Incisive Metrics Center) tool utility for the purpose of Analyzing and Reporting the coverage generated. IMC can be operated in both GUI and batch mode.

Here, we will see opeing the generated .ucd dump in IMC GUI window. Use below command :

NOTE : All supported switches for imc can be accessed via its help using command : imc -h
                          

The above command opens the IMC GUI window with all the metrics loaded for analysis. Shown in fig below :

Could not load fig. Plz refresh
Consolidated Coverage Score in IMC GUI

In GUI mode, all the coverage metrics can be dumped in HTML format using : Analysis -> Reports -> Report -> (Select Path and Directory name) -> OK

This creates the directory with respective HTML files for viewing the coverage metrics in a browser window. For the above example, we created directory by name html_cov_reports, which contains the index.html file, which can further be invoked using ang web browsing tool.

Refer browser snippet below of the generated coverage report :

Could not load fig. Plz refresh
Consolidated Coverage Score in Web Browser Window
Dumping Coverage Report in HTML or Text Format

The generation of coverage reports in HTML and Text formats can also be done with imc by using it in batch mode instead of GUI.

Below command invokes imc in batch mode. The database to load is specified with the -load switch.

                          

This invokes the imc in batch mode as an interactive shell, where internal imc commands can be used to genererate and report coverage dumps.

The command-line interactive mode of IMC provides following two commands for generating reports:
  • report
  • report_metrics

For example, using the internal command 'report' in the interactive shell, generates the following output :

                          
NOTE : You can also use the report command with the '-out <output_filename>' switch. This dumps the metrics in an output text file (Below command dumps coverage metrics in an output text file 'cov_reports.txt').
                          

Similarly, using the 'report_metrics' command generates the follwoing output (NOTE : This generates the same HTML output as seen previously using GUI window):

                          

Mentor Questasim

In addition to the previously discussed compile time options for Questasim'svlog, there is the +cover=<arguments> switch that is used to specify the type of coverage metrics to compile.

The +cover= switch, takes the below mentioned arguments :

ArgumentFunction
bCollect branch statistics
cCollect condition statistics
eCollect expression statistics
sCollect statement statistics
tCollect toggle statistics (Overridden if 'x' is specified)
xCollect extended toggle statistics
fCollect FSM statistics

Usage Example : +cover=bces (Collects branch, condition, expression and statement coverage)

Usage Example : +cover=st (Collects statement and toggle coverage)

NOTE : The +cover argument with no arguments is equivalent to "+cover=bcesft".
Generating a .ucdb database

Refer below commandline, that compiles the file for all coverage types :

                          

The simulation is run using vsim.

While working with Questasim previously, we have seen that the simulator 'vsim' takes commands of its own as well as commands that have to be explicitly specified as part of its its current run with the '-do' switch. We will discuss the switches being used with vsim here :

vsim arguments

SwitchFunction
-coverage(Optional) Enables code coverage statistics collection during simulation. Important: You must use the +cover argument during compilation in order for coverage to be collected and displayed.
-coveranalysis(optional) Display alias toggle nodes in coverage reports and in the GUI, and save those nodes in the UCDB files.
-cvgperinstance(optional) Enables non-critical functionality which might change the appearance or content of coverage metrics.

vsim -do arguments

CommandFunction
coverage save-codeAll : (optional) Specifies that the command applies to all coverage types. Equivalent to -code bcestf or no specification of type at all.
-cvg(optional) Save only covergroup coverage data.
-onexit(optional) Causes Questa SIM to save coverage data automatically when the simulator exits.

Thus we fire the overall vsim command :

                          

The command generates the following log :

                          

This generates the specified .ucdb filename as the coverage database. The above command generates the coverage database with name 'coverage_dump.ucdb'.

Analyzing .ucdb database with VSIM in GUI Mode

vsim can be used in GUI mode for the analysis of the generated .ucdb coverage database. Use below command to open the coverage database in GUI mode.

                          

This opens all the coverage metrics in the vsim GUI window. Shown below :

Could not load fig. Plz refresh
Consolidated Coverage Score in VSIM GUI
Dumping Coverage Report in HTML or Text Format

The coverage report in text can be generated using the 'vcover report' command (Shown Below). The output file to dump is specified with the -output switch :

                          

This generates an output text file 'cov_dump.txt', shown below :

                          

HTML dump can also be created as coverage report by specifying the switch '-html' to the 'vcover report' command. The output directory name can also be specified. Command shown below :

                          

This creates directory 'cov_dump_html' in the same directory where the command was fired. The directory contains the index.html file, which can now be opened with any web browser utility for analysis. Snippet shown below :

Could not load fig. Plz refresh
Consolidated Coverage Score in Web Browser Window