report Mechanism can realize accurate control of information printing . Let's explain it in points , And all in uvm_component Information macros used in components .(uvm_object The same principle is used in )
Below with `uvm_error(“ID”,”message”) To illustrate :
`define uvm_warning(ID,MSG) \ begin \ if
(uvm_report_enabled(UVM_NONE,UVM_WARNING,ID)) \ uvm_report_warning (ID, MSG,
UVM_NONE, `uvm_file, `uvm_line); \ end
First, introduce UVM Several very important concepts in (1)verbosity,(2) existence severity(3)action.
verbosity You can understand that : Reflect the filtering degree of information to be printed , There are mainly the following types
typedef enum { UVM_NONE = 0, UVM_LOW = 100, UVM_MEDIUM = 200, UVM_HIGH = 300,
UVM_FULL = 400, UVM_DEBUG = 500 } uvm_verbosity;
verbosity The higher the value , The easier it is to filter out
And verboisty This corresponds to the security level of the information (severity), There are mainly the following
typedef enum bit [1:0] { UVM_INFO, UVM_WARNING, UVM_ERROR, UVM_FATAL }
severity It reflects the security level of information , Different security levels have different behaviors , The classification of behavior mainly includes the following types
The behavior category is mainly about what the simulator should do . typedef enum { UVM_NO_ACTION ='b0000000, UVM_DISPLAY =
'b0000001, UVM_LOG = 'b0000010, UVM_COUNT = 'b0000100, UVM_EXIT = 'b0001000,
UVM_CALL_HOOK ='b0010000, UVM_STOP = 'b0100000, UVM_RM_RECORD ='b1000000 }
Let's officially start , First explain uvm_report_enable. This method is mainly to judge this message Can printing be performed .
//uvm_report_object.svh function int uvm_report_enabled(int verbosity,
uvm_severity severity = UVM_INFO, string id = ""); if
(get_report_verbosity_level(severity, id) < verbosity) return 0; return 1;
endfunction function int get_report_verbosity_level(uvm_severity
severity=UVM_INFO, string id=""); return m_rh.get_verbosity_level(severity,
id); endfunction // among m_rh yes uvm_report_handle A handle to the . uvm_report_handler m_rh;
function new(string name = "");; m_rh =
uvm_report_handler::type_id::create(name); endfunction
// Find each uvm_component It will be created with its own m_rh. function int
get_verbosity_level(uvm_severity severity=UVM_INFO, string id="" );
uvm_id_verbosities_array array; if(severity_id_verbosities.exists(severity))
begin array = severity_id_verbosities[severity]; if(array.exists(id)) begin
return array.get(id); end end if(id_verbosities.exists(id)) begin return
id_verbosities.get(id); end return m_max_verbosity_level; endfunction
So what ultimately works is uvm_report_handle Yes get_verbosity_level function . There are several important variables ( Associative array )
typedef uvm_pool#(string, int) uvm_id_verbosities_array;// The core is the associative array int
pool[string] uvm_id_verbosities_array id_verbosities;// // The core is the associative array int
pool[string], Store each ID Yes verbosity uvm_id_verbosities_array
severity_id_verbosities[uvm_severity];// The core is the associative array int
pool[string], Store each severity Different for inclusion ID Yes verbosity int m_max_verbosity_level;
// default verbosity

All of the above string express “”ID“”. The stored value is int Type verbosity value (m_max_verbosity_level The default is UVM_MEDIEM, This is because each component instantiates with a uvm_report_handle Handle to ,uvm_report_handle When instantiating m_max_verbosity_level The default is UVM_MEDIEM, method set_verbosity_level You can change the value of this variable , It can be changed at the same time on the command line +UVM_VERBOSITY=xxxx)

So for uvm_error. Incoming verbosity yes UVM_NONE, And this ID The default storage is UVM_MEDIUM,UVM_MEDIUM>UVM_NONE Yes . So call uvm_report_object Medium uvm_report_enable Function return 1.

variable id_verbosities have access to set_id_verbosity Method to add an element variable severity_id_verbosities[uvm_severity] have access to set_
severity_id_verbosity Method to add an element variable .
So normally get_verbosity_level Returned is m_max_verbosity_level, because severity_id_verbosities[uvm_severity] and id_verbosities It's empty .
severity_id_verbosities[uvm_severity]>id_verbosities>m_max_verbosity_level( priority )
Below will 4 All related macros are listed
`define uvm_info(ID,MSG,VERBOSITY) \ begin \ if
(uvm_report_enabled(VERBOSITY,UVM_INFO,ID)) \ uvm_report_info (ID, MSG,
VERBOSITY, `uvm_file, `uvm_line); \ end `define uvm_warning(ID,MSG) \ begin \
if (uvm_report_enabled(UVM_NONE,UVM_WARNING,ID)) \ uvm_report_warning (ID, MSG,
UVM_NONE, `uvm_file, `uvm_line); \ end `define uvm_error(ID,MSG) \ begin \ if
(uvm_report_enabled(UVM_NONE,UVM_ERROR,ID)) \ uvm_report_error (ID, MSG,
UVM_NONE, `uvm_file, `uvm_line); \ end `define uvm_fatal(ID,MSG) \ begin \ if
(uvm_report_enabled(UVM_NONE,UVM_FATAL,ID)) \ uvm_report_fatal (ID, MSG,
UVM_NONE, `uvm_file, `uvm_line); \ end

summary : In call `uvm_error(“ID”,“message”) Time , Will be called to uvm_report_handle Medium get_report_level obtain message Set verbosity, Only to this verbosity>= Incoming verbosity Time , This article message actually is enable Printed . about uvm_error/warning/fatal. Incoming verbosity yes UVM_NONE. So for this 3 individual message, All enable Yes . about uvm_info, It needs to be judged .