SystemC
2.3.2
Accellera SystemC proof-of-concept library
sc_cmnhdr.h
Go to the documentation of this file.
1
/*****************************************************************************
2
3
Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4
more contributor license agreements. See the NOTICE file distributed
5
with this work for additional information regarding copyright ownership.
6
Accellera licenses this file to you under the Apache License, Version 2.0
7
(the "License"); you may not use this file except in compliance with the
8
License. You may obtain a copy of the License at
9
10
http://www.apache.org/licenses/LICENSE-2.0
11
12
Unless required by applicable law or agreed to in writing, software
13
distributed under the License is distributed on an "AS IS" BASIS,
14
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
implied. See the License for the specific language governing
16
permissions and limitations under the License.
17
18
*****************************************************************************/
19
20
/*****************************************************************************
21
22
sc_cmnhdr.h - Common header file containing handy pragmas, macros and
23
definitions common to all SystemC source files.
24
25
Original Author: Amit Rao, Synopsys, Inc.
26
27
CHANGE LOG AT THE END OF THE FILE
28
*****************************************************************************/
29
30
31
#ifndef SC_CMNHDR_H
32
#define SC_CMNHDR_H
33
34
#if defined(_WIN32) || defined(_MSC_VER) || defined(__BORLANDC__) || \
35
defined(__MINGW32__)
36
37
// all windows 32-bit compilers should define WIN32
38
#if !defined(WIN32) && !defined(WIN64) && !defined(_WIN64)
39
#define WIN32
40
#endif
41
42
// Windows Version Build Option
43
#ifndef _WIN32_WINNT
44
#define _WIN32_WINNT 0x0400
45
#endif
46
47
// remember to later include windows.h, if needed
48
#define SC_HAS_WINDOWS_H_
49
50
#endif // WIN32
51
52
#ifdef _MSC_VER
53
54
// Disable VC++ warnings that are harmless
55
56
// extern template instantiations
57
#pragma warning(disable: 4231)
58
59
// this : used in base member initializer list
60
#pragma warning(disable: 4355)
61
62
// new and delete warning when exception handling is turned on
63
#pragma warning(disable: 4291)
64
65
// in many places implicit conversion to bool
66
// from other integral types is performed
67
#pragma warning(disable: 4800)
68
69
// unary minus operator applied to unsigned
70
#pragma warning(disable: 4146)
71
72
// multiple copy constructors
73
#pragma warning(disable: 4521)
74
75
// identifier was truncated to '255' characters in the browser information
76
#pragma warning(disable: 4786)
77
78
#endif
79
83
#ifndef __GNUC__
84
# define SC_LIKELY_( x ) !!(x)
85
# define SC_UNLIKELY_( x ) !!(x)
86
#else
87
# define SC_LIKELY_( x ) __builtin_expect( !!(x), 1 )
88
# define SC_UNLIKELY_( x ) __builtin_expect( !!(x), 0 )
89
#endif
90
91
// ----------------------------------------------------------------------------
92
// C++ standard
93
//
94
// Selected C++ standard baseline, supported values are
95
// 199711L (C++03, ISO/IEC 14882:1998, 14882:2003)
96
// 201103L (C++11, ISO/IEC 14882:2011)
97
// 201402L (C++14, ISO/IEC 14882:2014)
98
// 201703L (C++17, N4659: Working Draft, Standard for Programming Language C++)
99
//
100
// This macro can be used inside the library sources to make certain assumptions
101
// on the available features in the underlying C++ implementation.
102
//
103
#ifndef SC_CPLUSPLUS
104
# ifdef _MSC_VER // don't rely on __cplusplus for MSVC
105
// Instead, we select the C++ standard with reasonable support.
106
// If some features still need to be excluded on specific MSVC
107
// versions, we'll do so at the point of definition.
108
109
# if defined(_MSVC_LANG) // MSVC'2015 Update 3 or later, use compiler setting
110
# define SC_CPLUSPLUS _MSVC_LANG
111
# elif _MSC_VER < 1800 // MSVC'2010 and earlier, assume C++03
112
# define SC_CPLUSPLUS 199711L
113
# elif _MSC_VER < 1900 // MSVC'2013, assume C++11
114
# define SC_CPLUSPLUS 201103L
115
# else // MSVC'2015 before Update 3, assume C++14
116
# define SC_CPLUSPLUS 201402L
117
# endif
118
119
# else // not _MSC_VER
120
// use compiler setting
121
# define SC_CPLUSPLUS __cplusplus
122
123
# endif // not _MSC_VER
124
#endif // SC_CPLUSPLUS
125
126
// SystemC adds some features under C++11 already (see RELEASENOTES)
127
#define SC_CPLUSPLUS_BASE_ 201103L
128
129
// The IEEE_1666_CPLUSPLUS macro is meant to be queried in the models,
130
// checking for availability of SystemC features relying on specific
131
// C++ standard versions.
132
//
133
// IEEE_1666_CPLUSPLUS = min(SC_CPLUSPLUS, SC_CPLUSPLUS_BASE_)
134
#if SC_CPLUSPLUS >= SC_CPLUSPLUS_BASE_
135
# define IEEE_1666_CPLUSPLUS SC_CPLUSPLUS_BASE_
136
#else
137
# define IEEE_1666_CPLUSPLUS SC_CPLUSPLUS
138
#endif // IEEE_1666_CPLUSPLUS
139
140
// ----------------------------------------------------------------------------
141
142
#include <cassert>
143
#include <cstdio>
144
#include <cstdlib>
145
#include <vector>
146
147
// ----------------------------------------------------------------------------
148
149
// declare certain template instantiations as "extern" during library build
150
// and adding an explicit instantiation into the (shared) SystemC library
151
152
#if defined(__GNUC__) && SC_CPLUSPLUS < 201103L
153
# define SC_TPLEXTERN_ __extension__ extern
154
#else
155
# define SC_TPLEXTERN_ extern
156
#endif
157
158
// build SystemC DLL on Windows
159
#if defined(SC_WIN_DLL) && (defined(_WIN32) || defined(_WIN64))
160
161
# if defined(SC_BUILD) // building SystemC library
162
# define SC_API __declspec(dllexport)
163
# else // building SystemC application
164
# define SC_API __declspec(dllimport)
165
# endif // SC_BUILD
166
167
#else // !SC_WIN_DLL
168
# define SC_API
/* nothing */
169
170
#endif // SC_WIN_DLL
171
172
#if defined(SC_BUILD) && defined(_MSC_VER)
173
// always instantiate during Windows library build
174
# define SC_API_TEMPLATE_DECL_ template class SC_API
175
#else
176
// keep extern when building an application (or on non-Windows)
177
# define SC_API_TEMPLATE_DECL_ SC_TPLEXTERN_ template class SC_API
178
#endif
179
180
#endif // SC_CMNHDR_H
181
186
# undef SC_HAS_WINDOWS_H_
187
# include <Windows.h>
188
#endif
189
190
// $Log: sc_cmnhdr.h,v $
191
// Revision 1.8 2011/08/26 20:46:09 acg
192
// Andy Goodrich: moved the modification log to the end of the file to
193
// eliminate source line number skew when check-ins are done.
194
//
195
// Revision 1.7 2011/05/09 04:07:48 acg
196
// Philipp A. Hartmann:
197
// (1) Restore hierarchy in all phase callbacks.
198
// (2) Ensure calls to before_end_of_elaboration.
199
//
200
// Revision 1.6 2011/05/05 17:45:27 acg
201
// Philip A. Hartmann: changes in WIN64 support.
202
// Andy Goodrich: additional DEBUG_MSG instances to trace process handling.
203
//
204
// Revision 1.5 2011/02/18 20:27:14 acg
205
// Andy Goodrich: Updated Copyrights.
206
//
207
// Revision 1.4 2011/02/13 21:47:37 acg
208
// Andy Goodrich: update copyright notice.
209
//
210
// Revision 1.3 2009/05/22 16:06:29 acg
211
// Andy Goodrich: process control updates.
212
//
213
// Revision 1.2 2008/05/22 17:06:24 acg
214
// Andy Goodrich: updated copyright notice to include 2008.
215
//
216
// Revision 1.1.1.1 2006/12/15 20:20:05 acg
217
// SystemC 2.3
218
//
219
// Revision 1.3 2006/01/13 18:44:29 acg
220
// Added $Log to record CVS changes into the source.
221
222
// Taf!
sysc
kernel
sc_cmnhdr.h
Generated on Sun Oct 28 2018 23:08:47 for SystemC by
1.8.13