SystemC  Recoding Infrastructure for SystemC v0.6.3 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
systemc.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  systemc.h - Top-level include file for the SystemC library with usings.
21 
22  Original Author: Stan Y. Liao, Synopsys, Inc.
23 
24  *****************************************************************************/
25 
26 /*****************************************************************************
27 
28  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
29  changes you are making here.
30 
31  Name, Affiliation, Date: Andy Goodrich, Forte Design Systems, 31 Mar 2005
32  Description of Modification: Changes for namespace support.
33 
34  *****************************************************************************/
35 
36 #ifndef SYSTEMC_H
37 #define SYSTEMC_H
38 
39 // INCLUDE SYSTEM (std) DEFINITIONS:
40 
41 #include <cassert>
42 #include <climits>
43 #include <cmath> // math.h?
44 #include <cstddef>
45 #include <cstdio>
46 #include <cstdlib>
47 #include <cstring>
48 #include <exception>
49 #include <fstream>
50 #include <iostream>
51 #include <memory>
52 #include <string>
53 #if defined(__sun) || defined(__sun__)
54 # include <inttypes.h>
55 #elif !defined(WIN32) && !defined(_WIN32)
56 # include <stdint.h>
57 #endif
58 #include <typeinfo>
59 #include <utility>
60 #include <vector>
61 
62 // USINGS FOR I/O STREAM SUPPORT:
63 
64  using std::ios;
65  using std::streambuf;
66  using std::streampos;
67  using std::streamsize;
68  using std::iostream;
69  using std::istream;
70  using std::ostream;
71  using std::cin;
72  using std::cout;
73  using std::cerr;
74  using std::endl;
75  using std::flush;
76  using std::dec;
77  using std::hex;
78  using std::oct;
79  using std::noshowbase;
80  using std::showbase;
81 
82  using std::fstream;
83  using std::ifstream;
84  using std::ofstream;
85 
86 // from <cstdio>:
87 
88  using std::size_t;
89  using std::FILE;
90  using std::fpos_t;
91  using std::fclose;
92  using std::clearerr;
93 
94  using std::remove;
95  using std::rename;
96  using std::tmpfile;
97  using std::tmpnam;
98  using std::fflush;
99  using std::fopen;
100  using std::freopen;
101  using std::setbuf;
102  using std::setvbuf;
103  using std::fprintf;
104  using std::fscanf;
105  using std::printf;
106  using std::scanf;
107  using std::sprintf;
108  using std::sscanf;
109  using std::vfprintf;
110  using std::vprintf;
111  using std::vsprintf;
112  using std::fgetc;
113  using std::fgets;
114  using std::fputc;
115  using std::fputs;
116  using std::getc;
117  using std::getchar;
118 // using std::gets; // deprecated in c++11, removed in c++14; fails with newer compilers (RD, 07/23/18)
119  using std::putc;
120  using std::putchar;
121  using std::puts;
122  using std::ungetc;
123  using std::fread;
124  using std::fwrite;
125  using std::fgetpos;
126  using std::fseek;
127  using std::fsetpos;
128  using std::ftell;
129  using std::rewind;
130  using std::feof;
131  using std::ferror;
132  using std::perror;
133 
134 // from <cstdlib>:
135 
136  using std::div_t;
137  using std::ldiv_t;
138 
139  using std::atof;
140  using std::atoi;
141  using std::atol;
142  using std::strtod;
143  using std::strtol;
144  using std::strtoul;
145  using std::rand;
146  using std::srand;
147  using std::calloc;
148  using std::free;
149  using std::malloc;
150  using std::realloc;
151  using std::abort;
152  using std::atexit;
153  using std::exit;
154  using std::getenv;
155  using std::system;
156  using std::bsearch;
157  using std::qsort;
158  using std::abs;
159  using std::div;
160  using std::labs;
161  using std::ldiv;
162  using std::mblen;
163  using std::mbtowc;
164  using std::mbstowcs;
165 #if !defined(__CYGWIN__) && !defined(__CYGWIN32)
166  using std::wctomb;
167  using std::wcstombs;
168 #endif
169 
170 // from <cstring>:
171 
172  using std::memcpy;
173  using std::memmove;
174  using std::strcpy;
175  using std::strncpy;
176  using std::strcat;
177  using std::strncat;
178  using std::memcmp;
179  using std::strcmp;
180  using std::strcoll;
181  using std::strncmp;
182  using std::strxfrm;
183  using std::memchr;
184  using std::strchr;
185  using std::strcspn;
186  using std::strpbrk;
187  using std::strrchr;
188  using std::strspn;
189  using std::strstr;
190  using std::strtok;
191  using std::memset;
192  using std::strerror;
193  using std::strlen;
194 
195 // deprecated strstream support
196 #if defined( SC_INCLUDE_STRSTREAM )
197 #include <strstream>
198 
199  using std::strstream;
200  using std::strstreambuf;
201  using std::istrstream;
202  using std::ostrstream;
203 
204 #endif // SC_INCLUDE_STRSTREAM
205 
206 // INCLUDE SYSTEMC DEFINITIONS for sc_dt AND sc_core NAMESPACES:
207 
208 #include "systemc"
209 
210 // USINGS FOR THE sc_dt NAMESPACE:
211 
212 using sc_dt::SC_BIN;
213 using sc_dt::SC_BIN_SM;
214 using sc_dt::SC_BIN_US;
215 using sc_dt::SC_CSD;
216 using sc_dt::SC_DEC;
217 using sc_dt::SC_HEX;
218 using sc_dt::SC_HEX_SM;
219 using sc_dt::SC_HEX_US;
220 using sc_dt::SC_LOGIC_0;
221 using sc_dt::SC_LOGIC_1;
222 using sc_dt::SC_LOGIC_X;
223 using sc_dt::SC_LOGIC_Z;
224 using sc_dt::SC_NOBASE;
225 using sc_dt::SC_OCT;
226 using sc_dt::SC_OCT_SM;
227 using sc_dt::SC_OCT_US;
228 using sc_dt::int64;
229 using sc_dt::sc_abs;
230 using sc_dt::sc_bigint;
231 using sc_dt::sc_biguint;
232 using sc_dt::sc_bit;
233 using sc_dt::sc_bv;
234 using sc_dt::sc_bv_base;
235 using sc_dt::sc_digit;
236 using sc_dt::sc_int;
237 using sc_dt::sc_int_base;
241 using sc_dt::sc_logic;
242 using sc_dt::sc_lv;
243 using sc_dt::sc_lv_base;
244 using sc_dt::sc_max;
245 using sc_dt::sc_min;
246 using sc_dt::sc_numrep;
247 using sc_dt::sc_signed;
248 using sc_dt::sc_uint;
249 using sc_dt::sc_uint_base;
250 using sc_dt::sc_unsigned;
251 using sc_dt::uint64;
252 // #ifdef SC_DT_DEPRECATED
253 using sc_dt::sc_logic_0;
254 using sc_dt::sc_logic_1;
255 using sc_dt::sc_logic_Z;
256 using sc_dt::sc_logic_X;
257 // #endif
258 
259 #ifdef SC_INCLUDE_FX
260  using sc_dt::sc_fxnum;
262  using sc_dt::sc_fxnum_fast;
263  using sc_dt::sc_fix;
264  using sc_dt::sc_fix_fast;
265  using sc_dt::sc_ufix;
266  using sc_dt::sc_ufix_fast;
267  using sc_dt::sc_fixed;
268  using sc_dt::sc_fixed_fast;
269  using sc_dt::sc_ufixed;
270  using sc_dt::sc_ufixed_fast;
271  using sc_dt::sc_fxval;
272  using sc_dt::sc_fxval_fast;
277  using sc_dt::sc_q_mode;
278  using sc_dt::SC_RND;
279  using sc_dt::SC_RND_ZERO;
280  using sc_dt::SC_RND_MIN_INF;
281  using sc_dt::SC_RND_INF;
282  using sc_dt::SC_RND_CONV;
283  using sc_dt::SC_TRN;
284  using sc_dt::SC_TRN_ZERO;
285  using sc_dt::sc_o_mode;
286  using sc_dt::SC_SAT;
287  using sc_dt::SC_SAT_ZERO;
288  using sc_dt::SC_SAT_SYM;
289  using sc_dt::SC_WRAP;
290  using sc_dt::SC_WRAP_SM;
291  using sc_dt::sc_switch;
292  using sc_dt::SC_OFF;
293  using sc_dt::SC_ON;
294  using sc_dt::sc_fmt;
295  using sc_dt::SC_F;
296  using sc_dt::SC_E;
298  using sc_dt::SC_NOW;
299  using sc_dt::SC_LATER;
300 #endif // SC_INCLUDE_FX
301 
302 #if 0 // defined( _MSC_VER ) // supported versions of MSVC should support ADL
303 
304  using sc_dt::equal;
305  using sc_dt::not_equal;
306  using sc_dt::b_not;
307  using sc_dt::b_and;
308  using sc_dt::b_or;
309  using sc_dt::b_xor;
310  using sc_dt::lrotate;
311  using sc_dt::rrotate;
312  using sc_dt::reverse;
313  using sc_dt::concat;
314  using sc_dt::and_reduce;
315  using sc_dt::or_reduce;
316  using sc_dt::xor_reduce;
317  using sc_dt::nand_reduce;
318  using sc_dt::nor_reduce;
319  using sc_dt::xnor_reduce;
320 
321 #endif // defined( _MSC_VER )
322 
323 
324 // USINGS FOR sc_core:
325 //
326 // The explicit using for ::sc_core::wait is to remove an ambiguity with
327 // the constructor for the system's union wait on Unix and Linux. This
328 // causes problems with aCC, so users of aCC should explicitly select
329 // the SystemC wait functions using ::sc_core::wait(...). This is actually
330 // a good idea for SystemC programmers in general.
331 
332 using namespace sc_core;
333 
334 #if !defined( __HP_aCC )
336 #endif // !defined( __HP_aCC )
337 
338 #ifdef SC_USE_SC_STRING_OLD
339  using sc_dt::sc_string_old;
340  typedef sc_dt::sc_string_old sc_string;
341 #endif
342 #ifdef SC_USE_STD_STRING
343  typedef ::std::string sc_string;
344 #endif
345 
346 #endif
const sc_bit b_xor(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:350
const sc_logic SC_LOGIC_Z
const sc_bit b_not(const sc_bit &a)
Definition: sc_bit.h:316
const sc_logic SC_LOGIC_X
sc_context< sc_fxtype_params > sc_fxtype_context
sc_numrep
Definition: sc_nbdefs.h:91
int64_t int64
Definition: sc_nbdefs.h:182
const sc_logic sc_logic_X
sc_logic_value_t nand_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1546
void wait(int, sc_simcontext *)
sc_logic_value_t xor_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1570
bool sc_io_show_base(systemc_ostream &)
Definition: sc_nbutils.h:112
const sc_bit b_or(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:347
sc_context_begin
Definition: sc_context.h:125
unsigned int sc_digit
Definition: sc_nbdefs.h:173
sc_logic_value_t nor_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1562
const sc_bit b_and(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:344
const sc_logic sc_logic_1
sc_o_mode
Definition: sc_fxdefs.h:116
sc_logic_value_t or_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1554
const T sc_min(const T &a, const T &b)
Definition: sc_macros.h:37
bool equal(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:294
uint64_t uint64
Definition: sc_nbdefs.h:183
sc_switch
Definition: sc_fxdefs.h:145
const sc_logic SC_LOGIC_0
sc_context< sc_length_param > sc_length_context
bool not_equal(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:297
const sc_logic sc_logic_Z
const sc_logic sc_logic_0
const sc_lv_base lrotate(const sc_proxy< X > &x, int n)
Definition: sc_lv_base.h:737
sc_logic_value_t xnor_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1578
const T sc_abs(const T &a)
Definition: sc_macros.h:53
sc_logic_value_t and_reduce(const sc_proxy< X > &a)
Definition: sc_proxy.h:1538
const sc_lv_base rrotate(const sc_proxy< X > &x, int n)
Definition: sc_lv_base.h:776
const sc_logic SC_LOGIC_1
sc_q_mode
Definition: sc_fxdefs.h:87
sc_context< sc_fxcast_switch > sc_fxcast_context
sc_concref_r< sc_bitref_r< T1 >, sc_bitref_r< T2 > > concat(sc_bitref_r< T1 >, sc_bitref_r< T2 >)
const sc_lv_base reverse(const sc_proxy< X > &x)
Definition: sc_lv_base.h:788
const T sc_max(const T &a, const T &b)
Definition: sc_macros.h:45