SystemC
3.0.0
Accellera SystemC proof-of-concept library
sysc
kernel
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
// ----------------------------------------------------------------------------
53
54
#ifdef _MSC_VER
55
56
// Disable VC++ warnings that are harmless
57
58
// extern template instantiations
59
#pragma warning(disable: 4231)
60
61
// this : used in base member initializer list
62
#pragma warning(disable: 4355)
63
64
// new and delete warning when exception handling is turned on
65
#pragma warning(disable: 4291)
66
67
// in many places implicit conversion to bool
68
// from other integral types is performed
69
#pragma warning(disable: 4800)
70
71
// unary minus operator applied to unsigned
72
#pragma warning(disable: 4146)
73
74
// multiple copy constructors
75
#pragma warning(disable: 4521)
76
77
// identifier was truncated to '255' characters in the browser information
78
#pragma warning(disable: 4786)
79
80
#endif
81
82
// ----------------------------------------------------------------------------
83
// helper macros to aid branch prediction on GCC (compatible) compilers
84
85
#ifndef __GNUC__
86
# define SC_LIKELY_( x ) !!(x)
87
# define SC_UNLIKELY_( x ) !!(x)
88
#else
89
# define SC_LIKELY_( x ) __builtin_expect( !!(x), 1 )
90
# define SC_UNLIKELY_( x ) __builtin_expect( !!(x), 0 )
91
#endif
92
93
// ----------------------------------------------------------------------------
94
// C++ standard
95
//
96
// Selected C++ standard baseline, supported values are
97
// 201703L (C++17, ISO/IEC 14882:2017)
98
// 202002L (C++20, ISO/IEC 14882:2020)
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
# if defined(_MSVC_LANG)
// MSVC 2015 Update 3 or later, use compiler setting
105
# define SC_CPLUSPLUS _MSVC_LANG
106
# else
// not _MSVC_LANG
107
// use compiler setting
108
# define SC_CPLUSPLUS __cplusplus
109
# endif
110
#endif
// SC_CPLUSPLUS
111
112
// SystemC reference implementation requires C++17
113
#define SC_CPLUSPLUS_BASE_ 201703L
114
#if SC_CPLUSPLUS < SC_CPLUSPLUS_BASE_
115
# error **** SystemC requires a C++ compiler version of at least C++17 ****
116
#endif
117
118
// The IEEE_1666_CPLUSPLUS macro is meant to be queried in the models,
119
// checking for availability of SystemC features relying on specific
120
// C++ standard versions.
121
//
122
// IEEE_1666_CPLUSPLUS = min(SC_CPLUSPLUS, SC_CPLUSPLUS_BASE_)
123
#if SC_CPLUSPLUS >= SC_CPLUSPLUS_BASE_
124
# define IEEE_1666_CPLUSPLUS SC_CPLUSPLUS_BASE_
125
#else
126
# define IEEE_1666_CPLUSPLUS SC_CPLUSPLUS
127
#endif
// IEEE_1666_CPLUSPLUS
128
129
// ----------------------------------------------------------------------------
130
131
#include <cassert>
132
#include <cstdio>
133
#include <cstdlib>
134
#include <vector>
135
136
// ----------------------------------------------------------------------------
137
138
// build SystemC DLL on Windows
139
#if defined(SC_WIN_DLL) && (defined(_WIN32) || defined(_WIN64)) && defined(_MSC_VER)
140
141
# if defined(SC_BUILD)
// building SystemC library
142
# define SC_API __declspec(dllexport)
143
# else
// building SystemC application
144
# define SC_API __declspec(dllimport)
145
# endif
// SC_BUILD
146
147
#else
// !SC_WIN_DLL
148
# define SC_API
/* nothing */
149
150
#endif
// SC_WIN_DLL
151
152
#if defined(SC_BUILD) && defined(_MSC_VER)
153
// always instantiate during Windows library build
154
# define SC_API_TEMPLATE_DECL_ template class SC_API
155
#else
156
// keep extern when building an application (or on non-Windows)
157
# define SC_API_TEMPLATE_DECL_ extern template class SC_API
158
#endif
159
160
#endif
// SC_CMNHDR_H
161
162
// ----------------------------------------------------------------------------
163
// only include Windows.h, if explicitly requested
164
// (deliberately outside of include guards to enable later effect)
165
#if defined(SC_HAS_WINDOWS_H_) && defined(SC_INCLUDE_WINDOWS_H)
166
# undef SC_HAS_WINDOWS_H_
167
# include <windows.h>
168
#endif
169
170
// $Log: sc_cmnhdr.h,v $
171
// Revision 1.8 2011/08/26 20:46:09 acg
172
// Andy Goodrich: moved the modification log to the end of the file to
173
// eliminate source line number skew when check-ins are done.
174
//
175
// Revision 1.7 2011/05/09 04:07:48 acg
176
// Philipp A. Hartmann:
177
// (1) Restore hierarchy in all phase callbacks.
178
// (2) Ensure calls to before_end_of_elaboration.
179
//
180
// Revision 1.6 2011/05/05 17:45:27 acg
181
// Philip A. Hartmann: changes in WIN64 support.
182
// Andy Goodrich: additional DEBUG_MSG instances to trace process handling.
183
//
184
// Revision 1.5 2011/02/18 20:27:14 acg
185
// Andy Goodrich: Updated Copyrights.
186
//
187
// Revision 1.4 2011/02/13 21:47:37 acg
188
// Andy Goodrich: update copyright notice.
189
//
190
// Revision 1.3 2009/05/22 16:06:29 acg
191
// Andy Goodrich: process control updates.
192
//
193
// Revision 1.2 2008/05/22 17:06:24 acg
194
// Andy Goodrich: updated copyright notice to include 2008.
195
//
196
// Revision 1.1.1.1 2006/12/15 20:20:05 acg
197
// SystemC 2.3
198
//
199
// Revision 1.3 2006/01/13 18:44:29 acg
200
// Added $Log to record CVS changes into the source.
201
202
// Taf!
Generated on Fri Aug 16 2024 16:36:33 for SystemC by
1.9.4