Hi James,
You can access the message counts in the report server
through the report handler. Each component is derived from
avm_report_client which contains a reference to the report server, m_srvr.
The report server has a function called get_serverity_count which takes a
severity as an argument and returns the current count of messages that have been
issued with that severity. For example, to get the number of errors use the
following call:
int errors;
...
errors =
m_srvr.get_severity_count(ERROR);
Another thing you can do is to use the quit_count
feature. When you set quit count to a value greater than zero and you set
the action for any severity to include COUNT, then when the count for the
particular severity reaches the threshold the testbench will terminate.
For example, to make the testbench stop when after five errors do the following
(in an avm_named_component):
set_report_max_quit_count(5);
set_report_severity_action(ERROR, DISPLAY |
COUNT);
Then when five errors are reached the testbench will
terminate. By the way, (DISPLAY | COUNT) is the default action for ERROR,
so you don't need to set is explicitly. I just show for illustration
purposes.
A variation of this is to also use the CALL_HOOK
action. This will cause a user function to be called. You could use
this function to indicate pass/fail. E.g.
set_report_max_quit_count(5);
set_report_serverity_action(ERROR, DISPLAY | COUNT |
CALL_HOOK);
In the same component define the function
report_error_hook:
function bit report_error_hook( string
id, string message, int
verbosity,
string filename, int line);
if(!m_srvr.is_quit_count_reached())
return;
// do whatever processing is
necessary when a failure occurs
$display("TEST
FAILED");
endfunction
Note: each component has its own report hooks, so the hook
will only be called in the component where the message was
issued.
Finally, one last way to terminate the testbench is to call
avm_report_fatal when you encounter an error condition. That will shut it
down immediately.
I hope this helps you.
-- Mark