Use vpi_register_assertion_cb() to place an assertion callback; the
prototype is:
/* typedef for vpi_register_assertion_cb
callback function */
typedef PLI_INT32 (vpi_assertion_callback_func)(
PLI_INT32
reason, /* callback reason */
p_vpi_time cb_time,
/* callback time */
vpiHandle assertion, /*
handle to assertion */
p_vpi_attempt_info info, /* attempt related information
*/
PLI_BYTE8 *user_data /* user data
entered upon registration */
);
vpiHandle vpi_register_assertion_cb(
vpiHandle assertion, /* handle to
assertion */
PLI_INT32 reason, /* reason for which callbacks needed
*/
PLI_INT32 (*cb_rtn)( /* callback
function */
PLI_INT32 reason, /* callback reason */
p_vpi_time cb_time, /*
callback time */
vpiHandle assertion,
p_vpi_attempt_info info,
PLI_BYTE8 *userData ),
vpi_assertion_callback_func *cb_rtn,
PLI_BYTE8 *user_data /* user data to be supplied to cb */
);
The attempt information structure t_vpi_attempt_info attempt information structure contains details relevant to the specific
event that occurred.
On disable,
enable, reset and kill callbacks, the info field is
NULL returned p_vpi_attempt_info info pointer is NULL and no attempt information is available.
On start and success
callbacks, only the attemptStartTime field is valid.
On a failure callbacks cbAssertionFailure callback, the attemptStartTime and detail.failExpr fields are
valid.
On a step callback, the attemptStartTime and
detail.step elements fields are valid.
NOTES
1In
a failing transition, there shall always be at least one element in the
expression array.
2Placing a step callback results
in the same callback function being invoked for both success and failure steps.
3 -- The
content of the cb_time field depends on the reason identified by the reason field, as follows:
cbAssertionStart - cb_time is the time when the assertion attempt
has been started.
cbAssertionSuccess, cbAssertionFailure - cb_time is the time when the
assertion succeeded/failed.
cbAssertionStepSuccess, cbAssertionStepFailure - cb_time is the time when the assertion
attempt step succeeded/failed.
cbAssertionDisable, cbAssertionEnable, cbAssertionReset, cbAssertionKill - cb_time is the time when the assertion attempt was disabled/enabled/reset/killed.
4 -- In contrast
to cb_time, the
content of attemptStartTime is always the start time of the actual attempt of an
assertion. It can be used as an unique ID that
distinguishes the attempts of any given assertion.