OpenCores
URL https://opencores.org/ocsvn/uart2bus_testbench/uart2bus_testbench/trunk

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [uvm_src/] [macros/] [uvm_message_defines.svh] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 HanySalah
//----------------------------------------------------------------------
2
//   Copyright 2007-2011 Mentor Graphics Corporation
3
//   Copyright 2007-2010 Cadence Design Systems, Inc.
4
//   Copyright 2010 Synopsys, Inc.
5
//   All Rights Reserved Worldwide
6
//
7
//   Licensed under the Apache License, Version 2.0 (the
8
//   "License"); you may not use this file except in
9
//   compliance with the License.  You may obtain a copy of
10
//   the License at
11
//
12
//       http://www.apache.org/licenses/LICENSE-2.0
13
//
14
//   Unless required by applicable law or agreed to in
15
//   writing, software distributed under the License is
16
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17
//   CONDITIONS OF ANY KIND, either express or implied.  See
18
//   the License for the specific language governing
19
//   permissions and limitations under the License.
20
//----------------------------------------------------------------------
21
 
22
`ifndef UVM_MESSAGE_DEFINES_SVH
23
`define UVM_MESSAGE_DEFINES_SVH
24
 
25
`ifndef UVM_LINE_WIDTH
26
  `define UVM_LINE_WIDTH 120
27
`endif
28
 
29
`ifndef UVM_NUM_LINES
30
  `define UVM_NUM_LINES 120
31
`endif
32
 
33
//`ifndef UVM_USE_FILE_LINE
34
//`define UVM_REPORT_DISABLE_FILE_LINE
35
//`endif
36
 
37
`ifdef UVM_REPORT_DISABLE_FILE_LINE
38
`define UVM_REPORT_DISABLE_FILE
39
`define UVM_REPORT_DISABLE_LINE
40
`endif
41
 
42
`ifdef UVM_REPORT_DISABLE_FILE
43
`define uvm_file ""
44
`else
45
`define uvm_file `__FILE__
46
`endif
47
 
48
`ifdef UVM_REPORT_DISABLE_LINE
49
`define uvm_line 0
50
`else
51
`define uvm_line `__LINE__
52
`endif
53
 
54
 
55
//------------------------------------------------------------------------------
56
//
57
// Title: Report Macros
58
//
59
// This set of macros provides wrappers around the uvm_report_* 
60
// functions. The macros serve two essential purposes:
61
//
62
// - To reduce the processing overhead associated with filtered out messages,
63
//   a check is made against the report's verbosity setting and the action
64
//   for the id/severity pair before any string formatting is performed. This
65
//   affects only `uvm_info reports.
66
//
67
// - The `__FILE__ and `__LINE__ information is automatically provided to the
68
//   underlying uvm_report_* call. Having the file and line number from where
69
//   a report was issued aides in debug. You can disable display of file and
70
//   line information in reports by defining UVM_REPORT_DISABLE_FILE_LINE on
71
//   the command line.
72
//
73
// The macros also enforce a verbosity setting of UVM_NONE for warnings, errors
74
// and fatals so that they cannot be mistakenly turned off by setting the
75
// verbosity level too low (warning and errors can still be turned off by
76
// setting the actions appropriately).
77
//
78
// To use the macros, replace the previous call to uvm_report_* with the
79
// corresponding macro.
80
//
81
//| //Previous calls to uvm_report_*
82
//| uvm_report_info("MYINFO1", $sformatf("val: %0d", val), UVM_LOW);
83
//| uvm_report_warning("MYWARN1", "This is a warning");
84
//| uvm_report_error("MYERR", "This is an error");
85
//| uvm_report_fatal("MYFATAL", "A fatal error has occurred");
86
//
87
// The above code is replaced by
88
//
89
//| //New calls to `uvm_*
90
//| `uvm_info("MYINFO1", $sformatf("val: %0d", val), UVM_LOW)
91
//| `uvm_warning("MYWARN1", "This is a warning")
92
//| `uvm_error("MYERR", "This is an error")
93
//| `uvm_fatal("MYFATAL", "A fatal error has occurred")
94
//
95
// Macros represent text substitutions, not statements, so they should not be
96
// terminated with semi-colons.
97
 
98
 
99
//----------------------------------------------------------------------------
100
// Group:  Basic Messaging Macros
101
//----------------------------------------------------------------------------
102
 
103
 
104
// MACRO: `uvm_info
105
//
106
// Calls uvm_report_info if ~VERBOSITY~ is lower than the configured verbosity of
107
// the associated reporter. ~ID~ is given as the message tag and ~MSG~ is given as
108
// the message text. The file and line are also sent to the uvm_report_info call.
109
//
110
// |`uvm_info(ID, MSG, VERBOSITY)
111
 
112
`define uvm_info(ID, MSG, VERBOSITY) \
113
   begin \
114
     if (uvm_report_enabled(VERBOSITY,UVM_INFO,ID)) \
115
       uvm_report_info (ID, MSG, VERBOSITY, `uvm_file, `uvm_line, "", 1); \
116
   end
117
 
118
 
119
// MACRO: `uvm_warning
120
//
121
// Calls uvm_report_warning with a verbosity of UVM_NONE. The message cannot
122
// be turned off using the reporter's verbosity setting, but can be turned off
123
// by setting the action for the message.  ~ID~ is given as the message tag and
124
// ~MSG~ is given as the message text. The file and line are also sent to the
125
// uvm_report_warning call.
126
//
127
// |`uvm_warning(ID, MSG)
128
 
129
`define uvm_warning(ID, MSG) \
130
   begin \
131
     if (uvm_report_enabled(UVM_NONE,UVM_WARNING,ID)) \
132
       uvm_report_warning (ID, MSG, UVM_NONE, `uvm_file, `uvm_line, "", 1); \
133
   end
134
 
135
 
136
// MACRO: `uvm_error
137
//
138
// Calls uvm_report_error with a verbosity of UVM_NONE. The message cannot
139
// be turned off using the reporter's verbosity setting, but can be turned off
140
// by setting the action for the message.  ~ID~ is given as the message tag and
141
// ~MSG~ is given as the message text. The file and line are also sent to the
142
// uvm_report_error call.
143
//
144
// |`uvm_error(ID, MSG)
145
 
146
`define uvm_error(ID, MSG) \
147
   begin \
148
     if (uvm_report_enabled(UVM_NONE,UVM_ERROR,ID)) \
149
       uvm_report_error (ID, MSG, UVM_NONE, `uvm_file, `uvm_line, "", 1); \
150
   end
151
 
152
 
153
// MACRO: `uvm_fatal
154
//
155
// Calls uvm_report_fatal with a verbosity of UVM_NONE. The message cannot
156
// be turned off using the reporter's verbosity setting, but can be turned off
157
// by setting the action for the message.  ~ID~ is given as the message tag and
158
// ~MSG~ is given as the message text. The file and line are also sent to the
159
// uvm_report_fatal call.
160
//
161
// |`uvm_fatal(ID, MSG)
162
 
163
`define uvm_fatal(ID, MSG) \
164
   begin \
165
     if (uvm_report_enabled(UVM_NONE,UVM_FATAL,ID)) \
166
       uvm_report_fatal (ID, MSG, UVM_NONE, `uvm_file, `uvm_line, "", 1); \
167
   end
168
 
169
 
170
 
171
// MACRO: `uvm_info_context
172
//
173
//| `uvm_info_context(ID, MSG, VERBOSITY, RO)
174
//
175
// Operates identically to `uvm_info but requires that the
176
// context, or , in which the message is printed be
177
// explicitly supplied as a macro argument.
178
 
179
`define uvm_info_context(ID, MSG, VERBOSITY, RO) \
180
   begin \
181
     if (RO.uvm_report_enabled(VERBOSITY,UVM_INFO,ID)) \
182
       RO.uvm_report_info (ID, MSG, VERBOSITY, `uvm_file, `uvm_line, "", 1); \
183
   end
184
 
185
 
186
// MACRO: `uvm_warning_context
187
//
188
//| `uvm_warning_context(ID, MSG, RO)
189
//
190
// Operates identically to `uvm_warning but requires that the
191
// context, or , in which the message is printed be
192
// explicitly supplied as a macro argument.
193
 
194
`define uvm_warning_context(ID, MSG, RO) \
195
   begin \
196
     if (RO.uvm_report_enabled(UVM_NONE,UVM_WARNING,ID)) \
197
       RO.uvm_report_warning (ID, MSG, UVM_NONE, `uvm_file, `uvm_line, "", 1); \
198
   end
199
 
200
 
201
// MACRO: `uvm_error_context
202
//
203
//| `uvm_error_context(ID, MSG, RO)
204
//
205
// Operates identically to `uvm_error but requires that the
206
// context, or  in which the message is printed be
207
// explicitly supplied as a macro argument.
208
 
209
`define uvm_error_context(ID, MSG, RO) \
210
   begin \
211
     if (RO.uvm_report_enabled(UVM_NONE,UVM_ERROR,ID)) \
212
       RO.uvm_report_error (ID, MSG, UVM_NONE, `uvm_file, `uvm_line, "", 1); \
213
   end
214
 
215
 
216
// MACRO: `uvm_fatal_context
217
//
218
//| `uvm_fatal_context(ID, MSG, RO)
219
//
220
// Operates identically to `uvm_fatal but requires that the
221
// context, or , in which the message is printed be
222
// explicitly supplied as a macro argument.
223
 
224
`define uvm_fatal_context(ID, MSG, RO) \
225
   begin \
226
     if (RO.uvm_report_enabled(UVM_NONE,UVM_FATAL,ID)) \
227
       RO.uvm_report_fatal (ID, MSG, UVM_NONE, `uvm_file, `uvm_line, "", 1); \
228
   end
229
 
230
 
231
 
232
 
233
//----------------------------------------------------------------------------
234
// Group:  Message Trace Macros
235
//----------------------------------------------------------------------------
236
 
237
// MACRO- `uvm_message_begin
238
//
239
// Undocumented. Library internal use.
240
//
241
 
242
`define uvm_message_begin(SEVERITY, ID, MSG, VERBOSITY, FILE, LINE, RM) \
243
   begin \
244
     if (uvm_report_enabled(VERBOSITY,SEVERITY,ID)) begin \
245
       uvm_report_message __uvm_msg; \
246
       if (RM == null) RM = uvm_report_message::new_report_message(); \
247
       __uvm_msg = RM; \
248
       __uvm_msg.set_report_message(SEVERITY, ID, MSG, VERBOSITY, FILE, LINE, "");
249
 
250
 
251
// MACRO- `uvm_message_end
252
//
253
// Undocumented. Library internal use.
254
//
255
//
256
 
257
`define uvm_message_end \
258
       uvm_process_report_message(__uvm_msg); \
259
     end \
260
   end
261
 
262
// MACRO- `uvm_message_context_begin
263
//
264
// Undocumented. Library internal use.
265
//
266
 
267
`define uvm_message_context_begin(SEVERITY, ID, MSG, VERBOSITY, FILE, LINE, RO, RM) \
268
   begin \
269
     uvm_report_object __report_object; \
270
     __report_object = RO; \
271
     if (__report_object.uvm_report_enabled(VERBOSITY,SEVERITY,ID)) begin \
272
       uvm_report_message __uvm_msg; \
273
       if (RM == null) RM = uvm_report_message::new_report_message(); \
274
       __uvm_msg = RM; \
275
       __uvm_msg.set_report_message(SEVERITY, ID, MSG, VERBOSITY, FILE, LINE, "");
276
 
277
 
278
// MACRO- `uvm_message_context_end
279
//
280
// Undocumented. Library internal use.
281
//
282
//
283
 
284
`define uvm_message_context_end \
285
       __report_object.uvm_process_report_message(__uvm_msg); \
286
     end \
287
   end
288
 
289
 
290
// MACRO: `uvm_info_begin
291
//
292
// |`uvm_info_begin(ID, MSG, VERBOSITY, RM = __uvm_msg)
293
//
294
 
295
`define uvm_info_begin(ID, MSG, VERBOSITY, RM = __uvm_msg) \
296
   `uvm_message_begin(UVM_INFO, ID, MSG, VERBOSITY, `uvm_file, `uvm_line, RM)
297
 
298
// MACRO: `uvm_info_end
299
//
300
// This macro pair provides the ability to add elements to messages.
301
//
302
// |`uvm_info_end
303
//
304
// Example usage is shown here.
305
//
306
// |...
307
// |task my_task();
308
// |   ...
309
// |   `uvm_info_begin("MY_ID", "This is my message...", UVM_LOW)
310
// |     `uvm_message_add_tag("my_color", "red")
311
// |     `uvm_message_add_int(my_int, UVM_DEC)
312
// |     `uvm_message_add_string(my_string)
313
// |     `uvm_message_add_object(my_obj)
314
// |   `uvm_info_end
315
// |   ...
316
// |endtask
317
//
318
 
319
`define uvm_info_end \
320
   `uvm_message_end
321
 
322
 
323
// MACRO: `uvm_warning_begin
324
//
325
// |`uvm_warning_begin(ID, MSG, RM = __uvm_msg)
326
//
327
 
328
`define uvm_warning_begin(ID, MSG, RM = __uvm_msg) \
329
   `uvm_message_begin(UVM_WARNING, ID, MSG, UVM_NONE, `uvm_file, `uvm_line, RM)
330
 
331
// MACRO: `uvm_warning_end
332
//
333
// This macro pair operates identically to <`uvm_info_begin>/<`uvm_info_end> with
334
// exception that the message severity is  and has no verbosity threshold.
335
//
336
// |`uvm_warning_end
337
//
338
// The usage shown in <`uvm_info_end> works identically for this pair.
339
//
340
 
341
`define uvm_warning_end \
342
   `uvm_message_end
343
 
344
 
345
// MACRO: `uvm_error_begin
346
//
347
// |`uvm_error_begin(ID, MSG, RM = __uvm_msg)
348
//
349
 
350
`define uvm_error_begin(ID, MSG, RM = __uvm_msg) \
351
   `uvm_message_begin(UVM_ERROR, ID, MSG, UVM_NONE, `uvm_file, `uvm_line, RM)
352
 
353
 
354
// MACRO: `uvm_error_end
355
//
356
// This macro pair operates identically to <`uvm_info_begin>/<`uvm_info_end> with
357
// exception that the message severity is  and has no verbosity threshold.
358
//
359
// |`uvm_error_end
360
//
361
// The usage shown in <`uvm_info_end> works identically for this pair.
362
//
363
 
364
`define uvm_error_end \
365
   `uvm_message_end
366
 
367
 
368
// MACRO: `uvm_fatal_begin
369
//
370
// |`uvm_fatal_begin(ID, MSG, RM = __uvm_msg)
371
//
372
 
373
`define uvm_fatal_begin(ID, MSG, RM = __uvm_msg) \
374
   `uvm_message_begin(UVM_FATAL, ID, MSG, UVM_NONE, `uvm_file, `uvm_line, RM)
375
 
376
 
377
// MACRO: `uvm_fatal_end
378
//
379
// This macro pair operates identically to <`uvm_info_begin>/<`uvm_info_end> with
380
// exception that the message severity is  and has no verbosity threshold.
381
//
382
// |`uvm_fatal_end
383
//
384
// The usage shown in <`uvm_info_end> works identically for this pair.
385
//
386
 
387
`define uvm_fatal_end \
388
   `uvm_message_end
389
 
390
 
391
// MACRO: `uvm_info_context_begin
392
//
393
// |`uvm_info_context_begin(ID, MSG, UVM_NONE, RO, RM = __uvm_msg)
394
//
395
 
396
`define uvm_info_context_begin(ID, MSG, VERBOSITY, RO, RM = __uvm_msg) \
397
   `uvm_message_context_begin(UVM_INFO, ID, MSG, VERBOSITY, `uvm_file, `uvm_line, RO, RM)
398
 
399
 
400
// MACRO: `uvm_info_context_end
401
//
402
// |`uvm_info_context_end
403
//
404
// This macro pair operates identically to <`uvm_info_begin>/<`uvm_info_end>, but
405
// requires that the context, or  in which the message is printed
406
// be explicitly supplied as a macro argument.
407
//
408
 
409
`define uvm_info_context_end \
410
   `uvm_message_context_end
411
 
412
 
413
// MACRO: `uvm_warning_context_begin
414
//
415
// |`uvm_warning_context_begin(ID, MSG, RO, RM = __uvm_msg)
416
//
417
 
418
`define uvm_warning_context_begin(ID, MSG, RO, RM = __uvm_msg) \
419
   `uvm_message_context_begin(UVM_WARNING, ID, MSG, UVM_NONE, `uvm_file, `uvm_line, RO, RM)
420
 
421
// MACRO: `uvm_warning_context_end
422
//
423
// |`uvm_warning_context_end
424
//
425
// This macro pair operates identically to <`uvm_warning_begin>/<`uvm_warning_end>, but
426
// requires that the context, or  in which the message is printed
427
// be explicitly supplied as a macro argument.
428
//
429
 
430
`define uvm_warning_context_end \
431
   `uvm_message_context_end
432
 
433
 
434
// MACRO: `uvm_error_context_begin
435
//
436
// |`uvm_error_context_begin(ID, MSG, RO, RM = __uvm_msg)
437
//
438
 
439
`define uvm_error_context_begin(ID, MSG, RO, RM = __uvm_msg) \
440
   `uvm_message_context_begin(UVM_ERROR, ID, MSG, UVM_NONE, `uvm_file, `uvm_line, RO, RM)
441
 
442
 
443
// MACRO: `uvm_error_context_end
444
//
445
// |`uvm_error_context_end
446
//
447
// This macro pair operates identically to <`uvm_error_begin>/<`uvm_error_end>, but
448
// requires that the context, or  in which the message is printed
449
// be explicitly supplied as a macro argument.
450
//
451
 
452
`define uvm_error_context_end \
453
   `uvm_message_context_end
454
 
455
 
456
// MACRO: `uvm_fatal_context_begin
457
//
458
// |`uvm_fatal_context_begin(ID, MSG, RO, RM = __uvm_msg)
459
//
460
 
461
`define uvm_fatal_context_begin(ID, MSG, RO, RM = __uvm_msg) \
462
   `uvm_message_context_begin(UVM_FATAL, ID, MSG, UVM_NONE, `uvm_file, `uvm_line, RO, RM)
463
 
464
 
465
// MACRO: `uvm_fatal_context_end
466
//
467
// |`uvm_fatal_context_end
468
//
469
// This macro pair operates identically to <`uvm_fatal_begin>/<`uvm_fatal_end>, but
470
// requires that the context, or  in which the message is printed
471
// be explicitly supplied as a macro argument.
472
//
473
 
474
`define uvm_fatal_context_end \
475
   `uvm_message_context_end
476
 
477
 
478
//----------------------------------------------------------------------------
479
// Group:  Message Element Macros
480
//----------------------------------------------------------------------------
481
 
482
 
483
// MACRO: `uvm_message_add_tag
484
//
485
// |`uvm_message_add_tag(NAME, VALUE, ACTION=(UVM_LOG|UVM_RM_RECORD))
486
//
487
 
488
`define uvm_message_add_tag(NAME, VALUE, ACTION=(UVM_LOG|UVM_RM_RECORD)) \
489
    __uvm_msg.add_string(NAME, VALUE, ACTION);
490
 
491
 
492
// MACRO: `uvm_message_add_int
493
//
494
// |`uvm_message_add_int(VAR, RADIX, LABEL = "", ACTION=(UVM_LOG|UVM_RM_RECORD))
495
//
496
 
497
`define uvm_message_add_int(VAR, RADIX, LABEL="", ACTION=(UVM_LOG|UVM_RM_RECORD)) \
498
    if (LABEL == "") \
499
      __uvm_msg.add_int(`"VAR`", VAR, $bits(VAR), RADIX, ACTION); \
500
    else \
501
      __uvm_msg.add_int(LABEL, VAR, $bits(VAR), RADIX, ACTION);
502
 
503
 
504
// MACRO: `uvm_message_add_string
505
//
506
// |`uvm_message_add_string(VAR, LABEL = "", ACTION=(UVM_LOG|UVM_RM_RECORD))
507
//
508
 
509
`define uvm_message_add_string(VAR, LABEL="", ACTION=(UVM_LOG|UVM_RM_RECORD)) \
510
    if (LABEL == "") \
511
      __uvm_msg.add_string(`"VAR`", VAR, ACTION); \
512
    else \
513
      __uvm_msg.add_string(LABEL, VAR, ACTION);
514
 
515
 
516
// MACRO: `uvm_message_add_object
517
//
518
// These macros allow the user to provide elements that are associated with
519
// s.  Separate macros are provided such that the
520
// user can supply arbitrary string/string pairs using <`uvm_message_add_tag>,
521
// integral types along with a radix using <`uvm_message_add_int>, string
522
// using <`uvm_message_add_string> and s using
523
// <`uvm_message_add_object>.
524
//
525
// |`uvm_message_add_object(VAR, LABEL = "", ACTION=(UVM_LOG|UVM_RM_RECORD))
526
//
527
// Example usage is shown in <`uvm_info_end>.
528
//
529
 
530
`define uvm_message_add_object(VAR, LABEL="", ACTION=(UVM_LOG|UVM_RM_RECORD)) \
531
    if (LABEL == "") \
532
      __uvm_msg.add_object(`"VAR`", VAR, ACTION); \
533
    else \
534
      __uvm_msg.add_object(LABEL, VAR, ACTION);
535
 
536
 
537
`endif //UVM_MESSAGE_DEFINES_SVH

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.