‘define SV_COV_RESET 2
‘define SV_COV_QUERY
SV_COV_CHECK 3
This function
enables, disables, resets or queries the availability of coverage information
for the specified portion of the hierarchy.
This function is used to control or query coverage availability in
the specified portion of the hierarchy. The following control options are
available:
`SV_COV_START
If possible, starts collecting coverage information in the specified hierarchy.
No effect if coverage is already being collected. Note that coverage is automatically started at
the beginning of simulation for all
portions of the hierarchy enabled for coverage.
`SV_COV_STOP
Stops collecting coverage information in the specified hierarchy. No effect if
coverage is not being collected.
`SV_COV_RESET
Resets all available coverage information in the
specified hierarchy. No effect if coverage not available.
`SV_COV_CHECK
Checks if coverage information can be obtained from the specified hierarchy.
Note the possibility of having coverage information does imply that coverage is
being collected, as the coverage could have been stopped.
The return value is a ‘defined name, with the value indicating the success of the
action.
‘SV_COV_OK
the request is successful. When querying, if
starting, stopping, or resetting this means the desired effect ccurred, coverage is available. A successful reset clears
all coverage (i.e., using a ...get() == 0 after a successful …reset()). On a check operation denotes that coverage is fully
available in the specified hierarchy. For all other operations, represents
successful and complete execution of the desired operation.
‘SV_COV_ERROR
the
call failed with no action, typically due to errors in the arguments, such as a
non-existing module or instance specifications. On all operations means that
the control operation failed without any effect, typically due to errors in
arguments, such as a non-existing module.
‘SV_COV_NOCOV
coverage is not available for the requested portion of the hierarchy. On a check or start
operation, denotes that coverage is not available at any point in the specified
hierarchy.
‘SV_COV_PARTIAL
coverage is only partially available in the requested portion of the
hierarchy (i.e., some instances have the requested coverage information, some
don’t). On a
check or start operation, denotes that coverage is only partially available in
the specified hierarchy.
The table below describes the possible return values for each of
the coverage control options:
Table 29-1 Coverage control return values
|
‘SV_COV_OK |
‘SV_COV_ERROR |
‘SV_COV_NOCOV |
‘SV_COV_PARTIAL |
‘SV_COV_START |
success |
bad args |
no coverage |
partial coverage |
‘SV_COV_STOP |
success |
bad args |
- |
- |
‘SV_COV_RESET |
success |
bad args |
- |
- |
‘SV_COV_CHECK |
full coverage |
bad args |
no coverage |
partial coverage |
This function saves the current
state of coverage to the tool’s coverage database and associates it with the file named name given name. This file name shall not
contain any directory specification or extensions. This name will be mapped in an implementation-specific way
into some file or set of files in the coverage database. Data saved to
the database shall be retrieved later by using $coverage_merge
and supplying the same name. Saving
coverage shall not have any effect on the state of coverage in this simulation.
A part-select of a vector
signal can be used to hold the current state of the FSM. When cmView a coverage tool displays or reports FSM coverage data, it names the
FSM after the signal that holds the current state. If a part-select holds the
current state in the user’s FSM, the user needs to also specify a name for the
FSM that cmView can
for the coverage tool to use. The FSM name is
not the same as the enumeration name.
Returns the number of
covered items of the given coverage type in the given instance. Coverage type
is one of the coverage type properties described in Section 29.4.2. For
example, given coverage type vpiStatementCoverage, this call would return the number of covered
statements in the instance pointed by instance_handle.
vpi_get(vpiCovered, assertion_handle)
vpi_get(vpiCovered, statement_handle)
vpi_get(vpiCovered, signal_handle)
vpi_get(vpiCovered, fsm_handle)
vpi_get(vpiCovered, fsm_state_handle)
Returns
whether the item referenced by the handle has been covered. For handles that can contain multiple coverable
entities, such as statement, fsm and signal handles,
the return value indicates how many of the entities have been covered.
— For assertion handle, the
coverable entities are assertions
— For statement handle, the
entities are statements
— For signal handle, the
entities are individual signal bits
— For fsm
handle, the entities are fsm
For assertions, vpiCovered implies that the assertion has been
attempted, has succeeded at least once and has never failed. More detailed
coverage information can be obtained for assertions by the following queries:
vpi_get(vpiAssertAttemptCovered, assertion_handle)
Returns the number of times the assertion has been attempted.
vpi_get(vpiAssertSuccessCovered, assertion_handle)
Returns the number of times the assertion has succeeded
non-vacuously or, if assertion handle corresponds to a cover sequence, the
number of times the sequence has been matched. Refer to section 17.7.11 and
17.12 for the definition of vacuity.
vpi_get(vpiAssertVacuousSuccessCovered, assertion_handle)
Returns the number of times the assertion has succeeded vacuously. Refer to
section 17.7.11 and 17.12 for the definition of vacuity.
vpi_get(vpiAssertFailureCovered, assertion_handle)
Returns the number of times the assertion has failed. For any assertion, the
number of attempts that have not yet reached any conclusion (success or
failure) can be derived from the formula:
in progress = attempts -
(successes + vacuous success + failures)
The example below illustrates some of these queries:
module covtest;
bit on = 1, off = 0;
reg clk;
initial begin
clk = 0;
forever begin
#10;
clk = ~clk;
end
end
always @(false) begin
anvr: assert(on ##1 on); //
assertion will not be attempted
end
always @(posedge
clk) begin
aundf: assert (on ##[1:$]
off); // assertion will not pass or fail
afail: assert (on ##1 off); // assertion will always fail on 2nd tick
apass: assert (on ##1 on); // assertion will succeed on each
attempt
end
endmodule
For this example, the assertions will have the following coverage
results:
Table 29-3 Assertion coverage results
|
vpiCovered |
vpiAssertAttemptCovered |
vpiAssertSuccessCovered |
vpiAssertFailureCovered |
anevr |
false |
false |
false |
false |
aundf |
false |
true |
false |
false |
afail |
false |
true |
false |
|
apass |
true |
true |
true |
false |