gem5  v20.1.0.0
functions.hh
Go to the documentation of this file.
1 /*
2  * Copyright 2018 Google, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met: redistributions of source code must retain the above copyright
7  * notice, this list of conditions and the following disclaimer;
8  * redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution;
11  * neither the name of the copyright holders nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef __SYSTEMC_EXT_UTIL_FUNCTIONS_HH__
29 #define __SYSTEMC_EXT_UTIL_FUNCTIONS_HH__
30 
31 #include <string>
32 
33 namespace sc_dt
34 {
35 
36 template <class T>
37 const T
38 sc_abs(const T &a)
39 {
40  // return ( a >= 0 ? a : -a );
41  // the code below is functionaly the same as the code above; the
42  // difference is that the code below works for all arithmetic
43  // SystemC datatypes.
44  T z(a);
45  z = 0;
46  if (a >= z) {
47  return a;
48  } else {
49  T c(a);
50  c = -a;
51  return c;
52  }
53 }
54 
55 template <class T>
56 const T sc_max(const T &a, const T &b) { return ((a >= b) ? a : b); }
57 
58 template <class T>
59 const T sc_min(const T &a, const T &b) { return ((a <= b) ? a : b); }
60 
61 } // namespace sc_dt
62 
63 namespace sc_core
64 {
65 
66 #define IEEE_1666_SYSTEMC 201101L
67 
68 #define SC_VERSION_MAJOR 0
69 #define SC_VERSION_MINOR 1
70 #define SC_VERSION_PATCH 0
71 #define SC_VERSION_ORIGINATOR "gem5"
72 #define SC_VERSION_RELEASE_DATE "NA"
73 #define SC_VERSION_PRERELEASE "beta"
74 #define SC_IS_PRERELEASE true
75 #define SC_VERSION "0.1.0_beta-gem5"
76 #define SC_COPYRIGHT "Copyright 2018 Google, Inc."
77 
78 extern const unsigned int sc_version_major;
79 extern const unsigned int sc_version_minor;
80 extern const unsigned int sc_version_patch;
81 extern const std::string sc_version_originator;
82 extern const std::string sc_version_release_date;
83 extern const std::string sc_version_prerelease;
84 extern const bool sc_is_prerelease;
85 extern const std::string sc_version_string;
86 extern const std::string sc_copyright_string;
87 
88 static inline const char *
90 {
91  return sc_version_string.c_str();
92 }
93 static inline const char *
95 {
96  return sc_copyright_string.c_str();
97 }
98 const char *sc_version();
99 
100 } // namespace sc_core
101 
102 #endif //__SYSTEMC_EXT_UTIL_FUNCTIONS_HH__
sc_core::sc_is_prerelease
const bool sc_is_prerelease
Definition: functions.cc:39
sc_core::sc_release
static const char * sc_release()
Definition: functions.hh:89
sc_dt
Definition: sc_bit.cc:67
sc_core
Definition: messages.cc:31
sc_core::sc_copyright
static const char * sc_copyright()
Definition: functions.hh:94
sc_core::sc_version_patch
const unsigned int sc_version_patch
Definition: functions.cc:35
sc_core::sc_version_release_date
const std::string sc_version_release_date
Definition: functions.cc:37
ArmISA::a
Bitfield< 8 > a
Definition: miscregs_types.hh:62
sc_core::sc_version_originator
const std::string sc_version_originator
Definition: functions.cc:36
ArmISA::z
Bitfield< 11 > z
Definition: miscregs_types.hh:370
sc_dt::sc_abs
const T sc_abs(const T &a)
Definition: functions.hh:38
sc_core::sc_version
const char * sc_version()
Definition: functions.cc:44
sc_dt::sc_min
const T sc_min(const T &a, const T &b)
Definition: functions.hh:59
sc_core::sc_version_minor
const unsigned int sc_version_minor
Definition: functions.cc:34
sc_dt::sc_max
const T sc_max(const T &a, const T &b)
Definition: functions.hh:56
ArmISA::b
Bitfield< 7 > b
Definition: miscregs_types.hh:376
sc_core::sc_version_string
const std::string sc_version_string
Definition: functions.cc:40
sc_core::sc_version_major
const unsigned int sc_version_major
Definition: functions.cc:33
ArmISA::c
Bitfield< 29 > c
Definition: miscregs_types.hh:50
sc_core::sc_copyright_string
const std::string sc_copyright_string
Definition: functions.cc:41
sc_core::sc_version_prerelease
const std::string sc_version_prerelease
Definition: functions.cc:38

Generated on Wed Sep 30 2020 14:02:16 for gem5 by doxygen 1.8.17