User Guide: DSim Coverage Options
Controlling Functional Coverage
Functional coverage applies to SystemVerilog only.
Name | Description |
---|---|
-no-fcov |
Disable functional coverage collection. |
-write-sql |
Write coverage results to sqlite3 database. This option is no longer necessary in DSim since the default output is the sqlite3 database. |
-limit-enum-bins |
Limit number of automatic bins created for enumerated types. |
-wildcard-limit n |
Set limit on number of ranges created when expanding wildcard coverage bins (default: 1000) |
-fcov-save-empty-bins |
Records the empty bins that are artifacts of an ignore directive in the coverage database. |
The -no-fcov
option disables functional coverage collection at run time. When given, no functional coverage is written to the output sqlite3
database (normally "metrics.db") when simulation ends. Also, covergroups sensitive to an event will not be activated during the run, which should save some run time. However, the covergroups and coverpoints are partially created, so that user code can naively call coverage methods without immediately failing on a null reference. Care should be taken not to rely on coverage computation or side-effects from covering expressions (e.g. function calls) which may alter a run without coverage.
Functional coverage is collected by default. We believe that all of the supported SV-LRM-defined language features ought to be enabled and working without requiring special command line switches.
The coverage option auto_bin_max
is specified in the SV-LRM to limit the number of automatic bins created for a coverpoint,
but is specifically not applicable to bins of enumeration type. The option -limit-enum-bins
has been added to override
the SV-LRM compliant behavior, and to subject bins of enumerated type to the same limit.
By default, wildcard bins are processed by a dedicated 4-state wildcard engine that uses bit masking to determine if a sample input matches a wildcard. However, under certain circumstances, a wildcard bin must be expanded into an equivalent set of range bins. e.g. { 4'b11xx }
can be expanded into { [12:15] }
. This expansion may occur under the following conditions:
- The coverpoint requires multiple bins, so different matches may go into different bins.
- There is a multiple-bin
default
, which requires determination of which values do not hit any other bin.
However, some wildcard definitions are not practical to expand. e.g. { 32'bxxxxxxxxxxxxxxxxxxxxxxxxxxxxx0 }
. This expands into all two-billion even numbers, and will likely not complete at run time due to memory exhaust. The -wildcard-limit
option is used to set a limit on wildcard bin expansion. If the limit is encountered, a warning will be printed and the expansion will be incomplete.
Controlling Code Coverage
DSim supports three types of code coverage:
- Line/block coverage: indicates which statements in the code base have been executed.
- Toggle coverage: indicates which integer-valued nets/variables have changed state.
- Focused expression coverage: indicates which conditions that lead to a boolean-valued expression have been encountered. The focused expression model is used.
Line/block and expression coverage requires that the code base be instrumented at compile time. Toggle coverage requires the option at runtime.
All forms of code coverage apply to SystemVerilog. Block coverage is also supported for VHDL.
Option | Description |
---|---|
-code-cov type[:type...] |
Instrument or enable for code coverage type = b(lock), e(xpression), t(oggle) or a(ll) |
-expr-cov-row-limit n |
Set row limit for focused expression coverage |
-code-cov-scope-specs |
Limit code coverage of enabled types to a specific scope using a specification file. |
Line/block Coverage
Line/block coverage requires instrumentation at compile time. Performance is reduced when line coverage is enabled.
Toggle Coverage
Toggle coverage requires that VPI callback permission (+acc+b
) be set on any net or variable whose toggles are to be captured. Toggle coverage itself is a run-time option, much like waveform dump.
The toggle coverage model counts transitions from 0
to 1
and 1
to 0
. Transitions to/from z
or x
are not counted.
Expression Coverage
Expression coverage requires instrumentation at compile time. Performance is reduced when expression coverage is enabled.
DSim uses a focused expression coverage model. For each boolean expression being covered, the minimal set of input conditions required to exercise all paths through the expression is computed. It may not be possible to cover all paths through an expression if one input is used more than once in an expression, and used in conflicting ways that impede either control or observability.
The result of analyzing each expression for focused expression coverage is a truth table. Every time an input changes, the runtime must search all rows in the truth table and increment the counter corresponding to the matching row. Large truth tables both take up a lot of memory and consume a lot of run time doing the search. The -expr-cov-row-limit
option can be used to limit which expressions are covered; expressions requiring larger truth tables will not be covered. Typically these expressions are used in datapaths, and not control logic.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article