Coverage Lens (CL) is a C++ utility that checks if a specified set of RTL code coverage items (e.g. statement, condition etc.) is covered by querying an UCIS compliant coverage database. The main functionality is described in the How To Automate Code Coverage analysis with Coverage Lens article.
CoverageLens 2.0 release includes support for functional coverage, which means you can now:
- check if a specific bin has been covered
- check if an assertion has failed
- get the number of covergroups/coverpoints in the environment
- get the number of bins in a covergroup
- get the name of a covergroup/coverpoint/bin
- get the number of hits for a bin
This article describes various ways to run CL and make use of the new features.
Installing Coverage Lens
You should first clone CL’s GitHub repository and then compile CL and UCIS API. The implementation of UCIS API is vendor dependent, so you have to specify the simulator’s vendor (i.e. cadence or mentor) and simulator’s installation path.
git clone https://github.com/amiq-consulting/CoverageLens.git cd CoverageLens chmod +x compile.sh ./compile.sh cadence [path/to/simulator/install/directory] OR ./compile.sh mentor [path/to/simulator/install/directory]
If the compile process succeeded you are good to go!
Run Using Coverage Option (i.e. -g)
The CL associates an unique index with every covergroup, coverpoint and bin. The functional coverage element indexes cvg_idx, cvp_idx, bin_idx must be inside ranges [1..nof_cvgs], [1..nof_cvps], [1..nof_bins].
The -g option allows you to extract and print generic information about the functional coverage elements and status information for elements identified by indexes.
- -g nof_cvgs prints the total number of covergroups from the verification environment:
./coverage_lens.sh -d /path/to/ucis/database -g nof_cvgs
- -g cvg_name prints the full path (i.e. package/class name) to the covergroup cvg_idx:
./coverage_lens.sh -d /path/to/ucis/database -g cvg_name <cvg_idx>
- -g nof_cvps option prints out the total number of coverpoints from the verification environment:
./coverage_lens.sh -d /path/to/ucis/database -g nof_cvps
- -g cvp_name prints the path (i.e. package.class name.covergroup) of the coverpoint cvp_idx:
./coverage_lens.sh -d /path/to/ucis/database -g cvp_name <cvp_idx>
- -g nof_bins prints out the number of bins which contributed to the coverpoint cvp_idx:
./coverage_lens.sh -d /path/to/ucis/database -g nof_bins <cvp_idx>
- -g bin_name prints out the full path of the bin (i.e. package.class name.covergroup) bin_idx of the coverpoint cvp_idx:
./coverage_lens.sh -d /path/to/ucis/database -g bin_name <cvp_idx> <bin_idx>
- -g nof_hits prints the number of hits for the bin bin_idx of the coverpoint cvp_idx:
./coverage_lens.sh -d /path/to/ucis/database -g nof_hits <cvp_idx> <bin_idx>
- -g cvp_res shows the percentage of the bins that have been hit for the coverpoint cvp_idx:
./coverage_lens.sh -d /path/to/ucis/database -g cvp_res <cvp_idx>
Run Using a Check File
You can specify the the names of the bins or the assertions that you want to check in a check file (e.g. -c check_file.example):
cl_check -k inst -p /path/to/ucis/database -t cov <covergroup | coverpoint | bin_name> [idx] cl_check -k inst -p <path_to_ve_class> -t assert <assert_name>
The idx parameter represents the index of an element from a vector, in case the bin is declared in the project as a vector of values.
Run Using List Option (i.e. -l)
The “-l” option lists all the code coverage instances. In addition to that, the new release can provide the list of the functional coverage elements, if the option cov or assert is mentioned.
./coverage_lens.sh -d /path/to/ucis/database -l cov ./coverage_lens.sh -d /path/to/ucis/database -l assert
There are few areas that could be improved in the future:
- Provide support for VCS
- Provide support for Cadence’s vRefine format
- Improve support for cross coverage type in Questa
I encourage you to use it and share your feedback with the community.