This section ... describes the mechanisms in SystemVerilog through which
SystemVerilog code can query and control coverage information. Coverage
information is provided to SystemVerilog by means of a number of built-in
system functions (described in section 28.2.2) using a number of predefined
constants (described in section 28.2.1) to describe the types of coverage and
the control actions to be performed.
Editor’s Note: Something appears to be
missing in this section.
This section ...
Editor’s Note: Something appears to be
missing in this section.
Editor’s Note: Throughout this coverage API section, Verilog-2001
attributes should be used, instead of using obsolete pragmas
that are hidden in comments!
Editor’s Note: Can SystemVerilog enumerated types be used instead of
parameter constants? What about ‘define macros
This section ...
Editor’s Note: Something appears to be
missing in this section.
This section ...
Editor’s Note: Something appears to be
missing in this section.
All **what?? use vpi_get() along with
the appropriate properties and object handles.
coverage type, instance
the
number of covered items in the given instance.
vpiCovered, handle
the
number of items of the handle type is covered. This is only applicable to:
statement handles, signal
(wire/reg)
handles, assertion handles, and FSM handles.
vpiCoveredCount, handle
the
number of times each item of the handle type is covered. This is only easily
interpretable when handle
points
to a unique coverable item (otherwise this is the sum of counts of all
contained items).
vpiCoveredMax, handle
the
total possible coverable items in the given handle. Handle types limited as per
above. vpiCovered-
Max is only really useful when handle is
a handle to an object potentially containing more than one coverable
item.
— Use vpi_iterate(vpiFsm, instance-handle) to get the iterator to all FSMs in an instance.
— Use vpi_handle(vpiFsmStateExpression, fsm-handle) to get the handle to the signal or expression
encoding the FSM state.
— Use vpi_iterate(vpiFsmStates, fsm-handle) to get the iterator to all states of an FSM.
— Use vpi_get_value(fsm_state_handle, state-handle) to get the value of a state.
To obtain
coverage information, the vpi_get() function is extended with additional vpi properties that can be obtained from existing handles:
vpi_get(<coverageType>, instance_handle)
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 28.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 may 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
states
vpi_get(vpiCoveredCount, assertion_handle)
vpi_get(vpiCoveredCount, statement_handle)
vpi_get(vpiCoveredCount, signal_handle)
vpi_get(vpiCoveredCount, fsm_handle)
vpi_get(vpiCoveredCount, fsm_state_handle)
Returns the
number of times each coverable entity referred by the handle has been covered.
Note that this is only easily interpretable when the handle points to a unique
coverable item (such as an individual statement); when handle points to an item
containing multiple coverable entities (such as a handle to a block statement
containing a number of statements), the result is the sum of coverage counts
for each of the constituent entities.
vpi_get(vpiCoveredMax, assertion_handle)
vpi_get(vpiCoveredMax, statement_handle)
vpi_get(vpiCoveredMax, signal_handle)
vpi_get(vpiCoveredMax, fsm_handle)
vpi_get(vpiCoveredMax, fsm_state_handle)
Returns the number of coverable entities pointed by the handle. Note that this will
always return 1 (one) when applied to an assertion or fsm
state handle.
vpi_iterate(vpiFsm, instance-handle)
Returns an iterator to all FSMs in an
instance.
vpi_handle(vpiFsmStateExpression, fsm-handle)
Returns the handle to the signal or expression encoding the FSM
state.
vpi_iterate(vpiFsmStates, fsm-handle)
Returns an iterator to all states of an FSM.
vpi_get_value(fsm_state_handle,
state-handle)
Returns the value of an FSM state.
Editor’s Note: The preceding sentence needs to be fixed.
**Revise
similar to Assertions**
vpi_control()
has
three arguments: coverage control (start, stop, reset, query), coverage type, and the handle to
the appropriate instance or assertion. Statement, toggle, and FSM coverage are
not individually controllable (i.e., they are controllable only at the instance
level, not on a per statement/signal/FSM). The
semantics and behavior are specified as per the equivalent system function $coverage_control (see Section 28.2.2.1).
vpi_control()
has
three arguments: coverage control (merge, save), coverage type, and name.
This merges coverage into the current simulation. The semantics and behavior
are specified as per the equivalent system functions $coverage_merge (see Section 28.2.2.4) and $coverage_save (see Section 28.2.2.5).
vpi_control(<coverageControl>,
<coverageType>, instance_handle)
vpi_control(<coverageControl>,
<coverageType>, assertion_handle)
Controls the collection of coverage on the given instance or
assertion. Note that
statement, toggle and FSM coverage are not individually controllable (ie they are controllable only at the instance level and not
on a per statement/signal/FSM basis). The semantics and behavior are as per the
$coverage_control system function (see section 28.2.2.1).
coverageControl
is one vpiCoverageStart, vpiCoverageStop, vpiCoverageReset or vpiCoverageCheck, as defined in section 28.4.2 coverageType is
any one of the vpi coverage type properties (section
28.4.2)
vpi_control(<coverageControl>,
<coverageType>, name)
This saves or
merges coverage into the current simulation. The semantics and behavior are
specified as per the equivalent system functions $coverage_merge
(see Section 28.2.2.4) and $coverage_save (see
Section 28.2.2.5). coverageControl is one of vpiCoverageMerge or vpiCoverageSave, defined in section 28.4.2
Editor’s Note: What is this comment referring to?