Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: MemorySyncMessage.cc | |
4 | // Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
5 | // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
6 | // | |
7 | // The above named program is free software; you can redistribute it and/or | |
8 | // modify it under the terms of the GNU General Public | |
9 | // License version 2 as published by the Free Software Foundation. | |
10 | // | |
11 | // The above named program is distributed in the hope that it will be | |
12 | // useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | // General Public License for more details. | |
15 | // | |
16 | // You should have received a copy of the GNU General Public | |
17 | // License along with this work; if not, write to the Free Software | |
18 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
19 | // | |
20 | // ========== Copyright Header End ============================================ | |
21 | /************************************************************************ | |
22 | ** | |
23 | ** Copyright (C) 2002, Sun Microsystems, Inc. | |
24 | ** | |
25 | ** Sun considers its source code as an unpublished, proprietary | |
26 | ** trade secret and it is available only under strict license provisions. | |
27 | ** This copyright notice is placed here only to protect Sun in the event | |
28 | ** the source is deemed a published work. Disassembly, decompilation, | |
29 | ** or other means of reducing the object code to human readable form | |
30 | ** is prohibited by the license agreement under which this code is | |
31 | ** provided to the user or company in possession of this copy." | |
32 | ** | |
33 | *************************************************************************/ | |
34 | #include "MemorySyncMessage.h" | |
35 | #include <sstream> | |
36 | #include <unistd.h> | |
37 | #include "MemorySync.h" | |
38 | ||
39 | using namespace std; | |
40 | //////////////////////////////////////////////// | |
41 | ||
42 | uint64_t MemorySyncMessage::rtlCycle = 0; | |
43 | int MemorySyncMessage::debugLevel = 0; | |
44 | int MemorySyncMessage::skipCallback = 0; | |
45 | ||
46 | // static function | |
47 | string | |
48 | MemorySyncMessage::dumpBuffers() | |
49 | { | |
50 | return MemorySync::dumpBuffers(); | |
51 | } | |
52 | ||
53 | MemorySyncMessage::MemorySyncMessage() | |
54 | { | |
55 | // Replace the following line with your function body. | |
56 | } | |
57 | ||
58 | //////////////////////////////////////////////// | |
59 | ||
60 | MemorySyncMessage::MemorySyncMessage( const MemorySyncMessage & orig ) | |
61 | { | |
62 | // Replace the following line with your function body. | |
63 | } | |
64 | ||
65 | //////////////////////////////////////////////// | |
66 | ||
67 | MemorySyncMessage::~MemorySyncMessage() | |
68 | { | |
69 | // Replace the following line with your function body. | |
70 | } | |
71 | ||
72 | //////////////////////////////////////////////// | |
73 | ||
74 | const MemorySyncMessage & | |
75 | MemorySyncMessage::operator=( const MemorySyncMessage & rhs ) | |
76 | { | |
77 | // Replace the following line with your function body. | |
78 | ||
79 | return *this; | |
80 | } | |
81 | ||
82 | //////////////////////////////////////////////// | |
83 | ||
84 | bool | |
85 | MemorySyncMessage::operator==( const MemorySyncMessage & rhs ) const | |
86 | { | |
87 | // Replace the following line with your function body. | |
88 | return false; | |
89 | } | |
90 | ||
91 | //////////////////////////////////////////////// | |
92 | ||
93 | string | |
94 | MemorySyncMessage::toString() const | |
95 | { | |
96 | ostringstream os; | |
97 | ||
98 | // Replace the following line with your function body. | |
99 | ||
100 | return os.str(); | |
101 | } | |
102 | ||
103 | void | |
104 | MemorySyncMessage::error (const char *fmt, ...) { | |
105 | char format[500]; | |
106 | va_list args; | |
107 | ||
108 | va_start(args, fmt); | |
109 | sprintf(format, "\n@%lld MSync ERROR: %s\n", | |
110 | rtlCycle, fmt); | |
111 | vfprintf(stdout, format, args); | |
112 | fflush(stdout); | |
113 | ||
114 | // write the error message to RTL testbench, so that it can show in | |
115 | // the right place in sims.log and vcs.log | |
116 | sprintf(format, "\nMSync-info> @%lld MSYNC ERROR: %s\n", | |
117 | rtlCycle, fmt); | |
118 | if (MemorySync::msyncObj->socket) | |
119 | { | |
120 | MemorySync::msyncObj->socket->write_err(format, args); | |
121 | // if pli-socket condition is bad, we should not process pli commands any further | |
122 | MemorySync::msyncObj->socket->pli_stop(); | |
123 | } | |
124 | ||
125 | va_end(args); | |
126 | } | |
127 | ||
128 | void | |
129 | MemorySyncMessage::debug (uint level, const char *fmt, ...) | |
130 | { | |
131 | char format[500]; | |
132 | va_list args; | |
133 | ||
134 | if (debugLevel < level) | |
135 | return; | |
136 | ||
137 | va_start(args, fmt); | |
138 | sprintf(format, "@%lld MSync: %s\n", | |
139 | rtlCycle, fmt); | |
140 | vfprintf(stdout, format, args); | |
141 | va_end(args); | |
142 | } | |
143 | ||
144 | void | |
145 | MemorySyncMessage::warning (const char *fmt, ...) { | |
146 | char format[500]; | |
147 | va_list args; | |
148 | va_start(args, fmt); | |
149 | sprintf(format, "\n@%lld MSync WARNING: %s\n", | |
150 | rtlCycle, fmt); | |
151 | vfprintf(stdout, format, args); | |
152 | ||
153 | // write the warning message to RTL testbench, so that it can show in | |
154 | // the right place in sims.log and vcs.log | |
155 | sprintf(format, "\nMSync-info> @%lld MSYNC WARNING: %s\n", | |
156 | rtlCycle, fmt); | |
157 | if (MemorySync::msyncObj->socket) | |
158 | { | |
159 | MemorySync::msyncObj->socket->write_err(format, args); | |
160 | } | |
161 | ||
162 | va_end(args); | |
163 | } |