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