gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
33namespace sc_dt
34{
35
36template <class T>
37const T
38sc_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
55template <class T>
56const T sc_max(const T &a, const T &b) { return ((a >= b) ? a : b); }
57
58template <class T>
59const T sc_min(const T &a, const T &b) { return ((a <= b) ? a : b); }
60
61} // namespace sc_dt
62
63namespace 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
78extern const unsigned int sc_version_major;
79extern const unsigned int sc_version_minor;
80extern const unsigned int sc_version_patch;
81extern const std::string sc_version_originator;
82extern const std::string sc_version_release_date;
83extern const std::string sc_version_prerelease;
84extern const bool sc_is_prerelease;
85extern const std::string sc_version_string;
86extern const std::string sc_copyright_string;
87
88static inline const char *
90{
91 return sc_version_string.c_str();
92}
93static inline const char *
95{
96 return sc_copyright_string.c_str();
97}
98const char *sc_version();
99
100} // namespace sc_core
101
102#endif //__SYSTEMC_EXT_UTIL_FUNCTIONS_HH__
SwitchingFiber b
SwitchingFiber c
SwitchingFiber a
static const char * sc_release()
Definition functions.hh:89
const unsigned int sc_version_major
Definition functions.cc:33
const char * sc_version()
Definition functions.cc:44
const std::string sc_version_release_date
Definition functions.cc:37
const std::string sc_version_prerelease
Definition functions.cc:38
const bool sc_is_prerelease
Definition functions.cc:39
const std::string sc_version_originator
Definition functions.cc:36
const unsigned int sc_version_minor
Definition functions.cc:34
const unsigned int sc_version_patch
Definition functions.cc:35
const std::string sc_version_string
Definition functions.cc:40
static const char * sc_copyright()
Definition functions.hh:94
const std::string sc_copyright_string
Definition functions.cc:41
const T sc_min(const T &a, const T &b)
Definition functions.hh:59
const T sc_abs(const T &a)
Definition functions.hh:38
const T sc_max(const T &a, const T &b)
Definition functions.hh:56

Generated on Tue Jun 18 2024 16:24:07 for gem5 by doxygen 1.11.0