MT-cover - Your own RTL code coverage tool
Mind Tree Consulting Private Limited. Bangalore, India
Coverage analysis is necessary step to increase the
design productivity because it enables a designer to isolate areas of untested
Design. Coverage, in general, can be divided into two types: 1. Functional
coverage and 2. Code coverage.
Functional coverage focuses on the functionality
of the program, and it is used to check that every aspect of the functionality
is tested. Therefore, functional coverage is design and implementation
specific, and is more costly to measure. The main advantage of functional
coverage is that it allows you to concentrate on the most complicated or
riskiest parts of your design and do it at the right level of abstraction.
Code coverage, on the other hand, concentrates on
measuring syntactic properties in the execution, for example, that each
statement was executed, or each branch was taken. The main advantage of
code coverage is that it is a "push button" technology. But a code
coverage model cannot detect a missing functionality, while a good functional
coverage model points-out that a particular functionality is not tested
and leads to discovery of the bug. As it is difficult to build a design
dependent good functional coverage model, Code coverage has acquired
first step of measuring the maturity of verification.
Statement coverage is the most widely used form of
coverage. It is also the easiest to understand and use. It gives a quick
overview of which parts of the design have failed to achieve 100% coverage
and where extra verification effort is needed. Statement coverage identifies
statements that were executed when the design was simulated. A zero execution
count against a statement is an indication that the statement was not executed
during simulation, which could very well be a source of possible design
error. It is advisable to aim for 100% statement coverage before using
other coverage techniques.
Coverage analysis using MT-cover
MT-cover uses Cadence's NC simulators for simulation
and can be easily modified to use other simulator. It has a set of 3 VPI
applications written, which 1. Search for mandatory statements and registers
a callback for each of them. 2. Callback routines which keep count how
many times a statement is executed. 3. print the coverage log.
As MT-cover uses +linedebug option of the simulator,
there will be a penalty on the run time. The following diagram shows how
MT-cover works. Please note that block in blue color
is input, those in red color are NC simulators?
standard processes, those in rose color are
intermediate databases and those in green color
are MT-cover only utilities.
Figure 1. Coverage analysis using MT-cover and NC-simulators.
Statements tested for coverage by MT-cover
MT-cover searches and keeps a count of their execution
for all procedural statements (blocking /non-blocking assignments, force/release,
assign/deassign etc). But it doesn?t consider continuous assignments, as
these are executed always.
Running Coverage utility
To run simulation for coverage dump run run_mt_cov
script like ncverilog. You can give any option supported by ncverilog.
After completion of the simulation a directory - gcover will be
created (if it is not existing already) and coverage related data would
be saved in that.
A typical use of MT-cover will be like -
% run_mt_cover -f run_file.f verilog_file.v +define+MY_DEFINE
Each time you run run_mt_cover a coverage log file
(mtcover_out.log) will be created. If you are
running an all-together different design please make sure that u have cleaned
up gcover directory.
Coverage analysis after regression:
It is very much common in any project that different
test cases are coded into different test vectors and each of vectors is
run in sequence. MT-cover supports such way of testing also. run_mt_cover
is to be run for each of the vectors and a set of coverage data files are
to be saved with different names in gcover directory. MT-cover gives a
script mt_cover_merge to merge results of different
simulation runs. A typical use of merging utility is -
% cd ./gcover
After running merging utility mt_cover_MERGE.log
file will be created, which contains consolidated coverage data.
Using GUI for seeing the results of coverage analysis
MT-cover has a TCL/Tk based GUI, which can be used for
analyzing the coverage data. To activate it run log_browse.tcl.
Go to File menu and open the data file you want to analyze. GUI
will show all the files that were there in design as well as total lines
uncovered in the design. You can select any of the files to see the uncovered
lines. In the file, uncovered lines would have been marked red.
Downloading and installing MT-Cover
You can download MT-cover utility as a gzipped tar file by
clicking here .
MT-Cover database has the following components.
Copy all these files into an installation directory.
Edit all these files to set appropriate path for tcl/tk and csh. Put the
installation directory into your $path. Enjoy using the coverage tool.
c_code directory containing the c code for vpi utilities
and a c-shell script for compilation.
tcl directory containing run_mt_cover , mt_cover_merge
and other GUI related scripts.
alu directory which contains an example.