User guide
21-69
OpenVera Native Testbench
value, call the object’s GetCount() function. In Example 21-6, the
code keeps track of how many times the assertion check1 fails and
generates an error, and ends the simulation, if there are too many
failures.
Example 21-6
assert_check1.EnableCount(ASSERT_FAILURE);
...
if (assert_check1.GetCount(ASSERT_FAILURE) > max_fail)
error("Check1 exceeded failure limit.");
EnableCount() starts a running count that cannot be disabled or
reset. To create a count that can be disabled or reset, set up an
AssertEvent object (as explained in the following section) and create
your own code to count the event triggers.
Setting Up the AssertEvent Objects
For every event being monitored, the testbench needs an
AssertEvent object. For a summary of the class and its methods, see
the description of the Assertion class in the OpenVera LRM: Native
Testbench book.
Instantiating AssertEvent Objects
Instantiate an AssertEvent object with its new() task, including an
event type. Then attach the object to an AssertEngine or Assertion
object with that object’s EnableTrigger() task. The event is not
monitored until the EnableTrigger() task. For example, to monitor
successful attempts on the check1 assertion, use the following:
AssertEvent check1_success = new(ASSERT_SUCCESS);
assert_check1.EnableTrigger(check1_success);