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

Subversion Repositories hssdrc

[/] [hssdrc/] [trunk/] [testbench/] [message_class.sv] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 des00
//
2
// Project      : High-Speed SDRAM Controller with adaptive bank management and command pipeline
3
//
4
// Project Nick : HSSDRC
5
//
6
// Version      : 1.0-beta
7
//
8
// Revision     : $Revision: 1.1 $
9
//
10
// Date         : $Date: 2008-03-06 13:54:00 $
11
//
12
// Workfile     : message_class.sv
13
//
14
// Description  : simple message service class
15
//
16
// HSSDRC is licensed under MIT License
17
//
18
// Copyright (c) 2007-2008, Denis V.Shekhalev (des00@opencores.org)
19
//
20
// Permission  is hereby granted, free of charge, to any person obtaining a copy of
21
// this  software  and  associated documentation files (the "Software"), to deal in
22
// the  Software  without  restriction,  including without limitation the rights to
23
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
24
// the  Software, and to permit persons to whom the Software is furnished to do so,
25
// subject to the following conditions:
26
//
27
// The  above  copyright notice and this permission notice shall be included in all
28
// copies or substantial portions of the Software.
29
//
30
// THE  SOFTWARE  IS  PROVIDED  "AS  IS",  WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
32
// FOR  A  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
33
// COPYRIGHT  HOLDERS  BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
34
// IN  AN  ACTION  OF  CONTRACT,  TORT  OR  OTHERWISE,  ARISING  FROM, OUT OF OR IN
35
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36
//
37
 
38
 
39
 
40
`ifndef __MESSAGE_CLASS__
41
 
42
  `define __MESSAGE_CLASS__
43
 
44
  class message_class;
45
 
46
    static int fp;
47
 
48
    static int err_cnt;
49
 
50
    //
51
    //
52
    //
53
 
54
    function new (string file_name = "");
55
      if (file_name.len() != 0)
56
        fp = $fopen(file_name, "w");
57
      else
58
        fp = 0;
59
    endfunction
60
 
61
    //
62
    //
63
    //
64
 
65
    function void stop();
66
      $fclose(fp);
67
    endfunction
68
 
69
    //
70
    //
71
    //
72
 
73
    function void note (string str);
74
      string io_str;
75
 
76
      io_str = $psprintf("**NOTE** at %0t : ", $time);
77
 
78
      io_str = {io_str, str};
79
 
80
      $display (io_str);
81
      if (fp)
82
        $fdisplay (fp, io_str);
83
    endfunction
84
 
85
    //
86
    //
87
    //
88
 
89
    function void err (string str);
90
      string io_str;
91
 
92
      err_cnt++;
93
 
94
      io_str = $psprintf("**ERROR** at %0t : ", $time);
95
 
96
      io_str = {io_str, str};
97
 
98
      $display (io_str);
99
      if (fp)
100
        $fdisplay (fp, io_str);
101
 
102
    endfunction
103
 
104
  endclass
105
 
106
`endif

powered by: WebSVN 2.1.0

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