diff options
author | Gabe Black <gabeblack@google.com> | 2018-05-18 02:12:34 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-08-08 10:07:26 +0000 |
commit | 7adb1b250b712920ea5d685f146ad6df55346393 (patch) | |
tree | c431de9f29f2c7d1dc5a6e581cfcf7031bb26a49 | |
parent | 4b2e28307d0a1c2b31e403e8e394261eb363a7a9 (diff) | |
download | gem5-7adb1b250b712920ea5d685f146ad6df55346393.tar.xz |
systemc: Stub out all the standard utilility classes and functions.
Change-Id: I9e9724edb6281e0b0a6bae5546b0ede77d295c12
Reviewed-on: https://gem5-review.googlesource.com/10841
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r-- | src/systemc/ext/core/sc_process_handle.hh | 21 | ||||
-rw-r--r-- | src/systemc/ext/systemc | 1 | ||||
-rw-r--r-- | src/systemc/ext/systemc.h | 1 | ||||
-rw-r--r-- | src/systemc/ext/utils/_using.hh | 98 | ||||
-rw-r--r-- | src/systemc/ext/utils/_utils.hh | 40 | ||||
-rw-r--r-- | src/systemc/ext/utils/endian.hh | 79 | ||||
-rw-r--r-- | src/systemc/ext/utils/functions.hh | 104 | ||||
-rw-r--r-- | src/systemc/ext/utils/sc_exception.hh | 42 | ||||
-rw-r--r-- | src/systemc/ext/utils/sc_report.hh | 84 | ||||
-rw-r--r-- | src/systemc/ext/utils/sc_report_handler.hh | 135 | ||||
-rw-r--r-- | src/systemc/ext/utils/sc_trace_file.hh | 156 | ||||
-rw-r--r-- | src/systemc/ext/utils/sc_vector.hh | 440 | ||||
-rw-r--r-- | src/systemc/ext/utils/warn_unimpl.hh | 40 | ||||
-rw-r--r-- | src/systemc/utils/SConscript | 36 | ||||
-rw-r--r-- | src/systemc/utils/functions.cc | 53 | ||||
-rw-r--r-- | src/systemc/utils/sc_report.cc | 119 | ||||
-rw-r--r-- | src/systemc/utils/sc_report_handler.cc | 215 | ||||
-rw-r--r-- | src/systemc/utils/sc_trace_file.cc | 325 | ||||
-rw-r--r-- | src/systemc/utils/sc_vector.cc | 49 | ||||
-rw-r--r-- | src/systemc/utils/warn_unimpl.cc | 42 |
20 files changed, 2080 insertions, 0 deletions
diff --git a/src/systemc/ext/core/sc_process_handle.hh b/src/systemc/ext/core/sc_process_handle.hh index ce3fe03cd..a928ab3ad 100644 --- a/src/systemc/ext/core/sc_process_handle.hh +++ b/src/systemc/ext/core/sc_process_handle.hh @@ -33,6 +33,13 @@ #include <exception> #include <vector> +namespace sc_gem5 +{ + +class Process; + +} // namespace sc_gem5 + namespace sc_core { @@ -67,12 +74,26 @@ class sc_unwind_exception : public std::exception class sc_process_handle { + private: + ::sc_gem5::Process *_gem5_process; + public: sc_process_handle(); sc_process_handle(const sc_process_handle &); explicit sc_process_handle(sc_object *); ~sc_process_handle(); + // These non-standard operators provide access to the data structure which + // actually tracks the process within gem5. By making them operators, we + // can minimize the symbols added to the class namespace. + operator ::sc_gem5::Process * () const { return _gem5_process; } + sc_process_handle & + operator = (::sc_gem5::Process *p) + { + _gem5_process = p; + return *this; + } + bool valid() const; sc_process_handle &operator = (const sc_process_handle &); diff --git a/src/systemc/ext/systemc b/src/systemc/ext/systemc index 633b84eb9..1224a7e1b 100644 --- a/src/systemc/ext/systemc +++ b/src/systemc/ext/systemc @@ -33,5 +33,6 @@ #include "channel/_channel.hh" #include "core/_core.hh" #include "dt/_dt.hh" +#include "utils/_utils.hh" #endif //__SYSTEMC_EXT_SYSTEMC__ diff --git a/src/systemc/ext/systemc.h b/src/systemc/ext/systemc.h index 4b4927225..d530d61e9 100644 --- a/src/systemc/ext/systemc.h +++ b/src/systemc/ext/systemc.h @@ -36,6 +36,7 @@ #include "channel/_using.hh" #include "core/_using.hh" #include "dt/_using.hh" +#include "utils/_using.hh" // Include some system header files, and import some symbols from std into // the base namespace. diff --git a/src/systemc/ext/utils/_using.hh b/src/systemc/ext/utils/_using.hh new file mode 100644 index 000000000..e6477c7cb --- /dev/null +++ b/src/systemc/ext/utils/_using.hh @@ -0,0 +1,98 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_UTILS__USING_HH__ +#define __SYSTEMC_EXT_UTILS__USING_HH__ + +#include "_utils.hh" + +using sc_core::sc_severity; +using sc_core::SC_INFO; +using sc_core::SC_WARNING; +using sc_core::SC_ERROR; +using sc_core::SC_FATAL; +using sc_core::SC_MAX_SEVERITY; +using sc_core::sc_verbosity; +using sc_core::SC_NONE; +using sc_core::SC_LOW; +using sc_core::SC_MEDIUM; +using sc_core::SC_HIGH; +using sc_core::SC_FULL; +using sc_core::SC_DEBUG; +using sc_core::sc_report; + +using sc_core::sc_actions; +using sc_core::SC_UNSPECIFIED; +using sc_core::SC_DO_NOTHING; +using sc_core::SC_THROW; +using sc_core::SC_LOG; +using sc_core::SC_DISPLAY; +using sc_core::SC_CACHE_REPORT; +using sc_core::SC_INTERRUPT; +using sc_core::SC_STOP; +using sc_core::SC_ABORT; +using sc_core::sc_report_handler_proc; +using sc_core::sc_report_handler; +using sc_core::sc_interrupt_here; +using sc_core::sc_stop_here; +using sc_core::SC_DEFAULT_INFO_ACTIONS; +using sc_core::SC_DEFAULT_WARNING_ACTIONS; +using sc_core::SC_DEFAULT_ERROR_ACTIONS; +using sc_core::SC_DEFAULT_FATAL_ACTIONS; + +using sc_core::sc_trace_file; +using sc_core::sc_create_vcd_trace_file; +using sc_core::sc_close_vcd_trace_file; +using sc_core::sc_write_comment; +using sc_core::sc_trace; + +using sc_core::sc_exception; + +using sc_core::sc_vector_base; +using sc_core::sc_vector_iter; +using sc_core::sc_vector; +using sc_core::sc_vector_assembly; + +using sc_dt::sc_abs; +using sc_dt::sc_max; +using sc_dt::sc_min; + +using sc_core::sc_version_major; +using sc_core::sc_version_minor; +using sc_core::sc_version_patch; +using sc_core::sc_version_originator; +using sc_core::sc_version_release_date; +using sc_core::sc_version_prerelease; +using sc_core::sc_version_string; +using sc_core::sc_copyright_string; +using sc_core::sc_release; +using sc_core::sc_copyright; +using sc_core::sc_version; + +#endif //__SYSTEMC_EXT_UTILS__USING_HH__ diff --git a/src/systemc/ext/utils/_utils.hh b/src/systemc/ext/utils/_utils.hh new file mode 100644 index 000000000..d76caf9ec --- /dev/null +++ b/src/systemc/ext/utils/_utils.hh @@ -0,0 +1,40 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_UTIL__UTIL_HH__ +#define __SYSTEMC_EXT_UTIL__UTIL_HH__ + +#include "functions.hh" +#include "sc_exception.hh" +#include "sc_report.hh" +#include "sc_report_handler.hh" +#include "sc_trace_file.hh" +#include "sc_vector.hh" + +#endif //__SYSTEMC_EXT_UTIL__UTIL_HH__ diff --git a/src/systemc/ext/utils/endian.hh b/src/systemc/ext/utils/endian.hh new file mode 100644 index 000000000..fcf47e824 --- /dev/null +++ b/src/systemc/ext/utils/endian.hh @@ -0,0 +1,79 @@ +// Copyright 2005 Caleb Epstein +// Copyright 2006 John Maddock +// Copyright 2010 Rene Rivera +// Distributed under the Boost Software License, Version 1.0. (See accompany- +// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +/* + * Copyright (c) 1997 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +/* + * Copyright notice reproduced from <sysc/packages/boost/detail/limits.hpp>, + * from which this code was originally taken. + * + * Modified by Caleb Epstein to use <endian.h> with GNU libc and to + * defined the SC_BOOST_ENDIAN macro. + */ + +#ifndef __SYSTEMC_EXT_UTILS_ENDIAN_HH__ +#define __SYSTEMC_EXT_UTILS_ENDIAN_HH__ + +// GNU libc offers the helpful header <endian.h> which defines +// __BYTE_ORDER + +#if defined (__GLIBC__) +# include <endian.h> +# if (__BYTE_ORDER == __LITTLE_ENDIAN) +# define SC_BOOST_LITTLE_ENDIAN +# elif (__BYTE_ORDER == __BIG_ENDIAN) +# define SC_BOOST_BIG_ENDIAN +# elif (__BYTE_ORDER == __PDP_ENDIAN) +# define SC_BOOST_PDP_ENDIAN +# else +# error Unknown machine endianness detected. +# endif +# define SC_BOOST_BYTE_ORDER __BYTE_ORDER +#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) || \ + defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) || \ + defined(_STLP_BIG_ENDIAN) && !defined(_STLP_LITTLE_ENDIAN) +# define SC_BOOST_BIG_ENDIAN +# define SC_BOOST_BYTE_ORDER 4321 +#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) || \ + defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) || \ + defined(_STLP_LITTLE_ENDIAN) && !defined(_STLP_BIG_ENDIAN) +# define SC_BOOST_LITTLE_ENDIAN +# define SC_BOOST_BYTE_ORDER 1234 +#elif defined(__sparc) || defined(__sparc__) \ + || defined(_POWER) || defined(__powerpc__) \ + || defined(__ppc__) || defined(__ppc64__) \ + || defined(__hpux) || defined(__hppa) \ + || defined(_MIPSEB) || defined(_POWER) \ + || defined(__s390__) +# define SC_BOOST_BIG_ENDIAN +# define SC_BOOST_BYTE_ORDER 4321 +#elif defined(__i386__) || defined(__alpha__) \ + || defined(__ia64) || defined(__ia64__) \ + || defined(_M_IX86) || defined(_M_IA64) \ + || defined(_M_ALPHA) || defined(__amd64) \ + || defined(__amd64__) || defined(_M_AMD64) \ + || defined(__x86_64) || defined(__x86_64__) \ + || defined(_M_X64) || defined(__bfin__) + +# define SC_BOOST_LITTLE_ENDIAN +# define SC_BOOST_BYTE_ORDER 1234 +#else +# error The file boost/detail/endian.hpp needs to be set up for your CPU type. +#endif + + +#endif // __SYSTEMC_EXT_UTILS_ENDIAN_HH__ diff --git a/src/systemc/ext/utils/functions.hh b/src/systemc/ext/utils/functions.hh new file mode 100644 index 000000000..5c259e1b7 --- /dev/null +++ b/src/systemc/ext/utils/functions.hh @@ -0,0 +1,104 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_UTIL_FUNCTIONS_HH__ +#define __SYSTEMC_EXT_UTIL_FUNCTIONS_HH__ + +#include <string> + +namespace sc_dt +{ + +template <class T> +const T +sc_abs(const T &a) +{ + // return ( a >= 0 ? a : -a ); + // the code below is functionaly the same as the code above; the + // difference is that the code below works for all arithmetic + // SystemC datatypes. + T z(a); + z = 0; + if (a >= z) { + return a; + } else { + T c(a); + c = -a; + return c; + } +} + +template <class T> +const T sc_max(const T &a, const T &b) { return ((a >= b) ? a : b); } + +template <class T> +const T sc_min(const T &a, const T &b) { return ((a <= b) ? a : b); } + +} // namespace sc_dt + +namespace sc_core +{ + +#define IEEE_1666_SYSTEMC 201101L + +#define SC_VERSION_MAJOR 0 +#define SC_VERSION_MINOR 1 +#define SC_VERSION_PATCH 0 +#define SC_VERSION_ORIGINATOR "gem5" +#define SC_VERSION_RELEASE_DATE "NA" +#define SC_VERSION_PRERELEASE "beta" +#define SC_IS_PRERELEASE true +#define SC_VERSION "0.1.0_beta-gem5" +#define SC_COPYRIGHT "Copyright 2018 Google, Inc." + +extern const unsigned int sc_version_major; +extern const unsigned int sc_version_minor; +extern const unsigned int sc_version_patch; +extern const std::string sc_version_originator; +extern const std::string sc_version_release_date; +extern const std::string sc_version_prerelease; +extern const bool sc_is_prerelease; +extern const std::string sc_version_string; +extern const std::string sc_copyright_string; + +static inline const char * +sc_release() +{ + return sc_version_string.c_str(); +} +static inline const char * +sc_copyright() +{ + return sc_copyright_string.c_str(); +} +const char *sc_version(); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_UTIL_FUNCTIONS_HH__ diff --git a/src/systemc/ext/utils/sc_exception.hh b/src/systemc/ext/utils/sc_exception.hh new file mode 100644 index 000000000..3bd8fb0f1 --- /dev/null +++ b/src/systemc/ext/utils/sc_exception.hh @@ -0,0 +1,42 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_UTIL_SC_EXCEPTION_HH__ +#define __SYSTEMC_EXT_UTIL_SC_EXCEPTION_HH__ + +#include <exception> + +namespace sc_core +{ + +typedef std::exception sc_exception; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_UTIL_SC_EXCEPTION_HH__ diff --git a/src/systemc/ext/utils/sc_report.hh b/src/systemc/ext/utils/sc_report.hh new file mode 100644 index 000000000..9ba2b334d --- /dev/null +++ b/src/systemc/ext/utils/sc_report.hh @@ -0,0 +1,84 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_UTIL_SC_REPORT_HH__ +#define __SYSTEMC_EXT_UTIL_SC_REPORT_HH__ + +#include <exception> + +namespace sc_core +{ + +class sc_time; + +enum sc_severity +{ + SC_INFO = 0, + SC_WARNING, + SC_ERROR, + SC_FATAL, + SC_MAX_SEVERITY +}; + +enum sc_verbosity +{ + SC_NONE = 0, + SC_LOW = 100, + SC_MEDIUM = 200, + SC_HIGH = 300, + SC_FULL = 400, + SC_DEBUG = 500 +}; + +class sc_report : public std::exception +{ + public: + sc_report(const sc_report &); + sc_report &operator = (const sc_report &); + virtual ~sc_report() throw(); + + sc_severity get_severity() const; + const char *get_msg_type() const; + const char *get_msg() const; + int get_verbosity() const; + const char *get_file_name() const; + int get_line_number() const; + + const sc_time &get_time() const; + const char *get_process_name() const; + + virtual const char *what() const throw(); +}; + +// A non-standard function the Accellera datatypes rely on. +[[noreturn]] void sc_abort(); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_UTIL_SC_REPORT_HH__ diff --git a/src/systemc/ext/utils/sc_report_handler.hh b/src/systemc/ext/utils/sc_report_handler.hh new file mode 100644 index 000000000..7347e5f4a --- /dev/null +++ b/src/systemc/ext/utils/sc_report_handler.hh @@ -0,0 +1,135 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_UTIL_SC_REPORT_HANDLER_HH__ +#define __SYSTEMC_EXT_UTIL_SC_REPORT_HANDLER_HH__ + +#include "sc_report.hh" // for sc_severity + +namespace sc_core +{ + +typedef unsigned sc_actions; + +enum +{ + SC_UNSPECIFIED = 0x0000, + SC_DO_NOTHING = 0x0001, + SC_THROW = 0x0002, + SC_LOG = 0x0004, + SC_DISPLAY = 0x0008, + SC_CACHE_REPORT = 0x0010, + SC_INTERRUPT = 0x0020, + SC_STOP = 0x0040, + SC_ABORT = 0x0080 +}; + +#define SC_DEFAULT_INFO_ACTIONS \ + (::sc_core::SC_LOG | ::sc_core::SC_DISPLAY) +#define SC_DEFAULT_WARNING_ACTIONS \ + (::sc_core::SC_LOG | ::sc_core::SC_DISPLAY) +#define SC_DEFAULT_ERROR_ACTIONS \ + (::sc_core::SC_LOG | ::sc_core::SC_CACHE_REPORT | ::sc_core::SC_THROW) +#define SC_DEFAULT_FATAL_ACTIONS \ + (::sc_core::SC_LOG | ::sc_core::SC_DISPLAY | \ + ::sc_core::SC_CACHE_REPORT | ::sc_core::SC_ABORT) + +typedef void (*sc_report_handler_proc)(const sc_report &, const sc_actions &); + +class sc_report_handler +{ + public: + static void report(sc_severity, const char *msg_type, const char *msg, + const char *file, int line); + static void report(sc_severity, const char *msg_type, const char *msg, + int verbosity, const char *file, int line); + + static sc_actions set_actions(sc_severity, sc_actions=SC_UNSPECIFIED); + static sc_actions set_actions(const char *msg_type, + sc_actions=SC_UNSPECIFIED); + static sc_actions set_actions(const char *msg_type, sc_severity, + sc_actions=SC_UNSPECIFIED); + + static int stop_after(sc_severity, int limit=-1); + static int stop_after(const char *msg_type, int limit=-1); + static int stop_after(const char *msg_type, sc_severity, + sc_actions=SC_UNSPECIFIED); + + static int get_count(sc_severity); + static int get_count(const char *msg_type); + static int get_count(const char *msg_type, sc_severity); + + int set_verbosity_level(int); + int get_verbosity_level(); + + static sc_actions suppress(sc_actions); + static sc_actions suppress(); + static sc_actions force(sc_actions); + static sc_actions force(); + + static void set_handler(sc_report_handler_proc); + static void default_handler(const sc_report &, const sc_actions &); + static sc_actions get_new_action_id(); + + static sc_report *get_cached_report(); + static void clear_cached_report(); + + static bool set_log_file_name(const char *); + static const char *get_log_file_name(); +}; + +#define SC_REPORT_INFO_VERB(msg_type, msg, verbosity) \ + ::sc_core::sc_report_handler::report( \ + ::sc_core::SC_INFO, msg_type, msg, verbosity, __FILE__, __LINE__) + +#define SC_REPORT_INFO(msg_type, msg) \ + ::sc_core::sc_report_handler::report( \ + ::sc_core::SC_INFO, msg_type, msg, __FILE__, __LINE__) + +#define SC_REPORT_WARNING(msg_type, msg) \ + ::sc_core::sc_report_handler::report( \ + ::sc_core::SC_WARNING, msg_type, msg, __FILE__, __LINE__) + +#define SC_REPORT_ERROR(msg_type, msg) \ + ::sc_core::sc_report_handler::report( \ + ::sc_core::SC_ERROR, msg_type, msg, __FILE__, __LINE__) + +#define SC_REPORT_FATAL(msg_type, msg) \ + ::sc_core::sc_report_handler::report( \ + ::sc_core::SC_FATAL, msg_type, msg, __FILE__, __LINE__) + +#define sc_assert(expr) \ + ((void)((expr) ? 0 : (SC_REPORT_FATAL("assertion failed", #expr), 0))) + +void sc_interrupt_here(const char *msg_type, sc_severity); +void sc_stop_here(const char *msg_type, sc_severity); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_UTIL_SC_REPORT_HANDLER_HH__ diff --git a/src/systemc/ext/utils/sc_trace_file.hh b/src/systemc/ext/utils/sc_trace_file.hh new file mode 100644 index 000000000..ec4fd4d6a --- /dev/null +++ b/src/systemc/ext/utils/sc_trace_file.hh @@ -0,0 +1,156 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__ +#define __SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__ + +#include <exception> + +#include "../core/sc_time.hh" +#include "warn_unimpl.hh" + +namespace sc_dt +{ + +class sc_logic; +class sc_int_base; +class sc_uint_base; +class sc_signed; +class sc_unsigned; +class sc_bv_base; +class sc_lv_base; +class sc_fxval; +class sc_fxval_fast; +class sc_fxnum; +class sc_fxnum_fast; + +} // namespace sc_dt + +namespace sc_core +{ + +template <class T> +class sc_signal_in_if; + +class sc_trace_file +{ + public: + virtual void set_time_unit(double, sc_time_unit) = 0; +}; + +sc_trace_file *sc_create_vcd_trace_file(const char *name); +void sc_close_vcd_trace_file(sc_trace_file *tf); +void sc_write_comment(sc_trace_file *tf, const std::string &comment); + +void sc_trace(sc_trace_file *, const bool &, const std::string &); +void sc_trace(sc_trace_file *, const bool *, const std::string &); +void sc_trace(sc_trace_file *, const float &, const std::string &); +void sc_trace(sc_trace_file *, const float *, const std::string &); +void sc_trace(sc_trace_file *, const double &, const std::string &); +void sc_trace(sc_trace_file *, const double *, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_logic &, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_logic *, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_int_base &, + const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_int_base *, + const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_uint_base &, + const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_uint_base *, + const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_signed &, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_signed *, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_unsigned &, + const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_unsigned *, + const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_bv_base &, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_bv_base *, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_lv_base &, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_lv_base *, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_fxval &, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_fxval *, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast &, + const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast *, + const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_fxnum &, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_fxnum *, const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast &, + const std::string &); +void sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast *, + const std::string &); + +void sc_trace(sc_trace_file *, const char &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const char *, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const short &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const short *, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const int &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const int *, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const long &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const long *, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const sc_dt::int64 &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const sc_dt::int64 *, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const sc_dt::uint64 &, + const std::string &, int width=(8 * sizeof(char))); +void sc_trace(sc_trace_file *, const sc_dt::uint64 *, + const std::string &, int width=(8 * sizeof(char))); + +template <class T> +void +sc_trace(sc_trace_file *, const sc_signal_in_if<T> &, const std::string &) +{ + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); +} + +void sc_trace(sc_trace_file *, const sc_signal_in_if<char> &, + const std::string &, int width); + +void sc_trace(sc_trace_file *, const sc_signal_in_if<short> &, + const std::string &, int width); + +void sc_trace(sc_trace_file *, const sc_signal_in_if<int> &, + const std::string &, int width); + +void sc_trace(sc_trace_file *, const sc_signal_in_if<long> &, + const std::string &, int width); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_UTIL_SC_TRACE_FILE_HH__ diff --git a/src/systemc/ext/utils/sc_vector.hh b/src/systemc/ext/utils/sc_vector.hh new file mode 100644 index 000000000..073b17c88 --- /dev/null +++ b/src/systemc/ext/utils/sc_vector.hh @@ -0,0 +1,440 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_UTIL_SC_VECTOR_HH__ +#define __SYSTEMC_EXT_UTIL_SC_VECTOR_HH__ + +#include <stdint.h> + +#include <exception> +#include <vector> + +#include "../core/sc_object.hh" +#include "warn_unimpl.hh" + +namespace sc_core +{ + +template <typename T, typename MT> +class sc_vector_assembly; + +template <typename T> +class sc_vector; + +template <typename T, typename MT> +sc_vector_assembly<T, MT> sc_assemble_vector( + sc_vector<T> &, MT(T::* member_ptr)); + +class sc_vector_base : public sc_object +{ + public: + typedef size_t size_type; + + virtual const char *kind() const { return "sc_vector"; } + size_type size() const; + const std::vector<sc_object *> &get_elements() const; +}; + +template <typename T> +class sc_vector_iter : + public std::iterator<std::random_access_iterator_tag, T> +{ + // Conforms to Random Access Iterator category. + // See ISO/IEC 14882:2003(E), 24.1 [lib.iterator.requirements] + + // Implementation-defined +}; + +template <typename T> +class sc_vector : public sc_vector_base +{ + public: + using sc_vector_base::size_type; + typedef sc_vector_iter<T> iterator; + typedef sc_vector_iter<const T> const_iterator; + + sc_vector() : sc_vector_base() + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + } + explicit sc_vector(const char *) : sc_vector_base() + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + } + sc_vector(const char *, size_type) : sc_vector_base() + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + } + template <typename Creator> + sc_vector(const char *, size_type, Creator) : sc_vector_base() + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual ~sc_vector() {} + + void + init(size_type) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + } + static T * + create_element(const char *, size_type) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return nullptr; + } + + template <typename Creator> + void + init(size_type, Creator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + } + + T & + operator [] (size_type) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return *(T *)nullptr; + } + const T & + operator [] (size_type) const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return *(const T *)nullptr; + } + + T & + at(size_type) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return *(T *)nullptr; + } + const T & + at(size_type) const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return *(const T *)nullptr; + } + + iterator + begin() + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + iterator + end() + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + const_iterator + begin() const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return const_iterator(); + } + const_iterator + end() const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return const_iterator(); + } + + const_iterator + cbegin() const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return const_iterator(); + } + const_iterator + cend() const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return const_iterator(); + } + + template <typename ContainerType, typename ArgumentType> + iterator + bind(sc_vector_assembly<ContainerType, ArgumentType>) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename BindableContainer> + iterator + bind(BindableContainer &) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename BindableIterator> + iterator + bind(BindableIterator, BindableIterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename BindableIterator> + iterator + bind(BindableIterator, BindableIterator, iterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename ContainerType, typename ArgumentType> + iterator + operator () (sc_vector_assembly<ContainerType, ArgumentType> c) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename ArgumentContainer> + iterator + operator () (ArgumentContainer &) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename ArgumentIterator> + iterator + operator () (ArgumentIterator, ArgumentIterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename ArgumentIterator> + iterator + operator () (ArgumentIterator, ArgumentIterator, iterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + private: + // Disabled + sc_vector(const sc_vector &) : sc_vector_base() {} + sc_vector &operator = (const sc_vector &) { return *this; } +}; + +template <typename T, typename MT> +class sc_vector_assembly +{ + public: + friend sc_vector_assembly<T, MT> sc_assemble_vector<>( + sc_vector<T> &, MT(T::* member_ptr)); + + typedef size_t size_type; + // These next two types are supposed to be implementation defined. We'll + // just stick in a substitute for now, but these should probably not just + // be STL vector iterators. + typedef typename std::vector<T>::iterator iterator; + typedef typename std::vector<T>::const_iterator const_iterator; + typedef MT (T::* member_type); + + sc_vector_assembly(const sc_vector_assembly &) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + } + + iterator + begin() + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + iterator + end() + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + const_iterator + cbegin() const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return const_iterator(); + } + const_iterator + cend() const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return const_iterator(); + } + + size_type + size() const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return 0; + } + std::vector<sc_object *> + get_elements() const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return *(std::vector<sc_object *> *)nullptr; + } + + typename iterator::reference + operator [] (size_type) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return typename iterator::reference(); + } + typename const_iterator::reference + operator [] (size_type) const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return typename iterator::reference(); + } + + typename iterator::reference + at(size_type) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return typename iterator::reference(); + } + typename const_iterator::reference + at(size_type) const + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return typename iterator::reference(); + } + + template <typename ContainerType, typename ArgumentType> + iterator + bind(sc_vector_assembly<ContainerType, ArgumentType>) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename BindableContainer> + iterator + bind(BindableContainer &) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename BindableIterator> + iterator + bind(BindableIterator, BindableIterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename BindableIterator> + iterator + bind(BindableIterator, BindableIterator, iterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename BindableIterator> + iterator + bind(BindableIterator, BindableIterator, typename sc_vector<T>::iterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename ContainerType, typename ArgumentType> + iterator + operator () (sc_vector_assembly<ContainerType, ArgumentType>) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename ArgumentContainer> + iterator + operator () (ArgumentContainer &) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename ArgumentIterator> + iterator + operator () (ArgumentIterator, ArgumentIterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename ArgumentIterator> + iterator + operator () (ArgumentIterator, ArgumentIterator, iterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + template <typename ArgumentIterator> + iterator + operator () (ArgumentIterator, ArgumentIterator, + typename sc_vector<T>::iterator) + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return iterator(); + } + + private: + // Temporary constructor which will (eventually) actually bind an + // sc_vector_assembly instance to an sc_vector. + sc_vector_assembly<T, MT>() + { + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + } +}; + +template <typename T, typename MT> +sc_vector_assembly<T, MT> +sc_assemble_vector(sc_vector<T> &, MT(T::* member_ptr)) +{ + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return sc_vector_assembly<T, MT>(); +} + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_UTIL_SC_VECTOR_HH__ diff --git a/src/systemc/ext/utils/warn_unimpl.hh b/src/systemc/ext/utils/warn_unimpl.hh new file mode 100644 index 000000000..77873faaf --- /dev/null +++ b/src/systemc/ext/utils/warn_unimpl.hh @@ -0,0 +1,40 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_UTILS_WARN_UNIMPL_HH__ +#define __SYSTEMC_EXT_UTILS_WARN_UNIMPL_HH__ + +namespace sc_core +{ + +void sc_utils_warn_unimpl(const char *func); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_UTILS_WARN_UNIMPL_HH__ diff --git a/src/systemc/utils/SConscript b/src/systemc/utils/SConscript new file mode 100644 index 000000000..f925293ac --- /dev/null +++ b/src/systemc/utils/SConscript @@ -0,0 +1,36 @@ +# Copyright 2018 Google, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer; +# redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution; +# neither the name of the copyright holders nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# Authors: Gabe Black + +Import('*') + +if env['USE_SYSTEMC']: + Source('functions.cc') + Source('sc_report.cc') + Source('sc_report_handler.cc') + Source('sc_trace_file.cc') + Source('sc_vector.cc') + Source('warn_unimpl.cc') diff --git a/src/systemc/utils/functions.cc b/src/systemc/utils/functions.cc new file mode 100644 index 000000000..dca7e20ce --- /dev/null +++ b/src/systemc/utils/functions.cc @@ -0,0 +1,53 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#include "systemc/ext/utils/functions.hh" + +namespace sc_core +{ + +const unsigned int sc_version_major = SC_VERSION_MAJOR; +const unsigned int sc_version_minor = SC_VERSION_MINOR; +const unsigned int sc_version_patch = SC_VERSION_PATCH; +const std::string sc_version_originator = SC_VERSION_ORIGINATOR; +const std::string sc_version_release_date = SC_VERSION_RELEASE_DATE; +const std::string sc_version_prerelease = SC_VERSION_PRERELEASE; +const bool sc_is_prerelease = SC_IS_PRERELEASE; +const std::string sc_version_string = SC_VERSION; +const std::string sc_copyright_string = SC_COPYRIGHT; + +const char * +sc_version() +{ + static const char systemc_version[] = + "SystemC " SC_VERSION " --- " __DATE__ " " __TIME__; + return systemc_version; +} + +} // namespace sc_core diff --git a/src/systemc/utils/sc_report.cc b/src/systemc/utils/sc_report.cc new file mode 100644 index 000000000..0e6b8b0bd --- /dev/null +++ b/src/systemc/utils/sc_report.cc @@ -0,0 +1,119 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#include "base/logging.hh" +#include "systemc/ext/utils/sc_report.hh" + +namespace sc_core +{ + +sc_report::sc_report(const sc_report &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_report & +sc_report::operator = (const sc_report &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_report::~sc_report() throw() {} + +sc_severity +sc_report::get_severity() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_FATAL; +} + +const char * +sc_report::get_msg_type() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +const char * +sc_report::get_msg() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +int +sc_report::get_verbosity() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_NONE; +} + +const char * +sc_report::get_file_name() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +int +sc_report::get_line_number() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +const sc_time & +sc_report::get_time() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const sc_time *)nullptr; +} + +const char * +sc_report::get_process_name() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +const char * +sc_report::what() const throw() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +void +sc_abort() +{ + panic("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +} // namespace sc_core diff --git a/src/systemc/utils/sc_report_handler.cc b/src/systemc/utils/sc_report_handler.cc new file mode 100644 index 000000000..3bb905044 --- /dev/null +++ b/src/systemc/utils/sc_report_handler.cc @@ -0,0 +1,215 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#include "base/logging.hh" +#include "systemc/ext/utils/sc_report_handler.hh" + +namespace sc_core +{ + +void +sc_report_handler::report(sc_severity, const char *msg_type, const char *msg, + const char *file, int line) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_report_handler::report(sc_severity, const char *msg_type, const char *msg, + int verbosity, const char *file, int line) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_actions +sc_report_handler::set_actions(sc_severity, sc_actions) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_UNSPECIFIED; +} + +sc_actions +sc_report_handler::set_actions(const char *msg_type, sc_actions) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_UNSPECIFIED; +} + +sc_actions +sc_report_handler::set_actions(const char *msg_type, sc_severity, sc_actions) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_UNSPECIFIED; +} + +int +sc_report_handler::stop_after(sc_severity, int limit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +int +sc_report_handler::stop_after(const char *msg_type, int limit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +int +sc_report_handler::stop_after(const char *msg_type, sc_severity, sc_actions) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +int +sc_report_handler::get_count(sc_severity) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +int +sc_report_handler::get_count(const char *msg_type) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +int +sc_report_handler::get_count(const char *msg_type, sc_severity) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +int +sc_report_handler::set_verbosity_level(int) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +int +sc_report_handler::get_verbosity_level() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + + +sc_actions +sc_report_handler::suppress(sc_actions) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_UNSPECIFIED; +} + +sc_actions +sc_report_handler::suppress() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_UNSPECIFIED; +} + +sc_actions +sc_report_handler::force(sc_actions) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_UNSPECIFIED; +} + +sc_actions +sc_report_handler::force() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_UNSPECIFIED; +} + + +void +sc_report_handler::set_handler(sc_report_handler_proc) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_report_handler::default_handler(const sc_report &, const sc_actions &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_actions +sc_report_handler::get_new_action_id() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_UNSPECIFIED; +} + +sc_report * +sc_report_handler::get_cached_report() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return nullptr; +} + +void +sc_report_handler::clear_cached_report() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +bool +sc_report_handler::set_log_file_name(const char *) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +const char * +sc_report_handler::get_log_file_name() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return nullptr; +} + +void +sc_interrupt_here(const char *msg_type, sc_severity) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_stop_here(const char *msg_type, sc_severity) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +} // namespace sc_core diff --git a/src/systemc/utils/sc_trace_file.cc b/src/systemc/utils/sc_trace_file.cc new file mode 100644 index 000000000..3b09d951d --- /dev/null +++ b/src/systemc/utils/sc_trace_file.cc @@ -0,0 +1,325 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#include "base/logging.hh" +#include "systemc/ext/utils/sc_trace_file.hh" + +namespace sc_core +{ + +sc_trace_file * +sc_create_vcd_trace_file(const char *name) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return nullptr; +} + +void +sc_close_vcd_trace_file(sc_trace_file *tf) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_write_comment(sc_trace_file *tf, const std::string &comment) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const bool &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const bool *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const float &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const float *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const double &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const double *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_logic &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_logic *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_int_base &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_int_base *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_uint_base &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_uint_base *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_signed &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_signed *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_unsigned &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_unsigned *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_bv_base &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_bv_base *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_lv_base &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_lv_base *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_fxval &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_fxval *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_fxval_fast *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_fxnum &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_fxnum *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast &, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::sc_fxnum_fast *, const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const char &, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const char *, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const short &, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const short *, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const int &, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const int *, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const long &, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const long *, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::int64 &, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::int64 *, const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::uint64 &, + const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_dt::uint64 *, + const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_signal_in_if<char> &, + const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_signal_in_if<short> &, + const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_signal_in_if<int> &, + const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_trace(sc_trace_file *, const sc_signal_in_if<long> &, + const std::string &, int width) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +} // namespace sc_core diff --git a/src/systemc/utils/sc_vector.cc b/src/systemc/utils/sc_vector.cc new file mode 100644 index 000000000..ed59b734f --- /dev/null +++ b/src/systemc/utils/sc_vector.cc @@ -0,0 +1,49 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#include "systemc/ext/utils/sc_vector.hh" + +namespace sc_core +{ + +sc_vector_base::size_type +sc_vector_base::size() const +{ + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return 0; +} + +const std::vector<sc_object *> & +sc_vector_base::get_elements() const +{ + sc_utils_warn_unimpl(__PRETTY_FUNCTION__); + return *(const std::vector<sc_object *> *)nullptr; +} + +} // namespace sc_core diff --git a/src/systemc/utils/warn_unimpl.cc b/src/systemc/utils/warn_unimpl.cc new file mode 100644 index 000000000..f96e60487 --- /dev/null +++ b/src/systemc/utils/warn_unimpl.cc @@ -0,0 +1,42 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#include "base/logging.hh" +#include "systemc/ext/utils/warn_unimpl.hh" + +namespace sc_core +{ + +void +sc_utils_warn_unimpl(const char *func) +{ + warn("%s not implemented.\n", func); +} + +} // namespace sc_core |