1 |
16 |
HanySalah |
// $Id: uvm_report_catcher.svh,v 1.1.2.10 2010/04/09 15:03:25 janick Exp $
|
2 |
|
|
//------------------------------------------------------------------------------
|
3 |
|
|
// Copyright 2007-2010 Mentor Graphics Corporation
|
4 |
|
|
// Copyright 2007-2009 Cadence Design Systems, Inc.
|
5 |
|
|
// Copyright 2010 Synopsys, Inc.
|
6 |
|
|
// All Rights Reserved Worldwide
|
7 |
|
|
//
|
8 |
|
|
// Licensed under the Apache License, Version 2.0 (the
|
9 |
|
|
// "License"); you may not use this file except in
|
10 |
|
|
// compliance with the License. You may obtain a copy of
|
11 |
|
|
// the License at
|
12 |
|
|
//
|
13 |
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
14 |
|
|
//
|
15 |
|
|
// Unless required by applicable law or agreed to in
|
16 |
|
|
// writing, software distributed under the License is
|
17 |
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
18 |
|
|
// CONDITIONS OF ANY KIND, either express or implied. See
|
19 |
|
|
// the License for the specific language governing
|
20 |
|
|
// permissions and limitations under the License.
|
21 |
|
|
//------------------------------------------------------------------------------
|
22 |
|
|
|
23 |
|
|
`ifndef UVM_REPORT_CATCHER_SVH
|
24 |
|
|
`define UVM_REPORT_CATCHER_SVH
|
25 |
|
|
|
26 |
|
|
typedef class uvm_report_object;
|
27 |
|
|
typedef class uvm_report_handler;
|
28 |
|
|
typedef class uvm_report_server;
|
29 |
|
|
typedef class uvm_report_catcher;
|
30 |
|
|
|
31 |
|
|
typedef uvm_callbacks #(uvm_report_object, uvm_report_catcher) uvm_report_cb;
|
32 |
|
|
typedef uvm_callback_iter#(uvm_report_object, uvm_report_catcher) uvm_report_cb_iter;
|
33 |
|
|
|
34 |
|
|
class sev_id_struct;
|
35 |
|
|
bit sev_specified ;
|
36 |
|
|
bit id_specified ;
|
37 |
|
|
uvm_severity sev ;
|
38 |
|
|
string id ;
|
39 |
|
|
bit is_on ;
|
40 |
|
|
endclass
|
41 |
|
|
|
42 |
|
|
//------------------------------------------------------------------------------
|
43 |
|
|
//
|
44 |
|
|
// CLASS: uvm_report_catcher
|
45 |
|
|
//
|
46 |
|
|
// The uvm_report_catcher is used to catch messages issued by the uvm report
|
47 |
|
|
// server. Catchers are
|
48 |
|
|
// uvm_callbacks#(,uvm_report_catcher) objects,
|
49 |
|
|
// so all facilities in the and
|
50 |
|
|
// classes are available for registering catchers and controlling catcher
|
51 |
|
|
// state.
|
52 |
|
|
// The uvm_callbacks#(,uvm_report_catcher) class is
|
53 |
|
|
// aliased to ~uvm_report_cb~ to make it easier to use.
|
54 |
|
|
// Multiple report catchers can be
|
55 |
|
|
// registered with a report object. The catchers can be registered as default
|
56 |
|
|
// catchers which catch all reports on all reporters,
|
57 |
|
|
// or catchers can be attached to specific report objects (i.e. components).
|
58 |
|
|
//
|
59 |
|
|
// User extensions of must implement the method in
|
60 |
|
|
// which the action to be taken on catching the report is specified. The catch
|
61 |
|
|
// method can return ~CAUGHT~, in which case further processing of the report is
|
62 |
|
|
// immediately stopped, or return ~THROW~ in which case the (possibly modified) report
|
63 |
|
|
// is passed on to other registered catchers. The catchers are processed in the order
|
64 |
|
|
// in which they are registered.
|
65 |
|
|
//
|
66 |
|
|
// On catching a report, the method can modify the severity, id, action,
|
67 |
|
|
// verbosity or the report string itself before the report is finally issued by
|
68 |
|
|
// the report server. The report can be immediately issued from within the catcher
|
69 |
|
|
// class by calling the method.
|
70 |
|
|
//
|
71 |
|
|
// The catcher maintains a count of all reports with FATAL,ERROR or WARNING severity
|
72 |
|
|
// and a count of all reports with FATAL, ERROR or WARNING severity whose severity
|
73 |
|
|
// was lowered. These statistics are reported in the summary of the .
|
74 |
|
|
//
|
75 |
|
|
// This example shows the basic concept of creating a report catching
|
76 |
|
|
// callback and attaching it to all messages that get emitted:
|
77 |
|
|
//
|
78 |
|
|
//| class my_error_demoter extends uvm_report_catcher;
|
79 |
|
|
//| function new(string name="my_error_demoter");
|
80 |
|
|
//| super.new(name);
|
81 |
|
|
//| endfunction
|
82 |
|
|
//| //This example demotes "MY_ID" errors to an info message
|
83 |
|
|
//| function action_e catch();
|
84 |
|
|
//| if(get_severity() == UVM_ERROR && get_id() == "MY_ID")
|
85 |
|
|
//| set_severity(UVM_INFO);
|
86 |
|
|
//| return THROW;
|
87 |
|
|
//| endfunction
|
88 |
|
|
//| endclass
|
89 |
|
|
//|
|
90 |
|
|
//| my_error_demoter demoter = new;
|
91 |
|
|
//| initial begin
|
92 |
|
|
//| // Catchers are callbacks on report objects (components are report
|
93 |
|
|
//| // objects, so catchers can be attached to components).
|
94 |
|
|
//|
|
95 |
|
|
//| // To affect all reporters, use ~null~ for the object
|
96 |
|
|
//| uvm_report_cb::add(null, demoter);
|
97 |
|
|
//|
|
98 |
|
|
//| // To affect some specific object use the specific reporter
|
99 |
|
|
//| uvm_report_cb::add(mytest.myenv.myagent.mydriver, demoter);
|
100 |
|
|
//|
|
101 |
|
|
//| // To affect some set of components (any "*driver" under mytest.myenv)
|
102 |
|
|
//| // using the component name
|
103 |
|
|
//| uvm_report_cb::add_by_name("*driver", demoter, mytest.myenv);
|
104 |
|
|
//| end
|
105 |
|
|
//
|
106 |
|
|
//
|
107 |
|
|
//------------------------------------------------------------------------------
|
108 |
|
|
|
109 |
|
|
virtual class uvm_report_catcher extends uvm_callback;
|
110 |
|
|
|
111 |
|
|
`uvm_register_cb(uvm_report_object,uvm_report_catcher)
|
112 |
|
|
|
113 |
|
|
typedef enum { UNKNOWN_ACTION, THROW, CAUGHT} action_e;
|
114 |
|
|
|
115 |
|
|
local static uvm_report_message m_modified_report_message;
|
116 |
|
|
local static uvm_report_message m_orig_report_message;
|
117 |
|
|
|
118 |
|
|
local static bit m_set_action_called;
|
119 |
|
|
|
120 |
|
|
// Counts for the demoteds and caughts
|
121 |
|
|
local static int m_demoted_fatal;
|
122 |
|
|
local static int m_demoted_error;
|
123 |
|
|
local static int m_demoted_warning;
|
124 |
|
|
local static int m_caught_fatal;
|
125 |
|
|
local static int m_caught_error;
|
126 |
|
|
local static int m_caught_warning;
|
127 |
|
|
|
128 |
|
|
// Flag counts
|
129 |
|
|
const static int DO_NOT_CATCH = 1;
|
130 |
|
|
const static int DO_NOT_MODIFY = 2;
|
131 |
|
|
local static int m_debug_flags;
|
132 |
|
|
|
133 |
|
|
local static bit do_report;
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
// Function: new
|
137 |
|
|
//
|
138 |
|
|
// Create a new report catcher. The name argument is optional, but
|
139 |
|
|
// should generally be provided to aid in debugging.
|
140 |
|
|
|
141 |
|
|
function new(string name = "uvm_report_catcher");
|
142 |
|
|
super.new(name);
|
143 |
|
|
do_report = 1;
|
144 |
|
|
endfunction
|
145 |
|
|
|
146 |
|
|
// Group: Current Message State
|
147 |
|
|
|
148 |
|
|
// Function: get_client
|
149 |
|
|
//
|
150 |
|
|
// Returns the that has generated the message that
|
151 |
|
|
// is currently being processed.
|
152 |
|
|
|
153 |
|
|
function uvm_report_object get_client();
|
154 |
|
|
return m_modified_report_message.get_report_object();
|
155 |
|
|
endfunction
|
156 |
|
|
|
157 |
|
|
// Function: get_severity
|
158 |
|
|
//
|
159 |
|
|
// Returns the of the message that is currently being
|
160 |
|
|
// processed. If the severity was modified by a previously executed
|
161 |
|
|
// catcher object (which re-threw the message), then the returned
|
162 |
|
|
// severity is the modified value.
|
163 |
|
|
|
164 |
|
|
function uvm_severity get_severity();
|
165 |
|
|
return this.m_modified_report_message.get_severity();
|
166 |
|
|
endfunction
|
167 |
|
|
|
168 |
|
|
// Function: get_context
|
169 |
|
|
//
|
170 |
|
|
// Returns the context name of the message that is currently being
|
171 |
|
|
// processed. This is typically the full hierarchical name of the component
|
172 |
|
|
// that issued the message. However, if user-defined context is set from
|
173 |
|
|
// a uvm_report_message, the user-defined context will be returned.
|
174 |
|
|
|
175 |
|
|
function string get_context();
|
176 |
|
|
string context_str;
|
177 |
|
|
|
178 |
|
|
context_str = this.m_modified_report_message.get_context();
|
179 |
|
|
if (context_str == "") begin
|
180 |
|
|
uvm_report_handler rh = this.m_modified_report_message.get_report_handler();
|
181 |
|
|
context_str = rh.get_full_name();
|
182 |
|
|
end
|
183 |
|
|
|
184 |
|
|
return context_str;
|
185 |
|
|
endfunction
|
186 |
|
|
|
187 |
|
|
// Function: get_verbosity
|
188 |
|
|
//
|
189 |
|
|
// Returns the verbosity of the message that is currently being
|
190 |
|
|
// processed. If the verbosity was modified by a previously executed
|
191 |
|
|
// catcher (which re-threw the message), then the returned
|
192 |
|
|
// verbosity is the modified value.
|
193 |
|
|
|
194 |
|
|
function int get_verbosity();
|
195 |
|
|
return this.m_modified_report_message.get_verbosity();
|
196 |
|
|
endfunction
|
197 |
|
|
|
198 |
|
|
// Function: get_id
|
199 |
|
|
//
|
200 |
|
|
// Returns the string id of the message that is currently being
|
201 |
|
|
// processed. If the id was modified by a previously executed
|
202 |
|
|
// catcher (which re-threw the message), then the returned
|
203 |
|
|
// id is the modified value.
|
204 |
|
|
|
205 |
|
|
function string get_id();
|
206 |
|
|
return this.m_modified_report_message.get_id();
|
207 |
|
|
endfunction
|
208 |
|
|
|
209 |
|
|
// Function: get_message
|
210 |
|
|
//
|
211 |
|
|
// Returns the string message of the message that is currently being
|
212 |
|
|
// processed. If the message was modified by a previously executed
|
213 |
|
|
// catcher (which re-threw the message), then the returned
|
214 |
|
|
// message is the modified value.
|
215 |
|
|
|
216 |
|
|
function string get_message();
|
217 |
|
|
return this.m_modified_report_message.get_message();
|
218 |
|
|
endfunction
|
219 |
|
|
|
220 |
|
|
// Function: get_action
|
221 |
|
|
//
|
222 |
|
|
// Returns the of the message that is currently being
|
223 |
|
|
// processed. If the action was modified by a previously executed
|
224 |
|
|
// catcher (which re-threw the message), then the returned
|
225 |
|
|
// action is the modified value.
|
226 |
|
|
|
227 |
|
|
function uvm_action get_action();
|
228 |
|
|
return this.m_modified_report_message.get_action();
|
229 |
|
|
endfunction
|
230 |
|
|
|
231 |
|
|
// Function: get_fname
|
232 |
|
|
//
|
233 |
|
|
// Returns the file name of the message.
|
234 |
|
|
|
235 |
|
|
function string get_fname();
|
236 |
|
|
return this.m_modified_report_message.get_filename();
|
237 |
|
|
endfunction
|
238 |
|
|
|
239 |
|
|
// Function: get_line
|
240 |
|
|
//
|
241 |
|
|
// Returns the line number of the message.
|
242 |
|
|
|
243 |
|
|
function int get_line();
|
244 |
|
|
return this.m_modified_report_message.get_line();
|
245 |
|
|
endfunction
|
246 |
|
|
|
247 |
|
|
// Function: get_element_container
|
248 |
|
|
//
|
249 |
|
|
// Returns the element container of the message.
|
250 |
|
|
|
251 |
|
|
function uvm_report_message_element_container get_element_container();
|
252 |
|
|
return this.m_modified_report_message.get_element_container();
|
253 |
|
|
endfunction
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
// Group: Change Message State
|
257 |
|
|
|
258 |
|
|
// Function: set_severity
|
259 |
|
|
//
|
260 |
|
|
// Change the severity of the message to ~severity~. Any other
|
261 |
|
|
// report catchers will see the modified value.
|
262 |
|
|
|
263 |
|
|
protected function void set_severity(uvm_severity severity);
|
264 |
|
|
this.m_modified_report_message.set_severity(severity);
|
265 |
|
|
endfunction
|
266 |
|
|
|
267 |
|
|
// Function: set_verbosity
|
268 |
|
|
//
|
269 |
|
|
// Change the verbosity of the message to ~verbosity~. Any other
|
270 |
|
|
// report catchers will see the modified value.
|
271 |
|
|
|
272 |
|
|
protected function void set_verbosity(int verbosity);
|
273 |
|
|
this.m_modified_report_message.set_verbosity(verbosity);
|
274 |
|
|
endfunction
|
275 |
|
|
|
276 |
|
|
// Function: set_id
|
277 |
|
|
//
|
278 |
|
|
// Change the id of the message to ~id~. Any other
|
279 |
|
|
// report catchers will see the modified value.
|
280 |
|
|
|
281 |
|
|
protected function void set_id(string id);
|
282 |
|
|
this.m_modified_report_message.set_id(id);
|
283 |
|
|
endfunction
|
284 |
|
|
|
285 |
|
|
// Function: set_message
|
286 |
|
|
//
|
287 |
|
|
// Change the text of the message to ~message~. Any other
|
288 |
|
|
// report catchers will see the modified value.
|
289 |
|
|
|
290 |
|
|
protected function void set_message(string message);
|
291 |
|
|
this.m_modified_report_message.set_message(message);
|
292 |
|
|
endfunction
|
293 |
|
|
|
294 |
|
|
// Function: set_action
|
295 |
|
|
//
|
296 |
|
|
// Change the action of the message to ~action~. Any other
|
297 |
|
|
// report catchers will see the modified value.
|
298 |
|
|
|
299 |
|
|
protected function void set_action(uvm_action action);
|
300 |
|
|
this.m_modified_report_message.set_action(action);
|
301 |
|
|
this.m_set_action_called = 1;
|
302 |
|
|
endfunction
|
303 |
|
|
|
304 |
|
|
// Function: set_context
|
305 |
|
|
//
|
306 |
|
|
// Change the context of the message to ~context_str~. Any other
|
307 |
|
|
// report catchers will see the modified value.
|
308 |
|
|
|
309 |
|
|
protected function void set_context(string context_str);
|
310 |
|
|
this.m_modified_report_message.set_context(context_str);
|
311 |
|
|
endfunction
|
312 |
|
|
|
313 |
|
|
// Function: add_int
|
314 |
|
|
//
|
315 |
|
|
// Add an integral type of the name ~name~ and value ~value~ to
|
316 |
|
|
// the message. The required ~size~ field indicates the size of ~value~.
|
317 |
|
|
// The required ~radix~ field determines how to display and
|
318 |
|
|
// record the field. Any other report catchers will see the newly
|
319 |
|
|
// added element.
|
320 |
|
|
//
|
321 |
|
|
|
322 |
|
|
protected function void add_int(string name,
|
323 |
|
|
uvm_bitstream_t value,
|
324 |
|
|
int size,
|
325 |
|
|
uvm_radix_enum radix,
|
326 |
|
|
uvm_action action = (UVM_LOG|UVM_RM_RECORD));
|
327 |
|
|
this.m_modified_report_message.add_int(name, value, size, radix, action);
|
328 |
|
|
endfunction
|
329 |
|
|
|
330 |
|
|
|
331 |
|
|
// Function: add_string
|
332 |
|
|
//
|
333 |
|
|
// Adds a string of the name ~name~ and value ~value~ to the
|
334 |
|
|
// message. Any other report catchers will see the newly
|
335 |
|
|
// added element.
|
336 |
|
|
//
|
337 |
|
|
|
338 |
|
|
protected function void add_string(string name,
|
339 |
|
|
string value,
|
340 |
|
|
uvm_action action = (UVM_LOG|UVM_RM_RECORD));
|
341 |
|
|
this.m_modified_report_message.add_string(name, value, action);
|
342 |
|
|
endfunction
|
343 |
|
|
|
344 |
|
|
|
345 |
|
|
// Function: add_object
|
346 |
|
|
//
|
347 |
|
|
// Adds a uvm_object of the name ~name~ and reference ~obj~ to
|
348 |
|
|
// the message. Any other report catchers will see the newly
|
349 |
|
|
// added element.
|
350 |
|
|
//
|
351 |
|
|
|
352 |
|
|
protected function void add_object(string name,
|
353 |
|
|
uvm_object obj,
|
354 |
|
|
uvm_action action = (UVM_LOG|UVM_RM_RECORD));
|
355 |
|
|
this.m_modified_report_message.add_object(name, obj, action);
|
356 |
|
|
endfunction
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
// Group: Debug
|
360 |
|
|
|
361 |
|
|
// Function: get_report_catcher
|
362 |
|
|
//
|
363 |
|
|
// Returns the first report catcher that has ~name~.
|
364 |
|
|
|
365 |
|
|
static function uvm_report_catcher get_report_catcher(string name);
|
366 |
|
|
static uvm_report_cb_iter iter = new(null);
|
367 |
|
|
get_report_catcher = iter.first();
|
368 |
|
|
while(get_report_catcher != null) begin
|
369 |
|
|
if(get_report_catcher.get_name() == name)
|
370 |
|
|
return get_report_catcher;
|
371 |
|
|
get_report_catcher = iter.next();
|
372 |
|
|
end
|
373 |
|
|
return null;
|
374 |
|
|
endfunction
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
// Function: print_catcher
|
378 |
|
|
//
|
379 |
|
|
// Prints information about all of the report catchers that are
|
380 |
|
|
// registered. For finer grained detail, the
|
381 |
|
|
// method can be used by calling uvm_report_cb::display().
|
382 |
|
|
|
383 |
|
|
static function void print_catcher(UVM_FILE file = 0);
|
384 |
|
|
string msg;
|
385 |
|
|
string enabled;
|
386 |
|
|
uvm_report_catcher catcher;
|
387 |
|
|
static uvm_report_cb_iter iter = new(null);
|
388 |
|
|
string q[$];
|
389 |
|
|
|
390 |
|
|
q.push_back("-------------UVM REPORT CATCHERS----------------------------\n");
|
391 |
|
|
|
392 |
|
|
catcher = iter.first();
|
393 |
|
|
while(catcher != null) begin
|
394 |
|
|
if(catcher.callback_mode())
|
395 |
|
|
enabled = "ON";
|
396 |
|
|
else
|
397 |
|
|
enabled = "OFF";
|
398 |
|
|
|
399 |
|
|
q.push_back($sformatf("%20s : %s\n", catcher.get_name(),enabled));
|
400 |
|
|
catcher = iter.next();
|
401 |
|
|
end
|
402 |
|
|
q.push_back("--------------------------------------------------------------\n");
|
403 |
|
|
|
404 |
|
|
`uvm_info_context("UVM/REPORT/CATCHER",`UVM_STRING_QUEUE_STREAMING_PACK(q),UVM_LOW,uvm_top)
|
405 |
|
|
endfunction
|
406 |
|
|
|
407 |
|
|
// Funciton: debug_report_catcher
|
408 |
|
|
//
|
409 |
|
|
// Turn on report catching debug information. ~what~ is a bitwise AND of
|
410 |
|
|
// * DO_NOT_CATCH -- forces catch to be ignored so that all catchers see the
|
411 |
|
|
// the reports.
|
412 |
|
|
// * DO_NOT_MODIFY -- forces the message to remain unchanged
|
413 |
|
|
|
414 |
|
|
static function void debug_report_catcher(int what= 0);
|
415 |
|
|
m_debug_flags = what;
|
416 |
|
|
endfunction
|
417 |
|
|
|
418 |
|
|
// Group: Callback Interface
|
419 |
|
|
|
420 |
|
|
// Function: catch
|
421 |
|
|
//
|
422 |
|
|
// This is the method that is called for each registered report catcher.
|
423 |
|
|
// There are no arguments to this function. The
|
424 |
|
|
// interface methods can be used to access information about the
|
425 |
|
|
// current message being processed.
|
426 |
|
|
|
427 |
|
|
pure virtual function action_e catch();
|
428 |
|
|
|
429 |
|
|
|
430 |
|
|
// Group: Reporting
|
431 |
|
|
|
432 |
|
|
// Function: uvm_report_fatal
|
433 |
|
|
//
|
434 |
|
|
// Issues a fatal message using the current message's report object.
|
435 |
|
|
// This message will bypass any message catching callbacks.
|
436 |
|
|
|
437 |
|
|
protected function void uvm_report_fatal(string id,
|
438 |
|
|
string message,
|
439 |
|
|
int verbosity,
|
440 |
|
|
string fname = "",
|
441 |
|
|
int line = 0,
|
442 |
|
|
string context_name = "",
|
443 |
|
|
bit report_enabled_checked = 0);
|
444 |
|
|
|
445 |
|
|
this.uvm_report(UVM_FATAL, id, message, UVM_NONE, fname, line,
|
446 |
|
|
context_name, report_enabled_checked);
|
447 |
|
|
endfunction
|
448 |
|
|
|
449 |
|
|
|
450 |
|
|
// Function: uvm_report_error
|
451 |
|
|
//
|
452 |
|
|
// Issues an error message using the current message's report object.
|
453 |
|
|
// This message will bypass any message catching callbacks.
|
454 |
|
|
|
455 |
|
|
protected function void uvm_report_error(string id,
|
456 |
|
|
string message,
|
457 |
|
|
int verbosity,
|
458 |
|
|
string fname = "",
|
459 |
|
|
int line = 0,
|
460 |
|
|
string context_name = "",
|
461 |
|
|
bit report_enabled_checked = 0);
|
462 |
|
|
|
463 |
|
|
this.uvm_report(UVM_ERROR, id, message, UVM_NONE, fname, line,
|
464 |
|
|
context_name, report_enabled_checked);
|
465 |
|
|
endfunction
|
466 |
|
|
|
467 |
|
|
|
468 |
|
|
// Function: uvm_report_warning
|
469 |
|
|
//
|
470 |
|
|
// Issues a warning message using the current message's report object.
|
471 |
|
|
// This message will bypass any message catching callbacks.
|
472 |
|
|
|
473 |
|
|
protected function void uvm_report_warning(string id,
|
474 |
|
|
string message,
|
475 |
|
|
int verbosity,
|
476 |
|
|
string fname = "",
|
477 |
|
|
int line = 0,
|
478 |
|
|
string context_name = "",
|
479 |
|
|
bit report_enabled_checked = 0);
|
480 |
|
|
|
481 |
|
|
this.uvm_report(UVM_WARNING, id, message, UVM_NONE, fname, line,
|
482 |
|
|
context_name, report_enabled_checked);
|
483 |
|
|
endfunction
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
// Function: uvm_report_info
|
487 |
|
|
//
|
488 |
|
|
// Issues a info message using the current message's report object.
|
489 |
|
|
// This message will bypass any message catching callbacks.
|
490 |
|
|
|
491 |
|
|
protected function void uvm_report_info(string id,
|
492 |
|
|
string message,
|
493 |
|
|
int verbosity,
|
494 |
|
|
string fname = "",
|
495 |
|
|
int line = 0,
|
496 |
|
|
string context_name = "",
|
497 |
|
|
bit report_enabled_checked = 0);
|
498 |
|
|
|
499 |
|
|
this.uvm_report(UVM_INFO, id, message, verbosity, fname, line,
|
500 |
|
|
context_name, report_enabled_checked);
|
501 |
|
|
endfunction
|
502 |
|
|
|
503 |
|
|
// Function: uvm_report
|
504 |
|
|
//
|
505 |
|
|
// Issues a message using the current message's report object.
|
506 |
|
|
// This message will bypass any message catching callbacks.
|
507 |
|
|
|
508 |
|
|
protected function void uvm_report(uvm_severity severity,
|
509 |
|
|
string id,
|
510 |
|
|
string message,
|
511 |
|
|
int verbosity,
|
512 |
|
|
string fname = "",
|
513 |
|
|
int line = 0,
|
514 |
|
|
string context_name = "",
|
515 |
|
|
bit report_enabled_checked = 0);
|
516 |
|
|
|
517 |
|
|
uvm_report_message l_report_message;
|
518 |
|
|
if (report_enabled_checked == 0) begin
|
519 |
|
|
if (!uvm_report_enabled(verbosity, severity, id))
|
520 |
|
|
return;
|
521 |
|
|
end
|
522 |
|
|
|
523 |
|
|
l_report_message = uvm_report_message::new_report_message();
|
524 |
|
|
l_report_message.set_report_message(severity, id, message,
|
525 |
|
|
verbosity, fname, line, context_name);
|
526 |
|
|
this.uvm_process_report_message(l_report_message);
|
527 |
|
|
endfunction
|
528 |
|
|
|
529 |
|
|
protected function void uvm_process_report_message(uvm_report_message msg);
|
530 |
|
|
uvm_report_object ro = m_modified_report_message.get_report_object();
|
531 |
|
|
uvm_action a = ro.get_report_action(msg.get_severity(), msg.get_id());
|
532 |
|
|
|
533 |
|
|
if(a) begin
|
534 |
|
|
string composed_message;
|
535 |
|
|
uvm_report_server rs = m_modified_report_message.get_report_server();
|
536 |
|
|
|
537 |
|
|
msg.set_report_object(ro);
|
538 |
|
|
msg.set_report_handler(m_modified_report_message.get_report_handler());
|
539 |
|
|
msg.set_report_server(rs);
|
540 |
|
|
msg.set_file(ro.get_report_file_handle(msg.get_severity(), msg.get_id()));
|
541 |
|
|
msg.set_action(a);
|
542 |
|
|
|
543 |
|
|
// no need to compose when neither UVM_DISPLAY nor UVM_LOG is set
|
544 |
|
|
if (a & (UVM_LOG|UVM_DISPLAY))
|
545 |
|
|
composed_message = rs.compose_report_message(msg);
|
546 |
|
|
rs.execute_report_message(msg, composed_message);
|
547 |
|
|
end
|
548 |
|
|
endfunction
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
// Function: issue
|
552 |
|
|
// Immediately issues the message which is currently being processed. This
|
553 |
|
|
// is useful if the message is being ~CAUGHT~ but should still be emitted.
|
554 |
|
|
//
|
555 |
|
|
// Issuing a message will update the report_server stats, possibly multiple
|
556 |
|
|
// times if the message is not ~CAUGHT~.
|
557 |
|
|
|
558 |
|
|
protected function void issue();
|
559 |
|
|
string composed_message;
|
560 |
|
|
uvm_report_server rs = m_modified_report_message.get_report_server();
|
561 |
|
|
|
562 |
|
|
if(uvm_action_type'(m_modified_report_message.get_action()) != UVM_NO_ACTION)
|
563 |
|
|
begin
|
564 |
|
|
// no need to compose when neither UVM_DISPLAY nor UVM_LOG is set
|
565 |
|
|
if (m_modified_report_message.get_action() & (UVM_LOG|UVM_DISPLAY))
|
566 |
|
|
composed_message = rs.compose_report_message(m_modified_report_message);
|
567 |
|
|
rs.execute_report_message(m_modified_report_message, composed_message);
|
568 |
|
|
end
|
569 |
|
|
endfunction
|
570 |
|
|
|
571 |
|
|
|
572 |
|
|
//process_all_report_catchers
|
573 |
|
|
//method called by report_server.report to process catchers
|
574 |
|
|
//
|
575 |
|
|
|
576 |
|
|
static function int process_all_report_catchers(uvm_report_message rm);
|
577 |
|
|
int iter;
|
578 |
|
|
uvm_report_catcher catcher;
|
579 |
|
|
int thrown = 1;
|
580 |
|
|
uvm_severity orig_severity;
|
581 |
|
|
static bit in_catcher;
|
582 |
|
|
uvm_report_object l_report_object = rm.get_report_object();
|
583 |
|
|
|
584 |
|
|
if(in_catcher == 1) begin
|
585 |
|
|
return 1;
|
586 |
|
|
end
|
587 |
|
|
in_catcher = 1;
|
588 |
|
|
uvm_callbacks_base::m_tracing = 0; //turn off cb tracing so catcher stuff doesn't print
|
589 |
|
|
|
590 |
|
|
orig_severity = uvm_severity'(rm.get_severity());
|
591 |
|
|
m_modified_report_message = rm;
|
592 |
|
|
|
593 |
|
|
catcher = uvm_report_cb::get_first(iter,l_report_object);
|
594 |
|
|
if (catcher != null) begin
|
595 |
|
|
if(m_debug_flags & DO_NOT_MODIFY) begin
|
596 |
|
|
process p = process::self(); // Keep random stability
|
597 |
|
|
string randstate;
|
598 |
|
|
if (p != null)
|
599 |
|
|
randstate = p.get_randstate();
|
600 |
|
|
$cast(m_orig_report_message, rm.clone()); //have to clone, rm can be extended type
|
601 |
|
|
if (p != null)
|
602 |
|
|
p.set_randstate(randstate);
|
603 |
|
|
end
|
604 |
|
|
end
|
605 |
|
|
while(catcher != null) begin
|
606 |
|
|
uvm_severity prev_sev;
|
607 |
|
|
|
608 |
|
|
if (!catcher.callback_mode()) begin
|
609 |
|
|
catcher = uvm_report_cb::get_next(iter,l_report_object);
|
610 |
|
|
continue;
|
611 |
|
|
end
|
612 |
|
|
|
613 |
|
|
prev_sev = m_modified_report_message.get_severity();
|
614 |
|
|
m_set_action_called = 0;
|
615 |
|
|
thrown = catcher.process_report_catcher();
|
616 |
|
|
|
617 |
|
|
// Set the action to the default action for the new severity
|
618 |
|
|
// if it is still at the default for the previous severity,
|
619 |
|
|
// unless it was explicitly set.
|
620 |
|
|
if (!m_set_action_called &&
|
621 |
|
|
m_modified_report_message.get_severity() != prev_sev &&
|
622 |
|
|
m_modified_report_message.get_action() ==
|
623 |
|
|
l_report_object.get_report_action(prev_sev, "*@&*^*^*#")) begin
|
624 |
|
|
|
625 |
|
|
m_modified_report_message.set_action(
|
626 |
|
|
l_report_object.get_report_action(m_modified_report_message.get_severity(), "*@&*^*^*#"));
|
627 |
|
|
end
|
628 |
|
|
|
629 |
|
|
if(thrown == 0) begin
|
630 |
|
|
case(orig_severity)
|
631 |
|
|
UVM_FATAL: m_caught_fatal++;
|
632 |
|
|
UVM_ERROR: m_caught_error++;
|
633 |
|
|
UVM_WARNING: m_caught_warning++;
|
634 |
|
|
endcase
|
635 |
|
|
break;
|
636 |
|
|
end
|
637 |
|
|
catcher = uvm_report_cb::get_next(iter,l_report_object);
|
638 |
|
|
end //while
|
639 |
|
|
|
640 |
|
|
//update counters if message was returned with demoted severity
|
641 |
|
|
case(orig_severity)
|
642 |
|
|
UVM_FATAL:
|
643 |
|
|
if(m_modified_report_message.get_severity() < orig_severity)
|
644 |
|
|
m_demoted_fatal++;
|
645 |
|
|
UVM_ERROR:
|
646 |
|
|
if(m_modified_report_message.get_severity() < orig_severity)
|
647 |
|
|
m_demoted_error++;
|
648 |
|
|
UVM_WARNING:
|
649 |
|
|
if(m_modified_report_message.get_severity() < orig_severity)
|
650 |
|
|
m_demoted_warning++;
|
651 |
|
|
endcase
|
652 |
|
|
|
653 |
|
|
in_catcher = 0;
|
654 |
|
|
uvm_callbacks_base::m_tracing = 1; //turn tracing stuff back on
|
655 |
|
|
|
656 |
|
|
return thrown;
|
657 |
|
|
endfunction
|
658 |
|
|
|
659 |
|
|
|
660 |
|
|
//process_report_catcher
|
661 |
|
|
//internal method to call user method
|
662 |
|
|
//
|
663 |
|
|
|
664 |
|
|
local function int process_report_catcher();
|
665 |
|
|
|
666 |
|
|
action_e act;
|
667 |
|
|
|
668 |
|
|
act = this.catch();
|
669 |
|
|
|
670 |
|
|
if(act == UNKNOWN_ACTION)
|
671 |
|
|
this.uvm_report_error("RPTCTHR", {"uvm_report_this.catch() in catcher instance ",
|
672 |
|
|
this.get_name(), " must return THROW or CAUGHT"}, UVM_NONE, `uvm_file, `uvm_line);
|
673 |
|
|
|
674 |
|
|
if(m_debug_flags & DO_NOT_MODIFY) begin
|
675 |
|
|
m_modified_report_message.copy(m_orig_report_message);
|
676 |
|
|
end
|
677 |
|
|
|
678 |
|
|
if(act == CAUGHT && !(m_debug_flags & DO_NOT_CATCH)) begin
|
679 |
|
|
return 0;
|
680 |
|
|
end
|
681 |
|
|
|
682 |
|
|
return 1;
|
683 |
|
|
|
684 |
|
|
endfunction
|
685 |
|
|
|
686 |
|
|
|
687 |
|
|
// Function: summarize
|
688 |
|
|
//
|
689 |
|
|
// This function is called automatically by .
|
690 |
|
|
// It prints the statistics for the active catchers.
|
691 |
|
|
|
692 |
|
|
|
693 |
|
|
static function void summarize();
|
694 |
|
|
string s;
|
695 |
|
|
string q[$];
|
696 |
|
|
if(do_report) begin
|
697 |
|
|
q.push_back("\n--- UVM Report catcher Summary ---\n\n\n");
|
698 |
|
|
q.push_back($sformatf("Number of demoted UVM_FATAL reports :%5d\n", m_demoted_fatal));
|
699 |
|
|
q.push_back($sformatf("Number of demoted UVM_ERROR reports :%5d\n", m_demoted_error));
|
700 |
|
|
q.push_back($sformatf("Number of demoted UVM_WARNING reports:%5d\n", m_demoted_warning));
|
701 |
|
|
q.push_back($sformatf("Number of caught UVM_FATAL reports :%5d\n", m_caught_fatal));
|
702 |
|
|
q.push_back($sformatf("Number of caught UVM_ERROR reports :%5d\n", m_caught_error));
|
703 |
|
|
q.push_back($sformatf("Number of caught UVM_WARNING reports :%5d\n", m_caught_warning));
|
704 |
|
|
|
705 |
|
|
`uvm_info_context("UVM/REPORT/CATCHER",`UVM_STRING_QUEUE_STREAMING_PACK(q),UVM_LOW,uvm_top)
|
706 |
|
|
end
|
707 |
|
|
endfunction
|
708 |
|
|
|
709 |
|
|
endclass
|
710 |
|
|
|
711 |
|
|
`endif // UVM_REPORT_CATCHER_SVH
|