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

Subversion Repositories uart2bus_testbench

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 HanySalah
//
2
//------------------------------------------------------------------------------
3
//   Copyright 2007-2010 Mentor Graphics Corporation
4
//   Copyright 2007-2011 Cadence Design Systems, Inc.
5
//   Copyright 2010 Synopsys, Inc.
6
//   Copyright 2014 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_SERVER_SVH
25
`define UVM_REPORT_SERVER_SVH
26
 
27
typedef class uvm_report_object;
28
 
29
//------------------------------------------------------------------------------
30
// Title: UVM Report Server
31
//
32
// This page covers the classes that define the UVM report server facility.
33
//------------------------------------------------------------------------------
34
 
35
//------------------------------------------------------------------------------
36
//
37
// CLASS: uvm_report_server
38
//
39
// uvm_report_server is a global server that processes all of the reports
40
// generated by a uvm_report_handler.
41
//
42
// The ~uvm_report_server~ is an abstract class which declares many of its methods
43
// as ~pure virtual~.  The UVM uses the  class
44
// as its default report server implementation.
45
//------------------------------------------------------------------------------
46
 
47
typedef class uvm_default_report_server;
48
virtual class uvm_report_server extends uvm_object;
49
        function string get_type_name();
50
                return "uvm_report_server";
51
        endfunction
52
        function new(string name="base");
53
                super.new(name);
54
        endfunction
55
 
56
        // Function: set_max_quit_count
57
        // ~count~ is the maximum number of ~UVM_QUIT~ actions the uvm_report_server
58
        // will tolerate before invoking client.die().
59
        // when ~overridable~ = 0 is passed, the set quit count cannot be changed again
60
        pure virtual  function void set_max_quit_count(int count, bit overridable = 1);
61
 
62
        // Function: get_max_quit_count
63
        // returns the currently configured max quit count
64
        pure virtual  function int get_max_quit_count();
65
 
66
        // Function: set_quit_count
67
        // sets the current number of ~UVM_QUIT~ actions already passed through this uvm_report_server
68
        pure virtual  function void set_quit_count(int quit_count);
69
 
70
        // Function: get_quit_count
71
        // returns the current number of ~UVM_QUIT~ actions already passed through this server
72
        pure virtual  function int get_quit_count();
73
 
74
        // Function: set_severity_count
75
        // sets the count of already passed messages with severity ~severity~ to ~count~
76
        pure virtual  function void set_severity_count(uvm_severity severity, int count);
77
        // Function: get_severity_count
78
        // returns the count of already passed messages with severity ~severity~
79
        pure virtual  function int get_severity_count(uvm_severity severity);
80
 
81
        // Function: set_id_count
82
        // sets the count of already passed messages with ~id~ to ~count~
83
        pure virtual  function void set_id_count(string id, int count);
84
 
85
        // Function: get_id_count
86
        // returns the count of already passed messages with ~id~
87
        pure virtual  function int get_id_count(string id);
88
 
89
 
90
        // Function: get_id_set
91
        // returns the set of id's already used by this uvm_report_server
92
        pure virtual function void get_id_set(output string q[$]);
93
 
94
        // Function: get_severity_set
95
        // returns the set of severities already used by this uvm_report_server
96
        pure virtual function void get_severity_set(output uvm_severity q[$]);
97
 
98
        // Function: set_message_database
99
        // sets the  used for recording messages
100
        pure virtual function void set_message_database(uvm_tr_database database);
101
 
102
        // Function: get_message_database
103
        // returns the  used for recording messages
104
        pure virtual function uvm_tr_database get_message_database();
105
 
106
        // Function: do_copy
107
        // copies all message statistic severity,id counts to the destination uvm_report_server
108
        // the copy is cummulative (only items from the source are transferred, already existing entries are not deleted,
109
        // existing entries/counts are overridden when they exist in the source set)
110
        function void do_copy (uvm_object rhs);
111
                uvm_report_server rhs_;
112
 
113
                super.do_copy(rhs);
114
                if(!$cast(rhs_,rhs)) `uvm_error("UVM/REPORT/SERVER/RPTCOPY","cannot copy to report_server from the given datatype")
115
 
116
                begin
117
                        uvm_severity q[$];
118
                        rhs_.get_severity_set(q);
119
                        foreach(q[s])
120
                                set_severity_count(q[s],rhs_.get_severity_count(q[s]));
121
                end
122
 
123
                begin
124
                        string q[$];
125
                        rhs_.get_id_set(q);
126
                        foreach(q[s])
127
                                set_id_count(q[s],rhs_.get_id_count(q[s]));
128
                end
129
 
130
                set_message_database(rhs_.get_message_database());
131
                set_max_quit_count(rhs_.get_max_quit_count());
132
                set_quit_count(rhs_.get_quit_count());
133
        endfunction
134
 
135
 
136
        // Function- process_report_message
137
        //
138
        // Main entry for uvm_report_server, combines execute_report_message and compose_report_message
139
 
140
        pure virtual function void process_report_message(uvm_report_message report_message);
141
 
142
 
143
        // Function: execute_report_message
144
        //
145
        // Processes the provided message per the actions contained within.
146
        //
147
        // Expert users can overload this method to customize action processing.
148
 
149
        pure virtual function void execute_report_message(uvm_report_message report_message,
150
                                                          string composed_message);
151
 
152
 
153
        // Function: compose_report_message
154
        //
155
        // Constructs the actual string sent to the file or command line
156
        // from the severity, component name, report id, and the message itself.
157
        //
158
        // Expert users can overload this method to customize report formatting.
159
 
160
        pure virtual function string compose_report_message(uvm_report_message report_message,
161
                                                            string report_object_name = "");
162
 
163
 
164
        // Function: report_summarize
165
        //
166
        // Outputs statistical information on the reports issued by this central report
167
        // server. This information will be sent to the command line if ~file~ is 0, or
168
        // to the file descriptor ~file~ if it is not 0.
169
        //
170
        // The  method in uvm_top calls this method.
171
 
172
        pure virtual function void report_summarize(UVM_FILE file = 0);
173
 
174
 
175
`ifndef UVM_NO_DEPRECATED
176
 
177
        // Function- summarize
178
        //
179
 
180
        virtual function void summarize(UVM_FILE file=0);
181
          report_summarize(file);
182
        endfunction
183
 
184
`endif
185
 
186
        // Function: set_server
187
        //
188
        // Sets the global report server to use for reporting.
189
        //
190
        // This method is provided as a convenience wrapper around
191
        // setting the report server via the 
192
        // method.
193
        //
194
        // In addition to setting the server this also copies the severity/id counts
195
        // from the current report_server to the new one
196
        //
197
        // | // Using the uvm_coreservice_t:
198
        // | uvm_coreservice_t cs;
199
        // | cs = uvm_coreservice_t::get();
200
        // | your_server.copy(cs.get_report_server());
201
        // | cs.set_report_server(your_server);
202
        // |
203
        // | // Not using the uvm_coreservice_t:
204
        // | uvm_report_server::set_server(your_server);
205
 
206
        static function void set_server(uvm_report_server server);
207
                uvm_coreservice_t cs = uvm_coreservice_t::get();
208
                server.copy(cs.get_report_server());
209
                cs.set_report_server(server);
210
        endfunction
211
 
212
 
213
        // Function: get_server
214
        //
215
        // Gets the global report server used for reporting.
216
        //
217
        // This method is provided as a convenience wrapper
218
        // around retrieving the report server via the 
219
        // method.
220
        //
221
        // | // Using the uvm_coreservice_t:
222
        // | uvm_coreservice_t cs;
223
        // | uvm_report_server rs;
224
        // | cs = uvm_coreservice_t::get();
225
        // | rs = cs.get_report_server();
226
        // |
227
        // | // Not using the uvm_coreservice_t:
228
        // | uvm_report_server rs;
229
        // | rs = uvm_report_server::get_server();
230
        //
231
 
232
        static function uvm_report_server get_server();
233
                uvm_coreservice_t cs = uvm_coreservice_t::get();
234
                return cs.get_report_server();
235
        endfunction
236
endclass
237
 
238
//------------------------------------------------------------------------------
239
//
240
// CLASS: uvm_default_report_server
241
//
242
// Default implementation of the UVM report server.
243
//
244
 
245
class uvm_default_report_server extends uvm_report_server;
246
 
247
  local int m_quit_count;
248
  local int m_max_quit_count;
249
  bit max_quit_overridable = 1;
250
  local int m_severity_count[uvm_severity];
251
  protected int m_id_count[string];
252
   protected uvm_tr_database m_message_db;
253
   protected uvm_tr_stream m_streams[string][string]; // ro.name,rh.name
254
 
255
 
256
  // Variable: enable_report_id_count_summary
257
  //
258
  // A flag to enable report count summary for each ID
259
  //
260
  bit enable_report_id_count_summary=1;
261
 
262
 
263
  // Variable: record_all_messages
264
  //
265
  // A flag to force recording of all messages (add UVM_RM_RECORD action)
266
  //
267
  bit record_all_messages = 0;
268
 
269
 
270
  // Variable: show_verbosity
271
  //
272
  // A flag to include verbosity in the messages, e.g.
273
  //
274
  // "UVM_INFO(UVM_MEDIUM) file.v(3) @ 60: reporter [ID0] Message 0"
275
  //
276
  bit show_verbosity = 0;
277
 
278
 
279
  // Variable: show_terminator
280
  //
281
  // A flag to add a terminator in the messages, e.g.
282
  //
283
  // "UVM_INFO file.v(3) @ 60: reporter [ID0] Message 0 -UVM_INFO"
284
  //
285
  bit show_terminator = 0;
286
 
287
  // Needed for callbacks
288
  function string get_type_name();
289
    return "uvm_default_report_server";
290
  endfunction
291
 
292
 
293
  // Function: new
294
  //
295
  // Creates an instance of the class.
296
 
297
  function new(string name = "uvm_report_server");
298
    super.new(name);
299
    set_max_quit_count(0);
300
    reset_quit_count();
301
    reset_severity_counts();
302
  endfunction
303
 
304
 
305
  // Function: print
306
  //
307
  // The uvm_report_server implements the  such that
308
  // ~print~ method provides UVM printer formatted output
309
  // of the current configuration.  A snippet of example output is shown here:
310
  //
311
  // |uvm_report_server                 uvm_report_server  -     @13
312
  // |  quit_count                      int                32    'd0
313
  // |  max_quit_count                  int                32    'd5
314
  // |  max_quit_overridable            bit                1     'b1
315
  // |  severity_count                  severity counts    4     -
316
  // |    [UVM_INFO]                    integral           32    'd4
317
  // |    [UVM_WARNING]                 integral           32    'd2
318
  // |    [UVM_ERROR]                   integral           32    'd50
319
  // |    [UVM_FATAL]                   integral           32    'd10
320
  // |  id_count                        id counts          4     -
321
  // |    [ID1]                         integral           32    'd1
322
  // |    [ID2]                         integral           32    'd2
323
  // |    [RNTST]                       integral           32    'd1
324
  // |  enable_report_id_count_summary  bit                1     'b1
325
  // |  record_all_messages             bit                1     `b0
326
  // |  show_verbosity                  bit                1     `b0
327
  // |  show_terminator                 bit                1     `b0
328
 
329
 
330
  // Print to show report server state
331
  virtual function void do_print (uvm_printer printer);
332
 
333
    uvm_severity l_severity_count_index;
334
    string l_id_count_index;
335
 
336
    printer.print_int("quit_count", m_quit_count, $bits(m_quit_count), UVM_DEC,
337
      ".", "int");
338
    printer.print_int("max_quit_count", m_max_quit_count,
339
      $bits(m_max_quit_count), UVM_DEC, ".", "int");
340
    printer.print_int("max_quit_overridable", max_quit_overridable,
341
      $bits(max_quit_overridable), UVM_BIN, ".", "bit");
342
 
343
    if (m_severity_count.first(l_severity_count_index)) begin
344
      printer.print_array_header("severity_count",m_severity_count.size(),"severity counts");
345
      do
346
        printer.print_int($sformatf("[%s]",l_severity_count_index.name()),
347
          m_severity_count[l_severity_count_index], 32, UVM_DEC);
348
      while (m_severity_count.next(l_severity_count_index));
349
      printer.print_array_footer();
350
    end
351
 
352
    if (m_id_count.first(l_id_count_index)) begin
353
      printer.print_array_header("id_count",m_id_count.size(),"id counts");
354
      do
355
        printer.print_int($sformatf("[%s]",l_id_count_index),
356
          m_id_count[l_id_count_index], 32, UVM_DEC);
357
      while (m_id_count.next(l_id_count_index));
358
      printer.print_array_footer();
359
    end
360
 
361
    printer.print_int("enable_report_id_count_summary", enable_report_id_count_summary,
362
      $bits(enable_report_id_count_summary), UVM_BIN, ".", "bit");
363
    printer.print_int("record_all_messages", record_all_messages,
364
      $bits(record_all_messages), UVM_BIN, ".", "bit");
365
    printer.print_int("show_verbosity", show_verbosity,
366
      $bits(show_verbosity), UVM_BIN, ".", "bit");
367
    printer.print_int("show_terminator", show_terminator,
368
      $bits(show_terminator), UVM_BIN, ".", "bit");
369
 
370
  endfunction
371
 
372
 
373
  //----------------------------------------------------------------------------
374
  // Group: Quit Count
375
  //----------------------------------------------------------------------------
376
 
377
 
378
  // Function: get_max_quit_count
379
 
380
  function int get_max_quit_count();
381
    return m_max_quit_count;
382
  endfunction
383
 
384
  // Function: set_max_quit_count
385
  //
386
  // Get or set the maximum number of COUNT actions that can be tolerated
387
  // before a UVM_EXIT action is taken. The default is 0, which specifies
388
  // no maximum.
389
 
390
  function void set_max_quit_count(int count, bit overridable = 1);
391
    if (max_quit_overridable == 0) begin
392
      uvm_report_info("NOMAXQUITOVR",
393
        $sformatf("The max quit count setting of %0d is not overridable to %0d due to a previous setting.",
394
        m_max_quit_count, count), UVM_NONE);
395
      return;
396
    end
397
    max_quit_overridable = overridable;
398
    m_max_quit_count = count < 0 ? 0 : count;
399
  endfunction
400
 
401
 
402
  // Function: get_quit_count
403
 
404
  function int get_quit_count();
405
    return m_quit_count;
406
  endfunction
407
 
408
  // Function: set_quit_count
409
 
410
  function void set_quit_count(int quit_count);
411
    m_quit_count = quit_count < 0 ? 0 : quit_count;
412
  endfunction
413
 
414
  // Function: incr_quit_count
415
 
416
  function void incr_quit_count();
417
    m_quit_count++;
418
  endfunction
419
 
420
  // Function: reset_quit_count
421
  //
422
  // Set, get, increment, or reset to 0 the quit count, i.e., the number of
423
  // COUNT actions issued.
424
 
425
  function void reset_quit_count();
426
    m_quit_count = 0;
427
  endfunction
428
 
429
  // Function: is_quit_count_reached
430
  //
431
  // If is_quit_count_reached returns 1, then the quit counter has reached
432
  // the maximum.
433
 
434
  function bit is_quit_count_reached();
435
    return (m_quit_count >= m_max_quit_count);
436
  endfunction
437
 
438
 
439
  //----------------------------------------------------------------------------
440
  // Group: Severity Count
441
  //----------------------------------------------------------------------------
442
 
443
 
444
  // Function: get_severity_count
445
 
446
  function int get_severity_count(uvm_severity severity);
447
    return m_severity_count[severity];
448
  endfunction
449
 
450
  // Function: set_severity_count
451
 
452
  function void set_severity_count(uvm_severity severity, int count);
453
    m_severity_count[severity] = count < 0 ? 0 : count;
454
  endfunction
455
 
456
  // Function: incr_severity_count
457
 
458
  function void incr_severity_count(uvm_severity severity);
459
    m_severity_count[severity]++;
460
  endfunction
461
 
462
  // Function: reset_severity_counts
463
  //
464
  // Set, get, or increment the counter for the given severity, or reset
465
  // all severity counters to 0.
466
 
467
  function void reset_severity_counts();
468
    uvm_severity s;
469
    s = s.first();
470
    forever begin
471
      m_severity_count[s] = 0;
472
      if(s == s.last()) break;
473
      s = s.next();
474
    end
475
  endfunction
476
 
477
 
478
  //----------------------------------------------------------------------------
479
  // Group: id Count
480
  //----------------------------------------------------------------------------
481
 
482
 
483
  // Function: get_id_count
484
 
485
  function int get_id_count(string id);
486
    if(m_id_count.exists(id))
487
      return m_id_count[id];
488
    return 0;
489
  endfunction
490
 
491
  // Function: set_id_count
492
 
493
  function void set_id_count(string id, int count);
494
    m_id_count[id] = count < 0 ? 0 : count;
495
  endfunction
496
 
497
  // Function: incr_id_count
498
  //
499
  // Set, get, or increment the counter for reports with the given id.
500
 
501
  function void incr_id_count(string id);
502
    if(m_id_count.exists(id))
503
      m_id_count[id]++;
504
    else
505
      m_id_count[id] = 1;
506
  endfunction
507
 
508
  //----------------------------------------------------------------------------
509
  // Group: message recording
510
  //
511
  // The ~uvm_default_report_server~ will record messages into the message
512
  // database, using one transaction per message, and one stream per report
513
  // object/handler pair.
514
  //
515
  //----------------------------------------------------------------------------
516
 
517
   // Function: set_message_database
518
   // sets the  used for recording messages
519
   virtual function void set_message_database(uvm_tr_database database);
520
      m_message_db = database;
521
   endfunction : set_message_database
522
 
523
   // Function: get_message_database
524
   // returns the  used for recording messages
525
   //
526
   virtual function uvm_tr_database get_message_database();
527
      return m_message_db;
528
   endfunction : get_message_database
529
 
530
 
531
  virtual function void get_severity_set(output uvm_severity q[$]);
532
    foreach(m_severity_count[idx])
533
      q.push_back(idx);
534
  endfunction
535
 
536
 
537
  virtual function void get_id_set(output string q[$]);
538
    foreach(m_id_count[idx])
539
      q.push_back(idx);
540
  endfunction
541
 
542
 
543
  // Function- f_display
544
  //
545
  // This method sends string severity to the command line if file is 0 and to
546
  // the file(s) specified by file if it is not 0.
547
 
548
  function void f_display(UVM_FILE file, string str);
549
    if (file == 0)
550
      $display("%s", str);
551
    else
552
      $fdisplay(file, "%s", str);
553
  endfunction
554
 
555
 
556
  // Function- process_report_message
557
  //
558
  //
559
 
560
  virtual function void process_report_message(uvm_report_message report_message);
561
 
562
    uvm_report_handler l_report_handler = report_message.get_report_handler();
563
        process p = process::self();
564
    bit report_ok = 1;
565
 
566
    // Set the report server for this message
567
    report_message.set_report_server(this);
568
 
569
`ifndef UVM_NO_DEPRECATED
570
 
571
    // The hooks can do additional filtering.  If the hook function
572
    // return 1 then continue processing the report.  If the hook
573
    // returns 0 then skip processing the report.
574
 
575
    if(report_message.get_action() & UVM_CALL_HOOK)
576
      report_ok = l_report_handler.run_hooks(
577
        report_message.get_report_object(),
578
        report_message.get_severity(),
579
        report_message.get_id(),
580
        report_message.get_message(),
581
        report_message.get_verbosity(),
582
        report_message.get_filename(),
583
        report_message.get_line());
584
 
585
`endif
586
 
587
    if(report_ok)
588
      report_ok = uvm_report_catcher::process_all_report_catchers(report_message);
589
 
590
    if(uvm_action_type'(report_message.get_action()) == UVM_NO_ACTION)
591
      report_ok = 0;
592
 
593
    if(report_ok) begin
594
      string m;
595
      uvm_coreservice_t cs = uvm_coreservice_t::get();
596
      // give the global server a chance to intercept the calls
597
      uvm_report_server svr = cs.get_report_server();
598
 
599
`ifdef UVM_DEPRECATED_REPORTING
600
 
601
      // no need to compose when neither UVM_DISPLAY nor UVM_LOG is set
602
      if (report_message.get_action() & (UVM_LOG|UVM_DISPLAY))
603
        m = compose_message(report_message.get_severity(),
604
                              l_report_handler.get_full_name(),
605
                              report_message.get_id(),
606
                              report_message.get_message(),
607
                              report_message.get_filename(),
608
                              report_message.get_line());
609
 
610
      process_report(report_message.get_severity(),
611
                         l_report_handler.get_full_name(),
612
                         report_message.get_id(),
613
                         report_message.get_message(),
614
                         report_message.get_action(),
615
                         report_message.get_file(),
616
                         report_message.get_filename(),
617
                         report_message.get_line(),
618
                         m,
619
                         report_message.get_verbosity(),
620
                         report_message.get_report_object());
621
 
622
`else
623
 
624
      // no need to compose when neither UVM_DISPLAY nor UVM_LOG is set
625
      if (report_message.get_action() & (UVM_LOG|UVM_DISPLAY))
626
        m = svr.compose_report_message(report_message);
627
 
628
      svr.execute_report_message(report_message, m);
629
 
630
`endif
631
    end
632
 
633
  endfunction
634
 
635
 
636
  //----------------------------------------------------------------------------
637
  // Group: Message Processing
638
  //----------------------------------------------------------------------------
639
 
640
 
641
  // Function: execute_report_message
642
  //
643
  // Processes the provided message per the actions contained within.
644
  //
645
  // Expert users can overload this method to customize action processing.
646
 
647
  virtual function void execute_report_message(uvm_report_message report_message,
648
                                               string composed_message);
649
 
650
                                               process p = process::self();
651
 
652
    // Update counts
653
    incr_severity_count(report_message.get_severity());
654
    incr_id_count(report_message.get_id());
655
 
656
    if (record_all_messages)
657
      report_message.set_action(report_message.get_action() | UVM_RM_RECORD);
658
 
659
    // UVM_RM_RECORD action
660
    if(report_message.get_action() & UVM_RM_RECORD) begin
661
       uvm_tr_stream stream;
662
       uvm_report_object ro = report_message.get_report_object();
663
       uvm_report_handler rh = report_message.get_report_handler();
664
 
665
       // Check for pre-existing stream
666
       if (m_streams.exists(ro.get_name()) && (m_streams[ro.get_name()].exists(rh.get_name())))
667
         stream = m_streams[ro.get_name()][rh.get_name()];
668
 
669
       // If no pre-existing stream (or for some reason pre-existing stream was ~null~)
670
       if (stream == null) begin
671
          uvm_tr_database db;
672
 
673
          // Grab the database
674
          db = get_message_database();
675
 
676
          // If database is ~null~, use the default database
677
          if (db == null) begin
678
             uvm_coreservice_t cs = uvm_coreservice_t::get();
679
             db = cs.get_default_tr_database();
680
          end
681
          if (db != null) begin
682
             // Open the stream.  Name=report object name, scope=report handler name, type=MESSAGES
683
             stream = db.open_stream(ro.get_name(), rh.get_name(), "MESSAGES");
684
             // Save off the openned stream
685
             m_streams[ro.get_name()][rh.get_name()] = stream;
686
          end
687
       end
688
       if (stream != null) begin
689
          uvm_recorder recorder = stream.open_recorder(report_message.get_name(),,report_message.get_type_name());
690
             if (recorder != null) begin
691
             report_message.record(recorder);
692
             recorder.free();
693
          end
694
       end
695
    end
696
 
697
    // DISPLAY action
698
    if(report_message.get_action() & UVM_DISPLAY)
699
      $display("%s", composed_message);
700
 
701
    // LOG action
702
    // if log is set we need to send to the file but not resend to the
703
    // display. So, we need to mask off stdout for an mcd or we need
704
    // to ignore the stdout file handle for a file handle.
705
    if(report_message.get_action() & UVM_LOG)
706
      if( (report_message.get_file() == 0) ||
707
        (report_message.get_file() != 32'h8000_0001) ) begin //ignore stdout handle
708
        UVM_FILE tmp_file = report_message.get_file();
709
        if((report_message.get_file() & 32'h8000_0000) == 0) begin //is an mcd so mask off stdout
710
          tmp_file = report_message.get_file() & 32'hffff_fffe;
711
        end
712
      f_display(tmp_file, composed_message);
713
    end
714
 
715
    // Process the UVM_COUNT action
716
    if(report_message.get_action() & UVM_COUNT) begin
717
      if(get_max_quit_count() != 0) begin
718
        incr_quit_count();
719
        // If quit count is reached, add the UVM_EXIT action.
720
        if(is_quit_count_reached()) begin
721
          report_message.set_action(report_message.get_action() | UVM_EXIT);
722
        end
723
      end
724
    end
725
 
726
    // Process the UVM_EXIT action
727
    if(report_message.get_action() & UVM_EXIT) begin
728
       uvm_root l_root;
729
       uvm_coreservice_t cs;
730
       cs = uvm_coreservice_t::get();
731
       l_root = cs.get_root();
732
       l_root.die();
733
    end
734
 
735
    // Process the UVM_STOP action
736
    if (report_message.get_action() & UVM_STOP)
737
      $stop;
738
 
739
  endfunction
740
 
741
 
742
  // Function: compose_report_message
743
  //
744
  // Constructs the actual string sent to the file or command line
745
  // from the severity, component name, report id, and the message itself.
746
  //
747
  // Expert users can overload this method to customize report formatting.
748
 
749
  virtual function string compose_report_message(uvm_report_message report_message,
750
                                                 string report_object_name = "");
751
 
752
    string sev_string;
753
    uvm_severity l_severity;
754
    uvm_verbosity l_verbosity;
755
    string filename_line_string;
756
    string time_str;
757
    string line_str;
758
    string context_str;
759
    string verbosity_str;
760
    string terminator_str;
761
    string msg_body_str;
762
    uvm_report_message_element_container el_container;
763
    string prefix;
764
    uvm_report_handler l_report_handler;
765
 
766
    l_severity = report_message.get_severity();
767
    sev_string = l_severity.name();
768
 
769
    if (report_message.get_filename() != "") begin
770
      line_str.itoa(report_message.get_line());
771
      filename_line_string = {report_message.get_filename(), "(", line_str, ") "};
772
    end
773
 
774
    // Make definable in terms of units.
775
    $swrite(time_str, "%0t", $time);
776
 
777
    if (report_message.get_context() != "")
778
      context_str = {"@@", report_message.get_context()};
779
 
780
    if (show_verbosity) begin
781
      if ($cast(l_verbosity, report_message.get_verbosity()))
782
        verbosity_str = l_verbosity.name();
783
      else
784
        verbosity_str.itoa(report_message.get_verbosity());
785
      verbosity_str = {"(", verbosity_str, ")"};
786
    end
787
 
788
    if (show_terminator)
789
      terminator_str = {" -",sev_string};
790
 
791
    el_container = report_message.get_element_container();
792
    if (el_container.size() == 0)
793
      msg_body_str = report_message.get_message();
794
    else begin
795
      prefix = uvm_default_printer.knobs.prefix;
796
      uvm_default_printer.knobs.prefix = " +";
797
      msg_body_str = {report_message.get_message(), "\n", el_container.sprint()};
798
      uvm_default_printer.knobs.prefix = prefix;
799
    end
800
 
801
    if (report_object_name == "") begin
802
      l_report_handler = report_message.get_report_handler();
803
      report_object_name = l_report_handler.get_full_name();
804
    end
805
 
806
    compose_report_message = {sev_string, verbosity_str, " ", filename_line_string, "@ ",
807
      time_str, ": ", report_object_name, context_str,
808
      " [", report_message.get_id(), "] ", msg_body_str, terminator_str};
809
 
810
  endfunction
811
 
812
 
813
  // Function: report_summarize
814
  //
815
  // Outputs statistical information on the reports issued by this central report
816
  // server. This information will be sent to the command line if ~file~ is 0, or
817
  // to the file descriptor ~file~ if it is not 0.
818
  //
819
  // The  method in uvm_top calls this method.
820
 
821
  virtual function void report_summarize(UVM_FILE file = 0);
822
    string id;
823
    string name;
824
    string output_str;
825
    string q[$];
826
 
827
    uvm_report_catcher::summarize();
828
    q.push_back("\n--- UVM Report Summary ---\n\n");
829
 
830
    if(m_max_quit_count != 0) begin
831
      if ( m_quit_count >= m_max_quit_count )
832
        q.push_back("Quit count reached!\n");
833
      q.push_back($sformatf("Quit count : %5d of %5d\n",m_quit_count, m_max_quit_count));
834
    end
835
 
836
    q.push_back("** Report counts by severity\n");
837
    foreach(m_severity_count[s]) begin
838
      q.push_back($sformatf("%s :%5d\n", s.name(), m_severity_count[s]));
839
    end
840
 
841
    if (enable_report_id_count_summary) begin
842
      q.push_back("** Report counts by id\n");
843
      foreach(m_id_count[id])
844
        q.push_back($sformatf("[%s] %5d\n", id, m_id_count[id]));
845
    end
846
 
847
    `uvm_info("UVM/REPORT/SERVER",`UVM_STRING_QUEUE_STREAMING_PACK(q),UVM_LOW)
848
  endfunction
849
 
850
 
851
`ifndef UVM_NO_DEPRECATED
852
 
853
  // Function- process_report
854
  //
855
  // Calls  to construct the actual message to be
856
  // output. It then takes the appropriate action according to the value of
857
  // action and file.
858
  //
859
  // This method can be overloaded by expert users to customize the way the
860
  // reporting system processes reports and the actions enabled for them.
861
 
862
  virtual function void process_report(
863
      uvm_severity severity,
864
      string name,
865
      string id,
866
      string message,
867
      uvm_action action,
868
      UVM_FILE file,
869
      string filename,
870
      int line,
871
      string composed_message,
872
      int verbosity_level,
873
      uvm_report_object client
874
      );
875
    uvm_report_message l_report_message;
876
 
877
    l_report_message = uvm_report_message::new_report_message();
878
    l_report_message.set_report_message(severity, id, message,
879
                                        verbosity_level, filename, line, "");
880
    l_report_message.set_report_object(client);
881
    l_report_message.set_report_handler(client.get_report_handler());
882
    l_report_message.set_file(file);
883
    l_report_message.set_action(action);
884
    l_report_message.set_report_server(this);
885
 
886
    execute_report_message(l_report_message, composed_message);
887
  endfunction
888
 
889
 
890
  // Function- compose_message
891
  //
892
  // Constructs the actual string sent to the file or command line
893
  // from the severity, component name, report id, and the message itself.
894
  //
895
  // Expert users can overload this method to customize report formatting.
896
 
897
  virtual function string compose_message(
898
      uvm_severity severity,
899
      string name,
900
      string id,
901
      string message,
902
      string filename,
903
      int    line
904
      );
905
    uvm_report_message l_report_message;
906
 
907
    l_report_message = uvm_report_message::new_report_message();
908
    l_report_message.set_report_message(severity, id, message,
909
                                        UVM_NONE, filename, line, "");
910
 
911
    return compose_report_message(l_report_message, name);
912
  endfunction
913
 
914
 
915
`endif
916
 
917
 
918
endclass
919
 
920
 
921
`endif // UVM_REPORT_SERVER_SVH

powered by: WebSVN 2.1.0

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