# uvm_report_catcher

The uvm_report_catcher is used to catch messages issued by the uvm report server. Catchers are uvm_callbacks#(uvm_report_object,uvm_report_catcher) objects, so all facilities in the uvm_callback and uvm_callbacks#(T,CB) classes are available for registering catchers and controlling catcher state. The uvm_callbacks#(uvm_report_object,uvm_report_catcher) class is aliased to uvm_report_cb to make it easier to use. Multiple report catchers can be registered with a report object. The catchers can be registered as default catchers which catch all reports on all uvm_report_object reporters, or catchers can be attached to specific report objects (i.e. components).

User extensions of uvm_report_catcher must implement the catch method in which the action to be taken on catching the report is specified. The catch method can return CAUGHT, in which case further processing of the report is immediately stopped, or return THROW in which case the (possibly modified) report is passed on to other registered catchers. The catchers are processed in the order in which they are registered.

On catching a report, the catch method can modify the severity, id, action, verbosity or the report string itself before the report is finally issued by the report server. The report can be immediately issued from within the catcher class by calling the issue method.

The catcher maintains a count of all reports with FATAL,ERROR or WARNING severity and a count of all reports with FATAL, ERROR or WARNING severity whose severity was lowered. These statistics are reported in the summary of the uvm_report_server.

This example shows the basic concept of creating a report catching callback and attaching it to all messages that get emitted:

>     class my_error_demoter extends uvm_report_catcher;
>       function new(string name="my_error_demoter");
>         super.new(name);
>       endfunction
>       //This example demotes "MY_ID" errors to an info message
>       function action_e catch();
>         if(get_severity() == UVM_ERROR && get_id() == "MY_ID")
>           set_severity(UVM_INFO);
>         return THROW;
>       endfunction
>     endclass

>     my_error_demoter demoter = new;
>     initial begin
>      // Catchers are callbacks on report objects (components are report
>      // objects, so catchers can be attached to components).

>      // To affect all reporters, use ~null~ for the object
>      uvm_report_cb::add(null, demoter);

>      // To affect some specific object use the specific reporter
>      uvm_report_cb::add(mytest.myenv.myagent.mydriver, demoter);

>      // To affect some set of components (any "*driver" under mytest.myenv)
>      // using the component name
>      uvm_report_cb::add_by_name("*driver", demoter, mytest.myenv);
>     end

Summary

uvm_report_catcher
The uvm_report_catcher is used to catch messages issued by the uvm report server.
Class Hierarchy
uvm_void
uvm_object
uvm_callback
uvm_report_catcher
Class Declaration
> virtual class uvm_report_catcher extends uvm_callback
new | Create a new report catcher.
Current Message State |
get_client | Returns the uvm_report_object that has generated the message that is currently being processed.
get_severity | Returns the uvm_severity of the message that is currently being processed.
get_context | Returns the context name of the message that is currently being processed.
get_verbosity | Returns the verbosity of the message that is currently being processed.
get_id | Returns the string id of the message that is currently being processed.
get_message | Returns the string message of the message that is currently being processed.
get_action | Returns the uvm_action of the message that is currently being processed.
get_fname | Returns the file name of the message.
get_line | Returns the line number of the message.
get_element_container | Returns the element container of the message.
Change Message State |
set_severity | Change the severity of the message to severity.
set_verbosity | Change the verbosity of the message to verbosity.
set_id | Change the id of the message to id.
set_message | Change the text of the message to message.
set_action | Change the action of the message to action.
set_context | Change the context of the message to context_str.
add_int | Add an integral type of the name name and value value to the message.
add_string | Adds a string of the name name and value value to the message.
add_object | Adds a uvm_object of the name name and reference obj to the message.
Debug |
get_report_catcher | Returns the first report catcher that has name.
print_catcher | Prints information about all of the report catchers that are registered.
Callback Interface |
catch | This is the method that is called for each registered report catcher.
Reporting |
uvm_report_fatal | Issues a fatal message using the current message’s report object.
uvm_report_error | Issues an error message using the current message’s report object.
uvm_report_warning | Issues a warning message using the current message’s report object.
uvm_report_info | Issues a info message using the current message’s report object.
uvm_report | Issues a message using the current message’s report object.
issue | Immediately issues the message which is currently being processed.
summarize | This function is called automatically by uvm_report_server::report_summarize().

### new

> function new(
> | string | name | = | "uvm_report_catcher"
> )

Create a new report catcher. The name argument is optional, but should generally be provided to aid in debugging.

### Current Message State

### get_client

> function uvm_report_object get_client()

Returns the uvm_report_object that has generated the message that is currently being processed.

### get_severity

> function uvm_severity get_severity()

Returns the uvm_severity of the message that is currently being processed. If the severity was modified by a previously executed catcher object (which re-threw the message), then the returned severity is the modified value.

### get_context

> function string get_context()

Returns the context name of the message that is currently being processed. This is typically the full hierarchical name of the component that issued the message. However, if user-defined context is set from a uvm_report_message, the user-defined context will be returned.

### get_verbosity

> function int get_verbosity()

Returns the verbosity of the message that is currently being processed. If the verbosity was modified by a previously executed catcher (which re-threw the message), then the returned verbosity is the modified value.

### get_id

> function string get_id()

Returns the string id of the message that is currently being processed. If the id was modified by a previously executed catcher (which re-threw the message), then the returned id is the modified value.

### get_message

> function string get_message()

Returns the string message of the message that is currently being processed. If the message was modified by a previously executed catcher (which re-threw the message), then the returned message is the modified value.

### get_action

> function uvm_action get_action()

Returns the uvm_action of the message that is currently being processed. If the action was modified by a previously executed catcher (which re-threw the message), then the returned action is the modified value.

### get_fname

> function string get_fname()

Returns the file name of the message.

### get_line

> function int get_line()

Returns the line number of the message.

### get_element_container

> function uvm_report_message_element_container get_element_container()

Returns the element container of the message.

### Change Message State

### set_severity

> protected function void set_severity(
> | uvm_severity | severity
> )

Change the severity of the message to severity. Any other report catchers will see the modified value.

### set_verbosity

> protected function void set_verbosity(
> | int | verbosity
> )

Change the verbosity of the message to verbosity. Any other report catchers will see the modified value.

### set_id

> protected function void set_id(
> | string | id
> )

Change the id of the message to id. Any other report catchers will see the modified value.

### set_message

> protected function void set_message(
> | string | message
> )

Change the text of the message to message. Any other report catchers will see the modified value.

### set_action

> protected function void set_action(
> | uvm_action | action
> )

Change the action of the message to action. Any other report catchers will see the modified value.

### set_context

> protected function void set_context(
> | string | context_str
> )

Change the context of the message to context_str. Any other report catchers will see the modified value.

### add_int

> protected function void add_int(
> | string | name, |  |
> | uvm_bitstream_t | value, |  |
> | int | size, |  |
> | uvm_radix_enum | radix, |  |
> | uvm_action | action | = | (UVM_LOG|UVM_RM_RECORD)
> )

Add an integral type of the name name and value value to the message. The required size field indicates the size of value. The required radix field determines how to display and record the field. Any other report catchers will see the newly added element.

### add_string

> protected function void add_string(
> | string | name, |  |
> | string | value, |  |
> | uvm_action | action | = | (UVM_LOG|UVM_RM_RECORD)
> )

Adds a string of the name name and value value to the message. Any other report catchers will see the newly added element.

### add_object

> protected function void add_object(
> | string | name, |  |
> | uvm_object | obj, |  |
> | uvm_action | action | = | (UVM_LOG|UVM_RM_RECORD)
> )

Adds a uvm_object of the name name and reference obj to the message. Any other report catchers will see the newly added element.

### Debug

### get_report_catcher

> static function uvm_report_catcher get_report_catcher(
> | string | name
> )

Returns the first report catcher that has name.

### print_catcher

> static function void print_catcher(
> | UVM_FILE | file | = | 0
> )

Prints information about all of the report catchers that are registered. For finer grained detail, the uvm_callbacks #(T,CB)::display method can be used by calling uvm_report_cb::display(uvm_report_object).

### Callback Interface

### catch

> pure virtual function action_e catch()

This is the method that is called for each registered report catcher. There are no arguments to this function. The Current Message State interface methods can be used to access information about the current message being processed.

### Reporting

### uvm_report_fatal

> protected function void uvm_report_fatal(
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues a fatal message using the current message’s report object. This message will bypass any message catching callbacks.

### uvm_report_error

> protected function void uvm_report_error(
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues an error message using the current message’s report object. This message will bypass any message catching callbacks.

### uvm_report_warning

> protected function void uvm_report_warning(
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues a warning message using the current message’s report object. This message will bypass any message catching callbacks.

### uvm_report_info

> protected function void uvm_report_info(
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues a info message using the current message’s report object. This message will bypass any message catching callbacks.

### uvm_report

> protected function void uvm_report(
> | uvm_severity | severity, |  |
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues a message using the current message’s report object. This message will bypass any message catching callbacks.

### issue

> protected function void issue()

Immediately issues the message which is currently being processed. This is useful if the message is being CAUGHT but should still be emitted.

Issuing a message will update the report_server stats, possibly multiple times if the message is not CAUGHT.

### summarize

> static function void summarize()

This function is called automatically by uvm_report_server::report_summarize(). It prints the statistics for the active catchers.

> virtual class uvm_void

The uvm_void class is the base class for all UVM classes.

> virtual class uvm_object extends uvm_void

The uvm_object class is the base class for all UVM data and hierarchical classes.

> class uvm_callback extends uvm_object

The uvm_callback class is the base class for user-defined callback classes.

> virtual class uvm_report_catcher extends uvm_callback

The uvm_report_catcher is used to catch messages issued by the uvm report server.

> function new(
> | string | name | = | "uvm_report_catcher"
> )

Create a new report catcher.

> function uvm_report_object get_client()

Returns the uvm_report_object that has generated the message that is currently being processed.

> class uvm_report_object extends uvm_object

The uvm_report_object provides an interface to the UVM reporting facility.

> function uvm_severity get_severity()

Returns the uvm_severity of the message that is currently being processed.
Defines all possible values for report severity.

> function string get_context()

Returns the context name of the message that is currently being processed.

> function int get_verbosity()

Returns the verbosity of the message that is currently being processed.

> function string get_id()

Returns the string id of the message that is currently being processed.

> function string get_message()

Returns the string message of the message that is currently being processed.

> function uvm_action get_action()

Returns the uvm_action of the message that is currently being processed.
Defines all possible values for report actions.

> function string get_fname()

Returns the file name of the message.

> function int get_line()

Returns the line number of the message.

> function uvm_report_message_element_container get_element_container()

Returns the element container of the message.

> protected function void set_severity(
> | uvm_severity | severity
> )

Change the severity of the message to severity.

> protected function void set_verbosity(
> | int | verbosity
> )

Change the verbosity of the message to verbosity.

> protected function void set_id(
> | string | id
> )

Change the id of the message to id.

> protected function void set_message(
> | string | message
> )

Change the text of the message to message.

> protected function void set_action(
> | uvm_action | action
> )

Change the action of the message to action.

> protected function void set_context(
> | string | context_str
> )

Change the context of the message to context_str.

> protected function void add_int(
> | string | name, |  |
> | uvm_bitstream_t | value, |  |
> | int | size, |  |
> | uvm_radix_enum | radix, |  |
> | uvm_action | action | = | (UVM_LOG|UVM_RM_RECORD)
> )

Add an integral type of the name name and value value to the message.

> protected function void add_string(
> | string | name, |  |
> | string | value, |  |
> | uvm_action | action | = | (UVM_LOG|UVM_RM_RECORD)
> )

Adds a string of the name name and value value to the message.

> protected function void add_object(
> | string | name, |  |
> | uvm_object | obj, |  |
> | uvm_action | action | = | (UVM_LOG|UVM_RM_RECORD)
> )

Adds a uvm_object of the name name and reference obj to the message.

> static function uvm_report_catcher get_report_catcher(
> | string | name
> )

Returns the first report catcher that has name.

> static function void print_catcher(
> | UVM_FILE | file | = | 0
> )

Prints information about all of the report catchers that are registered.

> pure virtual function action_e catch()

This is the method that is called for each registered report catcher.

> protected function void uvm_report_fatal(
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues a fatal message using the current message’s report object.

> protected function void uvm_report_error(
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues an error message using the current message’s report object.

> protected function void uvm_report_warning(
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues a warning message using the current message’s report object.

> protected function void uvm_report_info(
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues a info message using the current message’s report object.

> protected function void uvm_report(
> | uvm_severity | severity, |  |
> | string | id, |  |
> | string | message, |  |
> | int | verbosity, |  |
> | string | fname | = | "",
> | int | line | = | 0,
> | string | context_name | = | "",
> | bit | report_enabled_checked | = | 0
> )

Issues a message using the current message’s report object.

> protected function void issue()

Immediately issues the message which is currently being processed.

> static function void summarize()

This function is called automatically by uvm_report_server::report_summarize().

> pure virtual function void report_summarize(
> | UVM_FILE | file | = | 0
> )

Outputs statistical information on the reports issued by this central report server.

> class uvm_callbacks #(
> | type | T | = | uvm_object,
> | type | CB | = | uvm_callback
> ) extends uvm_typed_callbacks#(T)

The uvm_callbacks class provides a base class for implementing callbacks, which are typically used to modify or augment component behavior without changing the component class.
uvm_report_server is a global server that processes all of the reports generated by a uvm_report_handler.

> static function void display(
> | T | obj | = | null
> )

This function displays callback information for obj.