gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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  * Authors: Gabe Black
28  */
29 
30 #ifndef __SYSTEMC_EXT_UTIL_FUNCTIONS_HH__
31 #define __SYSTEMC_EXT_UTIL_FUNCTIONS_HH__
32 
33 #include <string>
34 
35 namespace sc_dt
36 {
37 
38 template <class T>
39 const T
40 sc_abs(const T &a)
41 {
42  // return ( a >= 0 ? a : -a );
43  // the code below is functionaly the same as the code above; the
44  // difference is that the code below works for all arithmetic
45  // SystemC datatypes.
46  T z(a);
47  z = 0;
48  if (a >= z) {
49  return a;
50  } else {
51  T c(a);
52  c = -a;
53  return c;
54  }
55 }
56 
57 template <class T>
58 const T sc_max(const T &a, const T &b) { return ((a >= b) ? a : b); }
59 
60 template <class T>
61 const T sc_min(const T &a, const T &b) { return ((a <= b) ? a : b); }
62 
63 } // namespace sc_dt
64 
65 namespace sc_core
66 {
67 
68 #define IEEE_1666_SYSTEMC 201101L
69 
70 #define SC_VERSION_MAJOR 0
71 #define SC_VERSION_MINOR 1
72 #define SC_VERSION_PATCH 0
73 #define SC_VERSION_ORIGINATOR "gem5"
74 #define SC_VERSION_RELEASE_DATE "NA"
75 #define SC_VERSION_PRERELEASE "beta"
76 #define SC_IS_PRERELEASE true
77 #define SC_VERSION "0.1.0_beta-gem5"
78 #define SC_COPYRIGHT "Copyright 2018 Google, Inc."
79 
80 extern const unsigned int sc_version_major;
81 extern const unsigned int sc_version_minor;
82 extern const unsigned int sc_version_patch;
83 extern const std::string sc_version_originator;
84 extern const std::string sc_version_release_date;
85 extern const std::string sc_version_prerelease;
86 extern const bool sc_is_prerelease;
87 extern const std::string sc_version_string;
88 extern const std::string sc_copyright_string;
89 
90 static inline const char *
92 {
93  return sc_version_string.c_str();
94 }
95 static inline const char *
97 {
98  return sc_copyright_string.c_str();
99 }
100 const char *sc_version();
101 
102 } // namespace sc_core
103 
104 #endif //__SYSTEMC_EXT_UTIL_FUNCTIONS_HH__
static const char * sc_release()
Definition: functions.hh:91
const std::string sc_version_prerelease
Definition: functions.cc:40
const std::string sc_copyright_string
Definition: functions.cc:43
Bitfield< 11 > z
Bitfield< 8 > a
const std::string sc_version_string
Definition: functions.cc:42
const T sc_max(const T &a, const T &b)
Definition: functions.hh:58
Definition: sc_bit.cc:67
const T sc_min(const T &a, const T &b)
Definition: functions.hh:61
const unsigned int sc_version_minor
Definition: functions.cc:36
Bitfield< 7 > b
const bool sc_is_prerelease
Definition: functions.cc:41
const char * sc_version()
Definition: functions.cc:46
static const char * sc_copyright()
Definition: functions.hh:96
const unsigned int sc_version_major
Definition: functions.cc:35
const std::string sc_version_release_date
Definition: functions.cc:39
Bitfield< 29 > c
const std::string sc_version_originator
Definition: functions.cc:38
const T sc_abs(const T &a)
Definition: functions.hh:40
const unsigned int sc_version_patch
Definition: functions.cc:37

Generated on Fri Feb 28 2020 16:27:04 for gem5 by doxygen 1.8.13