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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [uvm_src/] [base/] [uvm_report_handler.svh] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 HanySalah
//
2
//------------------------------------------------------------------------------
3
//   Copyright 2007-2011 Mentor Graphics Corporation
4
//   Copyright 2007-2011 Cadence Design Systems, Inc.
5
//   Copyright 2010 Synopsys, Inc.
6
//   Copyright 2013 NVIDIA Corporation
7
//   All Rights Reserved Worldwide
8
//
9
//   Licensed under the Apache License, Version 2.0 (the
10
//   "License"); you may not use this file except in
11
//   compliance with the License.  You may obtain a copy of
12
//   the License at
13
//
14
//       http://www.apache.org/licenses/LICENSE-2.0
15
//
16
//   Unless required by applicable law or agreed to in
17
//   writing, software distributed under the License is
18
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
19
//   CONDITIONS OF ANY KIND, either express or implied.  See
20
//   the License for the specific language governing
21
//   permissions and limitations under the License.
22
//------------------------------------------------------------------------------
23
 
24
`ifndef UVM_REPORT_HANDLER_SVH
25
`define UVM_REPORT_HANDLER_SVH
26
 
27
typedef class uvm_report_object;
28
typedef class uvm_report_server;
29
typedef uvm_pool#(string, uvm_action) uvm_id_actions_array;
30
typedef uvm_pool#(string, UVM_FILE) uvm_id_file_array;
31
typedef uvm_pool#(string, int) uvm_id_verbosities_array;
32
typedef uvm_pool#(uvm_severity, uvm_severity) uvm_sev_override_array;
33
 
34
//------------------------------------------------------------------------------
35
//
36
// CLASS: uvm_report_handler
37
//
38
// The uvm_report_handler is the class to which most methods in
39
//  delegate. It stores the maximum verbosity, actions,
40
// and files that affect the way reports are handled.
41
//
42
// The report handler is not intended for direct use. See 
43
// for information on the UVM reporting mechanism.
44
//
45
// The relationship between  (a base class for uvm_component)
46
// and uvm_report_handler is typically one to one, but it can be many to one
47
// if several uvm_report_objects are configured to use the same
48
// uvm_report_handler_object. See .
49
//
50
// The relationship between uvm_report_handler and  is many
51
// to one.
52
//
53
//------------------------------------------------------------------------------
54
 
55
class uvm_report_handler extends uvm_object;
56
 
57
  // internal variables
58
 
59
  int m_max_verbosity_level;
60
 
61
  // id verbosity settings : default and severity
62
  uvm_id_verbosities_array id_verbosities;
63
  uvm_id_verbosities_array severity_id_verbosities[uvm_severity];
64
 
65
  // actions
66
  uvm_id_actions_array id_actions;
67
  uvm_action severity_actions[uvm_severity];
68
  uvm_id_actions_array severity_id_actions[uvm_severity];
69
 
70
  // severity overrides
71
  uvm_sev_override_array sev_overrides;
72
  uvm_sev_override_array sev_id_overrides [string];
73
 
74
  // file handles : default, severity, action, (severity,id)
75
  UVM_FILE default_file_handle;
76
  uvm_id_file_array id_file_handles;
77
  UVM_FILE severity_file_handles[uvm_severity];
78
  uvm_id_file_array severity_id_file_handles[uvm_severity];
79
 
80
 
81
  `uvm_object_utils(uvm_report_handler)
82
 
83
 
84
  // Function: new
85
  //
86
  // Creates and initializes a new uvm_report_handler object.
87
 
88
  function new(string name = "uvm_report_handler");
89
    super.new(name);
90
    initialize();
91
  endfunction
92
 
93
 
94
  // Function: print
95
  //
96
  // The uvm_report_handler implements the  such that
97
  // ~print~ method provides UVM printer formatted output
98
  // of the current configuration.  A snippet of example output is shown here:
99
  //
100
  // |uvm_test_top                uvm_report_handler  -     @555
101
  // |  max_verbosity_level       uvm_verbosity       32    UVM_FULL
102
  // |  id_verbosities            uvm_pool            3     -
103
  // |    [ID1]                   uvm_verbosity       32    UVM_LOW
104
  // |  severity_id_verbosities   array               4     -
105
  // |    [UVM_INFO:ID4]          int                 32    501
106
  // |  id_actions                uvm_pool            2     -
107
  // |    [ACT_ID]                uvm_action          32    DISPLAY LOG COUNT
108
  // |  severity_actions          array               4     -
109
  // |    [UVM_INFO]              uvm_action          32    DISPLAY
110
  // |    [UVM_WARNING]           uvm_action          32    DISPLAY RM_RECORD COUNT
111
  // |    [UVM_ERROR]             uvm_action          32    DISPLAY COUNT
112
  // |    [UVM_FATAL]             uvm_action          32    DISPLAY EXIT
113
  // |  default_file_handle       int                 32    'h1
114
 
115
  virtual function void do_print (uvm_printer printer);
116
 
117
    uvm_verbosity l_verbosity;
118
    uvm_severity l_severity;
119
    string idx;
120
    int l_int;
121
 
122
    // max verb
123
    if ($cast(l_verbosity, m_max_verbosity_level))
124
      printer.print_generic("max_verbosity_level", "uvm_verbosity", 32,
125
        l_verbosity.name());
126
    else
127
      printer.print_int("max_verbosity_level", m_max_verbosity_level, 32, UVM_DEC,
128
        ".", "int");
129
 
130
    // id verbs
131
    if(id_verbosities.first(idx)) begin
132
      printer.print_array_header("id_verbosities",id_verbosities.num(),
133
        "uvm_pool");
134
      do begin
135
        l_int = id_verbosities.get(idx);
136
        if ($cast(l_verbosity, l_int))
137
          printer.print_generic($sformatf("[%s]", idx), "uvm_verbosity", 32,
138
            l_verbosity.name());
139
        else begin
140
          string l_str;
141
          l_str.itoa(l_int);
142
          printer.print_generic($sformatf("[%s]", idx), "int", 32,
143
            l_str);
144
        end
145
      end while(id_verbosities.next(idx));
146
      printer.print_array_footer();
147
    end
148
 
149
    // sev and id verbs
150
    if(severity_id_verbosities.size() != 0) begin
151
      int _total_cnt;
152
      foreach (severity_id_verbosities[l_severity])
153
        _total_cnt += severity_id_verbosities[l_severity].num();
154
      printer.print_array_header("severity_id_verbosities", _total_cnt,
155
        "array");
156
      if(severity_id_verbosities.first(l_severity)) begin
157
        do begin
158
          uvm_id_verbosities_array id_v_ary = severity_id_verbosities[l_severity];
159
          if(id_v_ary.first(idx))
160
          do begin
161
            l_int = id_v_ary.get(idx);
162
            if ($cast(l_verbosity, l_int))
163
              printer.print_generic($sformatf("[%s:%s]", l_severity.name(), idx),
164
                                    "uvm_verbosity", 32, l_verbosity.name());
165
            else begin
166
              string l_str;
167
              l_str.itoa(l_int);
168
              printer.print_generic($sformatf("[%s:%s]", l_severity.name(), idx),
169
                                    "int", 32, l_str);
170
            end
171
          end while(id_v_ary.next(idx));
172
        end while(severity_id_verbosities.next(l_severity));
173
      end
174
      printer.print_array_footer();
175
    end
176
 
177
    // id actions
178
    if(id_actions.first(idx)) begin
179
      printer.print_array_header("id_actions",id_actions.num(),
180
        "uvm_pool");
181
      do begin
182
        l_int = id_actions.get(idx);
183
        printer.print_generic($sformatf("[%s]", idx), "uvm_action", 32,
184
          format_action(l_int));
185
      end while(id_actions.next(idx));
186
      printer.print_array_footer();
187
    end
188
 
189
    // severity actions
190
    if(severity_actions.first(l_severity)) begin
191
      printer.print_array_header("severity_actions",4,"array");
192
      do begin
193
        printer.print_generic($sformatf("[%s]", l_severity.name()), "uvm_action", 32,
194
          format_action(severity_actions[l_severity]));
195
      end while(severity_actions.next(l_severity));
196
      printer.print_array_footer();
197
    end
198
 
199
    // sev and id actions
200
    if(severity_id_actions.size() != 0) begin
201
      int _total_cnt;
202
      foreach (severity_id_actions[l_severity])
203
        _total_cnt += severity_id_actions[l_severity].num();
204
      printer.print_array_header("severity_id_actions", _total_cnt,
205
        "array");
206
      if(severity_id_actions.first(l_severity)) begin
207
        do begin
208
          uvm_id_actions_array id_a_ary = severity_id_actions[l_severity];
209
          if(id_a_ary.first(idx))
210
          do begin
211
            printer.print_generic($sformatf("[%s:%s]", l_severity.name(), idx),
212
                                  "uvm_action", 32, format_action(id_a_ary.get(idx)));
213
          end while(id_a_ary.next(idx));
214
        end while(severity_id_actions.next(l_severity));
215
      end
216
      printer.print_array_footer();
217
    end
218
 
219
    // sev overrides
220
    if(sev_overrides.first(l_severity)) begin
221
      printer.print_array_header("sev_overrides",sev_overrides.num(),
222
        "uvm_pool");
223
      do begin
224
        uvm_severity l_severity_new = sev_overrides.get(l_severity);
225
        printer.print_generic($sformatf("[%s]", l_severity.name()),
226
          "uvm_severity", 32, l_severity_new.name());
227
      end while(sev_overrides.next(l_severity));
228
      printer.print_array_footer();
229
    end
230
 
231
    // sev and id overrides
232
    if(sev_id_overrides.size() != 0) begin
233
      int _total_cnt;
234
      foreach (sev_id_overrides[idx])
235
        _total_cnt += sev_id_overrides[idx].num();
236
      printer.print_array_header("sev_id_overrides", _total_cnt,
237
        "array");
238
      if(sev_id_overrides.first(idx)) begin
239
        do begin
240
          uvm_sev_override_array sev_o_ary = sev_id_overrides[idx];
241
          if(sev_o_ary.first(l_severity))
242
          do begin
243
            uvm_severity new_sev = sev_o_ary.get(l_severity);
244
            printer.print_generic($sformatf("[%s:%s]", l_severity.name(), idx),
245
              "uvm_severity", 32, new_sev.name());
246
          end while(sev_o_ary.next(l_severity));
247
        end while(sev_id_overrides.next(idx));
248
      end
249
      printer.print_array_footer();
250
    end
251
 
252
    // default file handle
253
    printer.print_int("default_file_handle", default_file_handle, 32, UVM_HEX,
254
      ".", "int");
255
 
256
    // id files
257
    if(id_file_handles.first(idx)) begin
258
      printer.print_array_header("id_file_handles",id_file_handles.num(),
259
        "uvm_pool");
260
      do begin
261
        printer.print_int($sformatf("[%s]", idx), id_file_handles.get(idx), 32,
262
          UVM_HEX, ".", "UVM_FILE");
263
      end while(id_file_handles.next(idx));
264
      printer.print_array_footer();
265
    end
266
 
267
    // severity files
268
    if(severity_file_handles.first(l_severity)) begin
269
      printer.print_array_header("severity_file_handles",4,"array");
270
      do begin
271
        printer.print_int($sformatf("[%s]", l_severity.name()),
272
          severity_file_handles[l_severity], 32, UVM_HEX, ".", "UVM_FILE");
273
      end while(severity_file_handles.next(l_severity));
274
      printer.print_array_footer();
275
    end
276
 
277
    // sev and id files
278
    if(severity_id_file_handles.size() != 0) begin
279
      int _total_cnt;
280
      foreach (severity_id_file_handles[l_severity])
281
        _total_cnt += severity_id_file_handles[l_severity].num();
282
      printer.print_array_header("severity_id_file_handles", _total_cnt,
283
        "array");
284
      if(severity_id_file_handles.first(l_severity)) begin
285
        do begin
286
          uvm_id_file_array id_f_ary = severity_id_file_handles[l_severity];
287
          if(id_f_ary.first(idx))
288
          do begin
289
            printer.print_int($sformatf("[%s:%s]", l_severity.name(), idx),
290
              id_f_ary.get(idx), 32, UVM_HEX, ".", "UVM_FILE");
291
          end while(id_f_ary.next(idx));
292
        end while(severity_id_file_handles.next(l_severity));
293
      end
294
      printer.print_array_footer();
295
    end
296
 
297
  endfunction
298
 
299
 
300
  //----------------------------------------------------------------------------
301
  // Group: Message Processing
302
  //----------------------------------------------------------------------------
303
 
304
 
305
  // Function: process_report_message
306
  //
307
  // This is the common handler method used by the four core reporting methods
308
  // (e.g. ) in .
309
 
310
  virtual function void process_report_message(uvm_report_message report_message);
311
    process p = process::self();
312
    uvm_report_server srvr = uvm_report_server::get_server();
313
    string id = report_message.get_id();
314
    uvm_severity severity = report_message.get_severity();
315
 
316
    // Check for severity overrides and apply them before calling the server.
317
    // An id specific override has precedence over a generic severity override.
318
    if(sev_id_overrides.exists(id)) begin
319
      if(sev_id_overrides[id].exists(uvm_severity'(severity))) begin
320
        severity = sev_id_overrides[id].get(severity);
321
        report_message.set_severity(severity);
322
      end
323
    end
324
    else begin
325
      if(sev_overrides.exists(severity)) begin
326
        severity = sev_overrides.get(severity);
327
        report_message.set_severity(severity);
328
      end
329
    end
330
    report_message.set_file(get_file_handle(severity, id));
331
    report_message.set_report_handler(this);
332
    report_message.set_action(get_action(severity, id));
333
    srvr.process_report_message(report_message);
334
 
335
  endfunction
336
 
337
 
338
  //----------------------------------------------------------------------------
339
  // Group: Convenience Methods
340
  //----------------------------------------------------------------------------
341
 
342
 
343
  // Function: format_action
344
  //
345
  // Returns a string representation of the ~action~, e.g., "DISPLAY".
346
 
347
  static function string format_action(uvm_action action);
348
    string s;
349
 
350
    if(uvm_action_type'(action) == UVM_NO_ACTION) begin
351
      s = "NO ACTION";
352
    end
353
    else begin
354
      s = "";
355
      if(action & UVM_DISPLAY)   s = {s, "DISPLAY "};
356
      if(action & UVM_LOG)       s = {s, "LOG "};
357
      if(action & UVM_RM_RECORD) s = {s, "RM_RECORD "};
358
      if(action & UVM_COUNT)     s = {s, "COUNT "};
359
      if(action & UVM_CALL_HOOK) s = {s, "CALL_HOOK "};
360
      if(action & UVM_EXIT)      s = {s, "EXIT "};
361
      if(action & UVM_STOP)      s = {s, "STOP "};
362
    end
363
 
364
    return s;
365
  endfunction
366
 
367
 
368
  // Function- initialize
369
  //
370
  // Internal method for initializing report handler.
371
 
372
  function void initialize();
373
 
374
    set_default_file(0);
375
    m_max_verbosity_level = UVM_MEDIUM;
376
 
377
    id_actions=new();
378
    id_verbosities=new();
379
    id_file_handles=new();
380
    sev_overrides=new();
381
 
382
    set_severity_action(UVM_INFO,    UVM_DISPLAY);
383
    set_severity_action(UVM_WARNING, UVM_DISPLAY);
384
    set_severity_action(UVM_ERROR,   UVM_DISPLAY | UVM_COUNT);
385
    set_severity_action(UVM_FATAL,   UVM_DISPLAY | UVM_EXIT);
386
 
387
    set_severity_file(UVM_INFO, default_file_handle);
388
    set_severity_file(UVM_WARNING, default_file_handle);
389
    set_severity_file(UVM_ERROR,   default_file_handle);
390
    set_severity_file(UVM_FATAL,   default_file_handle);
391
 
392
  endfunction
393
 
394
 
395
  // Function- get_severity_id_file
396
  //
397
  // Return the file id based on the severity and the id
398
 
399
  local function UVM_FILE get_severity_id_file(uvm_severity severity, string id);
400
 
401
    uvm_id_file_array array;
402
 
403
    if(severity_id_file_handles.exists(severity)) begin
404
      array = severity_id_file_handles[severity];
405
      if(array.exists(id))
406
        return array.get(id);
407
    end
408
 
409
 
410
    if(id_file_handles.exists(id))
411
      return id_file_handles.get(id);
412
 
413
    if(severity_file_handles.exists(severity))
414
      return severity_file_handles[severity];
415
 
416
    return default_file_handle;
417
 
418
  endfunction
419
 
420
 
421
  // Function- set_verbosity_level
422
  //
423
  // Internal method called by uvm_report_object.
424
 
425
  function void set_verbosity_level(int verbosity_level);
426
    m_max_verbosity_level = verbosity_level;
427
  endfunction
428
 
429
 
430
  // Function- get_verbosity_level
431
  //
432
  // Returns the verbosity associated with the given ~severity~ and ~id~.
433
  //
434
  // First, if there is a verbosity associated with the ~(severity,id)~ pair,
435
  // return that.  Else, if there is a verbosity associated with the ~id~, return
436
  // that.  Else, return the max verbosity setting.
437
 
438
  function int get_verbosity_level(uvm_severity severity=UVM_INFO, string id="" );
439
 
440
    uvm_id_verbosities_array array;
441
    if(severity_id_verbosities.exists(severity)) begin
442
      array = severity_id_verbosities[severity];
443
      if(array.exists(id)) begin
444
        return array.get(id);
445
      end
446
    end
447
 
448
    if(id_verbosities.exists(id)) begin
449
      return id_verbosities.get(id);
450
    end
451
 
452
    return m_max_verbosity_level;
453
 
454
  endfunction
455
 
456
 
457
  // Function- get_action
458
  //
459
  // Returns the action associated with the given ~severity~ and ~id~.
460
  //
461
  // First, if there is an action associated with the ~(severity,id)~ pair,
462
  // return that.  Else, if there is an action associated with the ~id~, return
463
  // that.  Else, if there is an action associated with the ~severity~, return
464
  // that. Else, return the default action associated with the ~severity~.
465
 
466
  function uvm_action get_action(uvm_severity severity, string id);
467
 
468
    uvm_id_actions_array array;
469
    if(severity_id_actions.exists(severity)) begin
470
      array = severity_id_actions[severity];
471
      if(array.exists(id))
472
        return array.get(id);
473
    end
474
 
475
    if(id_actions.exists(id))
476
      return id_actions.get(id);
477
 
478
    return severity_actions[severity];
479
 
480
  endfunction
481
 
482
 
483
  // Function- get_file_handle
484
  //
485
  // Returns the file descriptor associated with the given ~severity~ and ~id~.
486
  //
487
  // First, if there is a file handle associated with the ~(severity,id)~ pair,
488
  // return that. Else, if there is a file handle associated with the ~id~, return
489
  // that. Else, if there is an file handle associated with the ~severity~, return
490
  // that. Else, return the default file handle.
491
 
492
  function UVM_FILE get_file_handle(uvm_severity severity, string id);
493
    UVM_FILE file;
494
 
495
    file = get_severity_id_file(severity, id);
496
    if (file != 0)
497
      return file;
498
 
499
    if (id_file_handles.exists(id)) begin
500
      file = id_file_handles.get(id);
501
      if (file != 0)
502
        return file;
503
    end
504
 
505
    if (severity_file_handles.exists(severity)) begin
506
      file = severity_file_handles[severity];
507
      if(file != 0)
508
        return file;
509
    end
510
 
511
    return default_file_handle;
512
  endfunction
513
 
514
 
515
  // Function- set_severity_action
516
  // Function- set_id_action
517
  // Function- set_severity_id_action
518
  // Function- set_id_verbosity
519
  // Function- set_severity_id_verbosity
520
  //
521
  // Internal methods called by uvm_report_object.
522
 
523
  function void set_severity_action(input uvm_severity severity,
524
                                    input uvm_action action);
525
    severity_actions[severity] = action;
526
  endfunction
527
 
528
  function void set_id_action(input string id, input uvm_action action);
529
    id_actions.add(id, action);
530
  endfunction
531
 
532
  function void set_severity_id_action(uvm_severity severity,
533
                                       string id,
534
                                       uvm_action action);
535
    if(!severity_id_actions.exists(severity))
536
      severity_id_actions[severity] = new;
537
    severity_id_actions[severity].add(id,action);
538
  endfunction
539
 
540
  function void set_id_verbosity(input string id, input int verbosity);
541
    id_verbosities.add(id, verbosity);
542
  endfunction
543
 
544
  function void set_severity_id_verbosity(uvm_severity severity,
545
                                       string id,
546
                                       int verbosity);
547
    if(!severity_id_verbosities.exists(severity))
548
      severity_id_verbosities[severity] = new;
549
    severity_id_verbosities[severity].add(id,verbosity);
550
  endfunction
551
 
552
  // Function- set_default_file
553
  // Function- set_severity_file
554
  // Function- set_id_file
555
  // Function- set_severity_id_file
556
  //
557
  // Internal methods called by uvm_report_object.
558
 
559
  function void set_default_file (UVM_FILE file);
560
    default_file_handle = file;
561
  endfunction
562
 
563
  function void set_severity_file (uvm_severity severity, UVM_FILE file);
564
    severity_file_handles[severity] = file;
565
  endfunction
566
 
567
  function void set_id_file (string id, UVM_FILE file);
568
    id_file_handles.add(id, file);
569
  endfunction
570
 
571
  function void set_severity_id_file(uvm_severity severity,
572
                                     string id, UVM_FILE file);
573
    if(!severity_id_file_handles.exists(severity))
574
      severity_id_file_handles[severity] = new;
575
    severity_id_file_handles[severity].add(id, file);
576
  endfunction
577
 
578
  function void set_severity_override(uvm_severity cur_severity,
579
                                      uvm_severity new_severity);
580
    sev_overrides.add(cur_severity, new_severity);
581
  endfunction
582
 
583
  function void set_severity_id_override(uvm_severity cur_severity,
584
                                         string id,
585
                                         uvm_severity new_severity);
586
    // has precedence over set_severity_override
587
    // silently override previous setting
588
    uvm_sev_override_array arr;
589
    if(!sev_id_overrides.exists(id))
590
      sev_id_overrides[id] = new;
591
 
592
    sev_id_overrides[id].add(cur_severity, new_severity);
593
  endfunction
594
 
595
 
596
 
597
  // Function- report
598
  //
599
  // This is the common handler method used by the four core reporting methods
600
  // (e.g., uvm_report_error) in .
601
 
602
  virtual function void report(
603
      uvm_severity severity,
604
      string name,
605
      string id,
606
      string message,
607
      int verbosity_level=UVM_MEDIUM,
608
      string filename="",
609
      int line=0,
610
      uvm_report_object client=null
611
      );
612
 
613
    bit l_report_enabled = 0;
614
    uvm_report_message l_report_message;
615
    uvm_coreservice_t cs;
616
    cs = uvm_coreservice_t::get();
617
    if (!uvm_report_enabled(verbosity_level, UVM_INFO, id))
618
      return;
619
 
620
    if (client==null)
621
      client = cs.get_root();
622
 
623
    l_report_message = uvm_report_message::new_report_message();
624
    l_report_message.set_report_message(severity, id, message,
625
                                        verbosity_level, filename, line, name);
626
    l_report_message.set_report_object(client);
627
    l_report_message.set_action(get_action(severity,id));
628
    process_report_message(l_report_message);
629
 
630
  endfunction
631
 
632
`ifndef UVM_NO_DEPRECATED
633
 
634
 
635
  // Function- run_hooks
636
  //
637
  // The ~run_hooks~ method is called if the  action is set for a
638
  // report. It first calls the client's  method,
639
  // followed by the appropriate severity-specific hook method. If either
640
  // returns 0, then the report is not processed.
641
 
642
  virtual function bit run_hooks(uvm_report_object client,
643
                                 uvm_severity severity,
644
                                 string id,
645
                                 string message,
646
                                 int verbosity,
647
                                 string filename,
648
                                 int line);
649
 
650
    bit ok;
651
 
652
    ok = client.report_hook(id, message, verbosity, filename, line);
653
 
654
    case(severity)
655
      UVM_INFO:
656
       ok &= client.report_info_hook   (id, message, verbosity, filename, line);
657
      UVM_WARNING:
658
       ok &= client.report_warning_hook(id, message, verbosity, filename, line);
659
      UVM_ERROR:
660
       ok &= client.report_error_hook  (id, message, verbosity, filename, line);
661
      UVM_FATAL:
662
       ok &= client.report_fatal_hook  (id, message, verbosity, filename, line);
663
    endcase
664
 
665
    return ok;
666
 
667
  endfunction
668
 
669
 
670
  // Function- dump_state
671
  //
672
  // Internal method for debug.
673
 
674
  function void dump_state();
675
 
676
    string s;
677
    UVM_FILE file;
678
    uvm_action a;
679
    string idx;
680
    string q[$];
681
 
682
    uvm_id_actions_array id_a_ary;
683
    uvm_id_verbosities_array id_v_ary;
684
    uvm_id_file_array id_f_ary;
685
 
686
    q.push_back("\n----------------------------------------------------------------------\n");
687
    q.push_back("report handler state dump \n\n");
688
 
689
    // verbosities
690
 
691
    q.push_back("\n+-----------------+\n");
692
    q.push_back("|   Verbosities   |\n");
693
    q.push_back("+-----------------+\n\n");
694
 
695
    q.push_back($sformatf("max verbosity level = %d\n", m_max_verbosity_level));
696
    q.push_back("*** verbosities by id\n");
697
 
698
    if(id_verbosities.first(idx))
699
    do begin
700
      uvm_verbosity v = uvm_verbosity'(id_verbosities.get(idx));
701
      q.push_back($sformatf("[%s] --> %s\n", idx, v.name()));
702
    end while(id_verbosities.next(idx));
703
 
704
    // verbosities by id
705
 
706
    q.push_back("*** verbosities by id and severity\n");
707
 
708
    foreach( severity_id_verbosities[severity] ) begin
709
      uvm_severity sev = uvm_severity'(severity);
710
      id_v_ary = severity_id_verbosities[severity];
711
      if(id_v_ary.first(idx))
712
      do begin
713
        uvm_verbosity v = uvm_verbosity'(id_v_ary.get(idx));
714
        q.push_back($sformatf("%s:%s --> %s\n",sev.name(), idx, v.name()));
715
      end while(id_v_ary.next(idx));
716
    end
717
 
718
    // actions
719
 
720
    q.push_back("\n+-------------+\n");
721
    q.push_back("|   actions   |\n");
722
    q.push_back("+-------------+\n\n");
723
 
724
    q.push_back("*** actions by severity\n");
725
    foreach( severity_actions[severity] ) begin
726
      uvm_severity sev = uvm_severity'(severity);
727
      q.push_back($sformatf("%s = %s\n",sev.name(), format_action(severity_actions[severity])));
728
    end
729
 
730
    q.push_back("\n*** actions by id\n");
731
 
732
    if(id_actions.first(idx))
733
    do begin
734
      q.push_back($sformatf("[%s] --> %s\n", idx, format_action(id_actions.get(idx))));
735
    end while(id_actions.next(idx));
736
 
737
    // actions by id
738
    q.push_back("\n*** actions by id and severity\n");
739
 
740
    foreach( severity_id_actions[severity] ) begin
741
      uvm_severity sev = uvm_severity'(severity);
742
      id_a_ary = severity_id_actions[severity];
743
      if(id_a_ary.first(idx))
744
      do begin
745
        q.push_back($sformatf("%s:%s --> %s\n",sev.name(), idx, format_action(id_a_ary.get(idx))));
746
      end while(id_a_ary.next(idx));
747
    end
748
 
749
    // Files
750
 
751
    q.push_back("\n+-------------+\n");
752
    q.push_back("|    files    |\n");
753
    q.push_back("+-------------+\n\n");
754
 
755
    q.push_back($sformatf("default file handle = %d\n\n", default_file_handle));
756
 
757
    q.push_back("*** files by severity\n");
758
    foreach( severity_file_handles[severity] ) begin
759
      uvm_severity sev = uvm_severity'(severity);
760
      file = severity_file_handles[severity];
761
      q.push_back($sformatf("%s = %d\n", sev.name(), file));
762
    end
763
 
764
    q.push_back("\n*** files by id\n");
765
 
766
    if(id_file_handles.first(idx))
767
    do begin
768
      file = id_file_handles.get(idx);
769
      q.push_back($sformatf("id %s --> %d\n", idx, file));
770
    end while (id_file_handles.next(idx));
771
 
772
    q.push_back("\n*** files by id and severity\n");
773
 
774
    foreach( severity_id_file_handles[severity] ) begin
775
      uvm_severity sev = uvm_severity'(severity);
776
      id_f_ary = severity_id_file_handles[severity];
777
      if(id_f_ary.first(idx))
778
      do begin
779
        q.push_back($sformatf("%s:%s --> %d\n", sev.name(), idx, id_f_ary.get(idx)));
780
      end while(id_f_ary.next(idx));
781
    end
782
 
783
    begin
784
                uvm_report_server srvr;
785
            srvr=uvm_report_server::get_server();
786
        srvr.report_summarize();
787
    end
788
 
789
    q.push_back("----------------------------------------------------------------------\n");
790
        `uvm_info("UVM/REPORT/HANDLER",`UVM_STRING_QUEUE_STREAMING_PACK(q),UVM_LOW)
791
  endfunction
792
 
793
 
794
`endif
795
 
796
 
797
endclass : uvm_report_handler
798
 
799
`endif //UVM_REPORT_HANDLER_SVH

powered by: WebSVN 2.1.0

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