From a60868f5d5ddf565ddb8ce340ad6f1509f3cdf41 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Tue, 8 May 2018 19:01:17 -0700 Subject: systemc: Seperate the "external" header interface. Most (but not all) of the SystemC headers are part of the "external" interface that an existing, standard compliant module would include through or . Since those follow slightly different rules (relative includes, no gem5 includes), this change separates them out so that they're easier to identify. Also, this change moves the other files into a "core" subdirectory, with the intention to add a "dt", aka data type, directory some time in the future when those standard defined types are implemented. Change-Id: Ida63f9cc0bc0431024d4dd691cc5b22b944a99a8 Reviewed-on: https://gem5-review.googlesource.com/10835 Reviewed-by: Jason Lowe-Power Maintainer: Gabe Black --- src/systemc/SConscript | 46 --- src/systemc/SystemC.py | 63 ---- src/systemc/core/SConscript | 46 +++ src/systemc/core/SystemC.py | 63 ++++ src/systemc/core/kernel.cc | 45 +++ src/systemc/core/kernel.hh | 55 ++++ src/systemc/core/sc_attr.cc | 92 ++++++ src/systemc/core/sc_event.cc | 322 +++++++++++++++++++ src/systemc/core/sc_export.cc | 42 +++ src/systemc/core/sc_interface.cc | 59 ++++ src/systemc/core/sc_main.cc | 124 ++++++++ src/systemc/core/sc_module.cc | 542 ++++++++++++++++++++++++++++++++ src/systemc/core/sc_module_name.cc | 59 ++++ src/systemc/core/sc_object.cc | 177 +++++++++++ src/systemc/core/sc_port.cc | 42 +++ src/systemc/core/sc_prim.cc | 215 +++++++++++++ src/systemc/core/sc_sensitive.cc | 64 ++++ src/systemc/core/sc_time.cc | 232 ++++++++++++++ src/systemc/dt/int/sc_nbdefs.hh | 168 ---------- src/systemc/ext/core/sc_attr.hh | 98 ++++++ src/systemc/ext/core/sc_event.hh | 151 +++++++++ src/systemc/ext/core/sc_export.hh | 101 ++++++ src/systemc/ext/core/sc_interface.hh | 57 ++++ src/systemc/ext/core/sc_main.hh | 44 +++ src/systemc/ext/core/sc_module.hh | 246 +++++++++++++++ src/systemc/ext/core/sc_module_name.hh | 56 ++++ src/systemc/ext/core/sc_object.hh | 80 +++++ src/systemc/ext/core/sc_port.hh | 192 ++++++++++++ src/systemc/ext/core/sc_prim.hh | 97 ++++++ src/systemc/ext/core/sc_sensitive.hh | 52 ++++ src/systemc/ext/core/sc_time.hh | 98 ++++++ src/systemc/ext/dt/int/sc_nbdefs.hh | 168 ++++++++++ src/systemc/kernel.cc | 45 --- src/systemc/kernel.hh | 55 ---- src/systemc/sc_attr.cc | 93 ------ src/systemc/sc_attr.hh | 98 ------ src/systemc/sc_event.cc | 323 -------------------- src/systemc/sc_event.hh | 151 --------- src/systemc/sc_export.cc | 43 --- src/systemc/sc_export.hh | 101 ------ src/systemc/sc_interface.cc | 60 ---- src/systemc/sc_interface.hh | 57 ---- src/systemc/sc_main.cc | 125 -------- src/systemc/sc_main.hh | 44 --- src/systemc/sc_module.cc | 543 --------------------------------- src/systemc/sc_module.hh | 246 --------------- src/systemc/sc_module_name.cc | 60 ---- src/systemc/sc_module_name.hh | 56 ---- src/systemc/sc_object.cc | 178 ----------- src/systemc/sc_object.hh | 80 ----- src/systemc/sc_port.cc | 43 --- src/systemc/sc_port.hh | 192 ------------ src/systemc/sc_prim.cc | 216 ------------- src/systemc/sc_prim.hh | 97 ------ src/systemc/sc_sensitive.cc | 65 ---- src/systemc/sc_sensitive.hh | 52 ---- src/systemc/sc_time.cc | 233 -------------- src/systemc/sc_time.hh | 98 ------ 58 files changed, 3619 insertions(+), 3631 deletions(-) delete mode 100644 src/systemc/SConscript delete mode 100644 src/systemc/SystemC.py create mode 100644 src/systemc/core/SConscript create mode 100644 src/systemc/core/SystemC.py create mode 100644 src/systemc/core/kernel.cc create mode 100644 src/systemc/core/kernel.hh create mode 100644 src/systemc/core/sc_attr.cc create mode 100644 src/systemc/core/sc_event.cc create mode 100644 src/systemc/core/sc_export.cc create mode 100644 src/systemc/core/sc_interface.cc create mode 100644 src/systemc/core/sc_main.cc create mode 100644 src/systemc/core/sc_module.cc create mode 100644 src/systemc/core/sc_module_name.cc create mode 100644 src/systemc/core/sc_object.cc create mode 100644 src/systemc/core/sc_port.cc create mode 100644 src/systemc/core/sc_prim.cc create mode 100644 src/systemc/core/sc_sensitive.cc create mode 100644 src/systemc/core/sc_time.cc delete mode 100644 src/systemc/dt/int/sc_nbdefs.hh create mode 100644 src/systemc/ext/core/sc_attr.hh create mode 100644 src/systemc/ext/core/sc_event.hh create mode 100644 src/systemc/ext/core/sc_export.hh create mode 100644 src/systemc/ext/core/sc_interface.hh create mode 100644 src/systemc/ext/core/sc_main.hh create mode 100644 src/systemc/ext/core/sc_module.hh create mode 100644 src/systemc/ext/core/sc_module_name.hh create mode 100644 src/systemc/ext/core/sc_object.hh create mode 100644 src/systemc/ext/core/sc_port.hh create mode 100644 src/systemc/ext/core/sc_prim.hh create mode 100644 src/systemc/ext/core/sc_sensitive.hh create mode 100644 src/systemc/ext/core/sc_time.hh create mode 100644 src/systemc/ext/dt/int/sc_nbdefs.hh delete mode 100644 src/systemc/kernel.cc delete mode 100644 src/systemc/kernel.hh delete mode 100644 src/systemc/sc_attr.cc delete mode 100644 src/systemc/sc_attr.hh delete mode 100644 src/systemc/sc_event.cc delete mode 100644 src/systemc/sc_event.hh delete mode 100644 src/systemc/sc_export.cc delete mode 100644 src/systemc/sc_export.hh delete mode 100644 src/systemc/sc_interface.cc delete mode 100644 src/systemc/sc_interface.hh delete mode 100644 src/systemc/sc_main.cc delete mode 100644 src/systemc/sc_main.hh delete mode 100644 src/systemc/sc_module.cc delete mode 100644 src/systemc/sc_module.hh delete mode 100644 src/systemc/sc_module_name.cc delete mode 100644 src/systemc/sc_module_name.hh delete mode 100644 src/systemc/sc_object.cc delete mode 100644 src/systemc/sc_object.hh delete mode 100644 src/systemc/sc_port.cc delete mode 100644 src/systemc/sc_port.hh delete mode 100644 src/systemc/sc_prim.cc delete mode 100644 src/systemc/sc_prim.hh delete mode 100644 src/systemc/sc_sensitive.cc delete mode 100644 src/systemc/sc_sensitive.hh delete mode 100644 src/systemc/sc_time.cc delete mode 100644 src/systemc/sc_time.hh diff --git a/src/systemc/SConscript b/src/systemc/SConscript deleted file mode 100644 index a94eb0012..000000000 --- a/src/systemc/SConscript +++ /dev/null @@ -1,46 +0,0 @@ -# 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']: - SimObject('SystemC.py') - - Source('kernel.cc') - - Source('sc_attr.cc') - Source('sc_event.cc') - Source('sc_export.cc') - Source('sc_interface.cc') - Source('sc_main.cc') - Source('sc_module.cc') - Source('sc_module_name.cc') - Source('sc_object.cc') - Source('sc_port.cc') - Source('sc_prim.cc') - Source('sc_sensitive.cc') - Source('sc_time.cc') diff --git a/src/systemc/SystemC.py b/src/systemc/SystemC.py deleted file mode 100644 index bc04ed69c..000000000 --- a/src/systemc/SystemC.py +++ /dev/null @@ -1,63 +0,0 @@ -# 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 - -from m5.SimObject import SimObject - -# This class represents the systemc kernel. There should be exactly one in the -# simulation. It receives gem5 SimObject lifecycle callbacks (init, regStats, -# etc.) and manages the lifecycle of the systemc simulation accordingly. -# It also acts as a collecting point for systemc related control functionality. -class SystemC_Kernel(SimObject): - type = 'SystemC_Kernel' - cxx_class = 'SystemC::Kernel' - cxx_header = 'systemc/kernel.hh' - - def sc_main(self, *args): - '''Call the systemc sc_main function with the given string args''' - from _m5.systemc import sc_main - sc_main(*args) - -# This class represents systemc sc_object instances in python config files. It -# inherits from SimObject in python, but the c++ version, sc_core::sc_object, -# doesn't inherit from gem5's c++ SimObject class. -class SystemC_ScObject(SimObject): - type = 'SystemC_ScObject' - abstract = True - cxx_class = 'sc_core::sc_object' - cxx_header = 'systemc/sc_object.hh' - - # Clear cxx_base to stop the c++ binding code from assuming - # sc_core::sc_object inherits from SimObject, even though SystemC_ScObject - # does on the python side. - cxx_base = None - - # Hide the cxx_exports from SimObject since we don't inherit from - # SimObject on the c++ side and so don't have those methods to call down - # into. - locals().update({ - method.name: (lambda *a, **k: None) for method in SimObject.cxx_exports - }) diff --git a/src/systemc/core/SConscript b/src/systemc/core/SConscript new file mode 100644 index 000000000..a94eb0012 --- /dev/null +++ b/src/systemc/core/SConscript @@ -0,0 +1,46 @@ +# 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']: + SimObject('SystemC.py') + + Source('kernel.cc') + + Source('sc_attr.cc') + Source('sc_event.cc') + Source('sc_export.cc') + Source('sc_interface.cc') + Source('sc_main.cc') + Source('sc_module.cc') + Source('sc_module_name.cc') + Source('sc_object.cc') + Source('sc_port.cc') + Source('sc_prim.cc') + Source('sc_sensitive.cc') + Source('sc_time.cc') diff --git a/src/systemc/core/SystemC.py b/src/systemc/core/SystemC.py new file mode 100644 index 000000000..41fecb2c2 --- /dev/null +++ b/src/systemc/core/SystemC.py @@ -0,0 +1,63 @@ +# 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 + +from m5.SimObject import SimObject + +# This class represents the systemc kernel. There should be exactly one in the +# simulation. It receives gem5 SimObject lifecycle callbacks (init, regStats, +# etc.) and manages the lifecycle of the systemc simulation accordingly. +# It also acts as a collecting point for systemc related control functionality. +class SystemC_Kernel(SimObject): + type = 'SystemC_Kernel' + cxx_class = 'SystemC::Kernel' + cxx_header = 'systemc/core/kernel.hh' + + def sc_main(self, *args): + '''Call the systemc sc_main function with the given string args''' + from _m5.systemc import sc_main + sc_main(*args) + +# This class represents systemc sc_object instances in python config files. It +# inherits from SimObject in python, but the c++ version, sc_core::sc_object, +# doesn't inherit from gem5's c++ SimObject class. +class SystemC_ScObject(SimObject): + type = 'SystemC_ScObject' + abstract = True + cxx_class = 'sc_core::sc_object' + cxx_header = 'systemc/ext/core/sc_object.hh' + + # Clear cxx_base to stop the c++ binding code from assuming + # sc_core::sc_object inherits from SimObject, even though SystemC_ScObject + # does on the python side. + cxx_base = None + + # Hide the cxx_exports from SimObject since we don't inherit from + # SimObject on the c++ side and so don't have those methods to call down + # into. + locals().update({ + method.name: (lambda *a, **k: None) for method in SimObject.cxx_exports + }) diff --git a/src/systemc/core/kernel.cc b/src/systemc/core/kernel.cc new file mode 100644 index 000000000..288a037cc --- /dev/null +++ b/src/systemc/core/kernel.cc @@ -0,0 +1,45 @@ +/* + * 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/core/kernel.hh" + +namespace SystemC +{ + +Kernel::Kernel(Params *params) : SimObject(params) +{ +} + +} // namespace SystemC + +SystemC::Kernel * +SystemC_KernelParams::create() +{ + return new SystemC::Kernel(this); +} diff --git a/src/systemc/core/kernel.hh b/src/systemc/core/kernel.hh new file mode 100644 index 000000000..9a81d9db4 --- /dev/null +++ b/src/systemc/core/kernel.hh @@ -0,0 +1,55 @@ +/* + * 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_KERNEL_HH__ +#define __SYSTEMC_KERNEL_HH__ + +#include "params/SystemC_Kernel.hh" +#include "sim/sim_object.hh" + +namespace SystemC +{ + +/* + * This class represents the systemc kernel. There should be exactly one in + * the simulation. It receives gem5 SimObject lifecycle callbacks (init, + * regStats, etc.) and manages the lifecycle of the systemc simulation + * accordingly. It also acts as a collecting point for systemc related + * control functionality. + */ +class Kernel : public SimObject +{ + public: + typedef SystemC_KernelParams Params; + Kernel(Params *params); +}; + +} // namespace SystemC + +#endif // __SYSTEMC_KERNEL_H__ diff --git a/src/systemc/core/sc_attr.cc b/src/systemc/core/sc_attr.cc new file mode 100644 index 000000000..28e0b6010 --- /dev/null +++ b/src/systemc/core/sc_attr.cc @@ -0,0 +1,92 @@ +/* + * 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/core/sc_attr.hh" + +namespace sc_core +{ + +sc_attr_base::sc_attr_base(const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_attr_base::sc_attr_base(const sc_attr_base &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_attr_base::~sc_attr_base() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const std::string & +sc_attr_base::name() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const std::string *)nullptr; +} + +void +sc_attr_base::warn_unimpl(const char *func) +{ + warn("%s not implemented.\n", func); +} + +sc_attr_cltn::iterator +sc_attr_cltn::begin() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return (iterator)nullptr; +} + +sc_attr_cltn::const_iterator +sc_attr_cltn::begin() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return (const_iterator)nullptr; +} + +sc_attr_cltn::iterator +sc_attr_cltn::end() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return (iterator)nullptr; +} + +sc_attr_cltn::const_iterator +sc_attr_cltn::end() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return (const_iterator)nullptr; +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_event.cc b/src/systemc/core/sc_event.cc new file mode 100644 index 000000000..0cdab2a50 --- /dev/null +++ b/src/systemc/core/sc_event.cc @@ -0,0 +1,322 @@ +/* + * 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/core/sc_event.hh" + +namespace sc_core +{ + +void +sc_event_finder::warn_unimpl(const char *func) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_and_list::sc_event_and_list() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_and_list::sc_event_and_list(const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_and_list::sc_event_and_list(const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_and_list & +sc_event_and_list::operator = (const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +int +sc_event_and_list::size() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +void +sc_event_and_list::swap(sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_and_list & +sc_event_and_list::operator &= (const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_event_and_list & +sc_event_and_list::operator &= (const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_event_and_expr +sc_event_and_list::operator & (const sc_event &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_event_and_expr(); +} + +sc_event_and_expr +sc_event_and_list::operator & (const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_event_and_expr(); +} + +sc_event_or_list::sc_event_or_list() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_or_list::sc_event_or_list(const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_or_list::sc_event_or_list(const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_or_list& +sc_event_or_list::operator = (const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_event_or_list::~sc_event_or_list() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +int +sc_event_or_list::size() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +void +sc_event_or_list::swap(sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_or_list & +sc_event_or_list::operator |= (const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_event_or_list & +sc_event_or_list::operator |= (const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_event_or_expr +sc_event_or_list::operator | (const sc_event &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_event_or_expr(); +} + +sc_event_or_expr +sc_event_or_list::operator | (const sc_event_or_list &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_event_or_expr(); +} + +sc_event_and_expr::operator const sc_event_and_list &() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const sc_event_and_list *)nullptr; +} + +sc_event_and_expr +operator & (sc_event_and_expr expr, sc_event const &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return expr; +} + +sc_event_and_expr +operator & (sc_event_and_expr expr, sc_event_and_list const &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return expr; +} + +sc_event_or_expr::operator const sc_event_or_list &() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const sc_event_or_list *)nullptr; +} + +sc_event_or_expr +operator | (sc_event_or_expr expr, sc_event const &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return expr; +} + +sc_event_or_expr +operator | (sc_event_or_expr expr, sc_event_or_list const &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return expr; +} + +sc_event::sc_event() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event::sc_event(const char *) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event::~sc_event() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const char * +sc_event::name() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +const char * +sc_event::basename() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +bool +sc_event::in_hierarchy() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +sc_object * +sc_event::get_parent_object() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return (sc_object *)nullptr; +} + +void +sc_event::notify() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_event::notify(const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_event::notify(double, sc_time_unit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_event::cancel() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_event_and_expr +sc_event::operator & (const sc_event &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_event_and_expr(); +} + +sc_event_and_expr +sc_event::operator & (const sc_event_and_list &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_event_and_expr(); +} + +sc_event_or_expr +sc_event::operator | (const sc_event &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_event_or_expr(); +} + +sc_event_or_expr +sc_event::operator | (const sc_event_or_list &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_event_or_expr(); +} + +const std::vector & +sc_get_top_level_events() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const std::vector *)nullptr; +} + +sc_event * +sc_find_event(const char *) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return (sc_event *)nullptr; +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_export.cc b/src/systemc/core/sc_export.cc new file mode 100644 index 000000000..387b8a7fd --- /dev/null +++ b/src/systemc/core/sc_export.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/core/sc_export.hh" + +namespace sc_core +{ + +void +sc_export_base::warn_unimpl(const char *func) const +{ + warn("%s not implemented.\n", func); +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_interface.cc b/src/systemc/core/sc_interface.cc new file mode 100644 index 000000000..e01bdccfd --- /dev/null +++ b/src/systemc/core/sc_interface.cc @@ -0,0 +1,59 @@ +/* + * 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/core/sc_interface.hh" + +namespace sc_core +{ + +void +sc_interface::register_port(sc_port_base &, const char *) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const sc_event & +sc_interface::default_event() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(sc_event *)nullptr; +} + +sc_interface::~sc_interface() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_interface::sc_interface() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc new file mode 100644 index 000000000..5a6108a6b --- /dev/null +++ b/src/systemc/core/sc_main.cc @@ -0,0 +1,124 @@ +/* + * 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 + +#include "base/logging.hh" +#include "python/pybind11/pybind.hh" +#include "sim/init.hh" +#include "systemc/ext/core/sc_main.hh" + +// A default version of this function in case one isn't otherwise defined. +// This ensures everything will link properly whether or not the user defined +// a custom sc_main function. If they didn't but still try to call it, throw +// an error and die. +[[gnu::weak]] int +sc_main(int argc, char *argv[]) +{ + // If python attempts to call sc_main but no sc_main was defined... + fatal("sc_main called but not defined.\n"); +} + +namespace sc_core +{ + +namespace +{ + +bool scMainCalled = false; + +int _argc = 0; +char **_argv = NULL; + +// This wrapper adapts the python version of sc_main to the c++ version. +void +sc_main(pybind11::args args) +{ + panic_if(scMainCalled, "sc_main called more than once."); + + _argc = args.size(); + _argv = new char *[_argc]; + + // Initialize all the _argvs to NULL so we can delete [] them + // unconditionally. + for (int idx = 0; idx < _argc; idx++) + _argv[idx] = NULL; + + // Attempt to convert all the arguments to strings. If that fails, clean + // up after ourselves. Also don't count this as a call to sc_main since + // we never got to the c++ version of that function. + try { + for (int idx = 0; idx < _argc; idx++) { + std::string arg = args[idx].cast(); + _argv[idx] = new char[arg.length() + 1]; + strcpy(_argv[idx], arg.c_str()); + } + } catch (...) { + // If that didn't work for some reason (probably a conversion error) + // blow away _argv and _argc and pass on the exception. + for (int idx = 0; idx < _argc; idx++) + delete [] _argv[idx]; + delete [] _argv; + _argc = 0; + throw; + } + + // At this point we're going to call the c++ sc_main, so we can't try + // again later. + scMainCalled = true; + + //TODO Start a new fiber to call sc_main from. + ::sc_main(_argc, _argv); +} + +// Make our sc_main wrapper available in the internal _m5 python module under +// the systemc submodule. +void +systemc_pybind(pybind11::module &m_internal) +{ + pybind11::module m = m_internal.def_submodule("systemc"); + m.def("sc_main", &sc_main); +} +EmbeddedPyBind embed_("systemc", &systemc_pybind); + +} // anonymous namespace + +int +sc_argc() +{ + return _argc; +} + +const char *const * +sc_argv() +{ + return _argv; +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc new file mode 100644 index 000000000..6bbb9dca6 --- /dev/null +++ b/src/systemc/core/sc_module.cc @@ -0,0 +1,542 @@ +/* + * 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/core/sc_module.hh" + +namespace sc_core +{ + +sc_bind_proxy::sc_bind_proxy(const sc_interface &interface) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_bind_proxy::sc_bind_proxy(const sc_port_base &port) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr); + +sc_module::~sc_module() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const char * +sc_module::kind() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +const sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr); + +void +sc_module::operator () (const sc_bind_proxy &p001, + const sc_bind_proxy &p002, + const sc_bind_proxy &p003, + const sc_bind_proxy &p004, + const sc_bind_proxy &p005, + const sc_bind_proxy &p006, + const sc_bind_proxy &p007, + const sc_bind_proxy &p008, + const sc_bind_proxy &p009, + const sc_bind_proxy &p010, + const sc_bind_proxy &p011, + const sc_bind_proxy &p012, + const sc_bind_proxy &p013, + const sc_bind_proxy &p014, + const sc_bind_proxy &p015, + const sc_bind_proxy &p016, + const sc_bind_proxy &p017, + const sc_bind_proxy &p018, + const sc_bind_proxy &p019, + const sc_bind_proxy &p020, + const sc_bind_proxy &p021, + const sc_bind_proxy &p022, + const sc_bind_proxy &p023, + const sc_bind_proxy &p024, + const sc_bind_proxy &p025, + const sc_bind_proxy &p026, + const sc_bind_proxy &p027, + const sc_bind_proxy &p028, + const sc_bind_proxy &p029, + const sc_bind_proxy &p030, + const sc_bind_proxy &p031, + const sc_bind_proxy &p032, + const sc_bind_proxy &p033, + const sc_bind_proxy &p034, + const sc_bind_proxy &p035, + const sc_bind_proxy &p036, + const sc_bind_proxy &p037, + const sc_bind_proxy &p038, + const sc_bind_proxy &p039, + const sc_bind_proxy &p040, + const sc_bind_proxy &p041, + const sc_bind_proxy &p042, + const sc_bind_proxy &p043, + const sc_bind_proxy &p044, + const sc_bind_proxy &p045, + const sc_bind_proxy &p046, + const sc_bind_proxy &p047, + const sc_bind_proxy &p048, + const sc_bind_proxy &p049, + const sc_bind_proxy &p050, + const sc_bind_proxy &p051, + const sc_bind_proxy &p052, + const sc_bind_proxy &p053, + const sc_bind_proxy &p054, + const sc_bind_proxy &p055, + const sc_bind_proxy &p056, + const sc_bind_proxy &p057, + const sc_bind_proxy &p058, + const sc_bind_proxy &p059, + const sc_bind_proxy &p060, + const sc_bind_proxy &p061, + const sc_bind_proxy &p062, + const sc_bind_proxy &p063, + const sc_bind_proxy &p064) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const std::vector & +sc_module::get_child_objects() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const std::vector *)nullptr; +} + +const std::vector & +sc_module::get_child_events() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const std::vector *)nullptr; +} + +sc_module::sc_module(const sc_module_name &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_module::sc_module() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::reset_signal_is(const sc_in &, bool) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::reset_signal_is(const sc_inout &, bool) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::reset_signal_is(const sc_out &, bool) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::reset_signal_is(const sc_signal_in_if &, bool) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + + +void +sc_module::async_reset_signal_is(const sc_in &, bool) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::async_reset_signal_is(const sc_inout &, bool) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::async_reset_signal_is(const sc_out &, bool) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::async_reset_signal_is(const sc_signal_in_if &, bool) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + + +void +sc_module::dont_initialize() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::set_stack_size(size_t) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + + +void +sc_module::next_trigger() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(double, sc_time_unit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(const sc_time &, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(double, sc_time_unit, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(const sc_time &, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(double, sc_time_unit, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(const sc_time &, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::next_trigger(double, sc_time_unit, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + + +void +sc_module::wait() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(int) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(double, sc_time_unit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(const sc_time &, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(double, sc_time_unit, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(const sc_time &, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(double, sc_time_unit, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(const sc_time &, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_module::wait(double, sc_time_unit, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + + +void +next_trigger() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(double, sc_time_unit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(const sc_time &, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(double, sc_time_unit, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(const sc_time &, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(double, sc_time_unit, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(const sc_time &, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +next_trigger(double, sc_time_unit, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + + +void +wait() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(int) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(double, sc_time_unit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(const sc_time &, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(double, sc_time_unit, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(const sc_time &, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(double, sc_time_unit, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(const sc_time &, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +wait(double, sc_time_unit, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const char * +sc_gen_unique_name(const char *) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +bool +sc_start_of_simulation_invoked() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +bool +sc_end_of_simulation_invoked() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_module_name.cc b/src/systemc/core/sc_module_name.cc new file mode 100644 index 000000000..2646d431a --- /dev/null +++ b/src/systemc/core/sc_module_name.cc @@ -0,0 +1,59 @@ +/* + * 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/core/sc_module_name.hh" + +namespace sc_core +{ + +sc_module_name::sc_module_name(const char *name) : + _name(name), _on_the_stack(true) +{ + warn("%s: Module name not added to stack.\n", __PRETTY_FUNCTION__); +} + +sc_module_name::sc_module_name(const sc_module_name &other) : + _name(other._name), _on_the_stack(false) +{} + +sc_module_name::~sc_module_name() +{ + if (_on_the_stack) { + warn("%s: Module name not removed from stack.\n", __PRETTY_FUNCTION__); + } +} + +sc_module_name::operator const char *() const +{ + return _name; +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_object.cc b/src/systemc/core/sc_object.cc new file mode 100644 index 000000000..554bc221f --- /dev/null +++ b/src/systemc/core/sc_object.cc @@ -0,0 +1,177 @@ +/* + * 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/core/sc_object.hh" + +namespace sc_core +{ + +const char * +sc_object::name() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return "sc_object"; +} + +const char * +sc_object::basename() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return "sc_object"; +} + +const char * +sc_object::kind() const +{ + return "sc_object"; +} + +void +sc_object::print(std::ostream &out) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_object::dump(std::ostream &out) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const std::vector & +sc_object::get_child_objects() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const std::vector *)nullptr; +} + +const std::vector & +sc_object::get_child_events() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const std::vector *)nullptr; +} + +sc_object * +sc_object::get_parent_object() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return NULL; +} + +bool +sc_object::add_attribute(sc_attr_base &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +sc_attr_base * +sc_object::get_attribute(const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return NULL; +} + +sc_attr_base * +sc_object::remove_attribute(const std::string &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return NULL; +} + +void +sc_object::remove_all_attributes() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +int +sc_object::num_attributes() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +sc_attr_cltn & +sc_object::attr_cltn() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(sc_attr_cltn *)NULL; +} + +const sc_attr_cltn & +sc_object::attr_cltn() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(sc_attr_cltn *)NULL; +} + +sc_object::sc_object() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_object::sc_object(const char *name) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_object::sc_object(const sc_object &arg) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_object & +sc_object::operator = (const sc_object &) +{ + return *this; +} + +sc_object::~sc_object() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const std::vector & +sc_get_top_level_objects() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const std::vector *)nullptr; +} + +sc_object * +sc_find_object(const char *) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return NULL; +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_port.cc b/src/systemc/core/sc_port.cc new file mode 100644 index 000000000..e1823bcc9 --- /dev/null +++ b/src/systemc/core/sc_port.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/core/sc_port.hh" + +namespace sc_core +{ + +void +sc_port_base::warn_unimpl(const char *func) +{ + warn("%s not implemented.\n", func); +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_prim.cc b/src/systemc/core/sc_prim.cc new file mode 100644 index 000000000..0daf317cd --- /dev/null +++ b/src/systemc/core/sc_prim.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/core/sc_prim.hh" + +namespace sc_core +{ + +const char * +sc_prim_channel::kind() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +sc_prim_channel::sc_prim_channel() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_prim_channel::sc_prim_channel(const char *) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::request_update() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::async_request_update() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(double, sc_time_unit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(const sc_time &, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(double, sc_time_unit, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(const sc_time &, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(double, sc_time_unit, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(const sc_time &, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::next_trigger(double, sc_time_unit, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(int) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(double, sc_time_unit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(const sc_time &, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(double, sc_time_unit, const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(const sc_time &, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(double, sc_time_unit, const sc_event_or_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(const sc_time &, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_prim_channel::wait(double, sc_time_unit, const sc_event_and_list &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_sensitive.cc b/src/systemc/core/sc_sensitive.cc new file mode 100644 index 000000000..e182fa003 --- /dev/null +++ b/src/systemc/core/sc_sensitive.cc @@ -0,0 +1,64 @@ +/* + * 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/core/sc_sensitive.hh" + +namespace sc_core +{ + +sc_sensitive & +sc_sensitive::operator << (const sc_event &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_sensitive & +sc_sensitive::operator << (const sc_interface &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_sensitive & +sc_sensitive::operator << (const sc_port_base &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_sensitive & +sc_sensitive::operator << (sc_event_finder &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +} // namespace sc_core diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc new file mode 100644 index 000000000..022895733 --- /dev/null +++ b/src/systemc/core/sc_time.cc @@ -0,0 +1,232 @@ +/* + * 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/core/sc_time.hh" + +namespace sc_core +{ + +sc_time::sc_time() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_time::sc_time(double, sc_time_unit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_time::sc_time(const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_time & +sc_time::operator = (const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_dt::uint64 +sc_time::value() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +double +sc_time::to_double() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0.0; +} +double +sc_time::to_seconds() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0.0; +} + +const std::string +sc_time::to_string() const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return ""; +} + +bool +sc_time::operator == (const sc_time &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return true; +} + +bool +sc_time::operator != (const sc_time &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +bool +sc_time::operator < (const sc_time &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +bool +sc_time::operator <= (const sc_time &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return true; +} + +bool +sc_time::operator > (const sc_time &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +bool +sc_time::operator >= (const sc_time &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return true; +} + +sc_time & +sc_time::operator += (const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_time & +sc_time::operator -= (const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_time & +sc_time::operator *= (double) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +sc_time & +sc_time::operator /= (double) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *this; +} + +void +sc_time::print(std::ostream &) const +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const sc_time +operator + (const sc_time &, const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_time(); +} + +const sc_time +operator - (const sc_time &, const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_time(); +} + +const sc_time +operator * (const sc_time &, double) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_time(); +} + +const sc_time +operator * (double, const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_time(); +} + +const sc_time +operator / (const sc_time &, double) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_time(); +} + +double +operator / (const sc_time &, const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0.0; +} + +std::ostream & +operator << (std::ostream &os, const sc_time &) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return os; +} + +const sc_time SC_ZERO_TIME; + +void +sc_set_time_resolution(double, sc_time_unit) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_time +sc_get_time_resolution() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_time(); +} + +const sc_time & +sc_max_time() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(const sc_time *)nullptr; +} + +} // namespace sc_core diff --git a/src/systemc/dt/int/sc_nbdefs.hh b/src/systemc/dt/int/sc_nbdefs.hh deleted file mode 100644 index 48d735adf..000000000 --- a/src/systemc/dt/int/sc_nbdefs.hh +++ /dev/null @@ -1,168 +0,0 @@ -/***************************************************************************** - - Licensed to Accellera Systems Initiative Inc. (Accellera) under one or - more contributor license agreements. See the NOTICE file distributed - with this work for additional information regarding copyright ownership. - Accellera licenses this file to you under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with the - License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied. See the License for the specific language governing - permissions and limitations under the License. - - *****************************************************************************/ - -/***************************************************************************** - sc_nbdefs.h -- Top level header file for arbitrary precision signed/unsigned - arithmetic. This file defines all the constants needed. - *****************************************************************************/ - -#ifndef __SYSTEMC_DT_SC_NBDEFS_H__ -#define __SYSTEMC_DT_SC_NBDEFS_H__ - -#include - -#include - -namespace sc_dt -{ - -// ---------------------------------------------------------------------------- -// ENUM : sc_numrep -// -// Enumeration of number representations for character string conversion. -// ---------------------------------------------------------------------------- - -enum sc_numrep -{ - SC_NOBASE = 0, - SC_BIN = 2, - SC_OCT = 8, - SC_DEC = 10, - SC_HEX = 16, - SC_BIN_US, - SC_BIN_SM, - SC_OCT_US, - SC_OCT_SM, - SC_HEX_US, - SC_HEX_SM, - SC_CSD -}; - - -// Sign of a number: -#define SC_NEG -1 // Negative number -#define SC_ZERO 0 // Zero -#define SC_POS 1 // Positive number -#define SC_NOSIGN 2 // Uninitialized sc_signed number - -typedef unsigned char uchar; - -// A small_type number is at least a char. Defining an int is probably -// better for alignment. -typedef int small_type; - -// Attributes of a byte. -#define BITS_PER_BYTE 8 -#define BYTE_RADIX 256 -#define BYTE_MASK 255 - -// LOG2_BITS_PER_BYTE = log2(BITS_PER_BYTE), assuming that -// BITS_PER_BYTE is a power of 2. -#define LOG2_BITS_PER_BYTE 3 - -// Attributes of the unsigned long. These definitions are used mainly in -// the functions that are aware of the internal representation of digits, -// e.g., get/set_packed_rep(). -#define BYTES_PER_DIGIT_TYPE 4 -#define BITS_PER_DIGIT_TYPE 32 - -// Attributes of a digit, i.e., unsigned long less the overflow bits. -#define BYTES_PER_DIGIT 4 -#define BITS_PER_DIGIT 30 -#define DIGIT_RADIX (1ul << BITS_PER_DIGIT) -#define DIGIT_MASK (DIGIT_RADIX - 1) -// Make sure that BYTES_PER_DIGIT = ceil(BITS_PER_DIGIT / BITS_PER_BYTE). - -// Similar attributes for the half of a digit. Note that -// HALF_DIGIT_RADIX is equal to the square root of DIGIT_RADIX. These -// definitions are used mainly in the multiplication routines. -#define BITS_PER_HALF_DIGIT (BITS_PER_DIGIT / 2) -#define HALF_DIGIT_RADIX (1ul << BITS_PER_HALF_DIGIT) -#define HALF_DIGIT_MASK (HALF_DIGIT_RADIX - 1) - -// DIV_CEIL2(x, y) = ceil(x / y). x and y are positive numbers. -#define DIV_CEIL2(x, y) (((x) - 1) / (y) + 1) - -// DIV_CEIL(x) = ceil(x / BITS_PER_DIGIT) = the number of digits to -// store x bits. x is a positive number. -#define DIV_CEIL(x) DIV_CEIL2(x, BITS_PER_DIGIT) - -#ifdef SC_MAX_NBITS -static const int MAX_NDIGITS = DIV_CEIL(SC_MAX_NBITS) + 2; -// Consider a number with x bits another with y bits. The maximum -// number of bits happens when we multiply them. The result will have -// (x + y) bits. Assume that x + y <= SC_MAX_NBITS. Then, DIV_CEIL(x) + -// DIV_CEIL(y) <= DIV_CEIL(SC_MAX_NBITS) + 2. This is the reason for +2 -// above. With this change, MAX_NDIGITS must be enough to hold the -// result of any operation. -#endif - -// Support for "digit" vectors used to hold the values of sc_signed, -// sc_unsigned, sc_bv_base, and sc_lv_base data types. This type is also used -// in the concatenation support. An sc_digit is currently an unsigned 32-bit -// quantity. The typedef used is an unsigned int, rather than an unsigned long, -// since the unsigned long data type varies in size between 32-bit and 64-bit -// machines. - -typedef unsigned int sc_digit; // 32-bit unsigned integer - -// Support for the long long type. This type is not in the standard -// but is usually supported by compilers. -typedef int64_t int64; -typedef uint64_t uint64; - -static const uint64 UINT64_ZERO = 0ULL; -static const uint64 UINT64_ONE = 1ULL; -static const uint64 UINT64_32ONES = 0x00000000ffffffffULL; - -// Bits per ... -// will be deleted in the future. Use numeric_limits instead -#define BITS_PER_CHAR 8 -#define BITS_PER_INT (sizeof(int) * BITS_PER_CHAR) -#define BITS_PER_LONG (sizeof(long) * BITS_PER_CHAR) -#define BITS_PER_INT64 (sizeof(::sc_dt::int64) * BITS_PER_CHAR) -#define BITS_PER_UINT (sizeof(unsigned int) * BITS_PER_CHAR) -#define BITS_PER_ULONG (sizeof(unsigned long) * BITS_PER_CHAR) -#define BITS_PER_UINT64 (sizeof(::sc_dt::uint64) * BITS_PER_CHAR) - -// Digits per ... -#define DIGITS_PER_CHAR 1 -#define DIGITS_PER_INT ((BITS_PER_INT+29)/30) -#define DIGITS_PER_LONG ((BITS_PER_LONG+29)/30) -#define DIGITS_PER_INT64 ((BITS_PER_INT64+29)/30) -#define DIGITS_PER_UINT ((BITS_PER_UINT+29)/30) -#define DIGITS_PER_ULONG ((BITS_PER_ULONG+29)/30) -#define DIGITS_PER_UINT64 ((BITS_PER_UINT64+29)/30) - -// Above, BITS_PER_X is mainly used for sc_signed, and BITS_PER_UX is -// mainly used for sc_unsigned. - -static const small_type NB_DEFAULT_BASE = SC_DEC; - -// For sc_int code: - -typedef int64 int_type; -typedef uint64 uint_type; -#define SC_INTWIDTH 64 -static const uint64 UINT_ZERO = UINT64_ZERO; -static const uint64 UINT_ONE = UINT64_ONE; - -} // namespace sc_dt - -#endif diff --git a/src/systemc/ext/core/sc_attr.hh b/src/systemc/ext/core/sc_attr.hh new file mode 100644 index 000000000..d7baa149d --- /dev/null +++ b/src/systemc/ext/core/sc_attr.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_CORE_SC_ATTR_HH__ +#define __SYSTEMC_EXT_CORE_SC_ATTR_HH__ + +#include + +namespace sc_core +{ + +class sc_attr_base +{ + public: + sc_attr_base(const std::string &); + sc_attr_base(const sc_attr_base &); + virtual ~sc_attr_base(); + + const std::string &name() const; + + protected: + void warn_unimpl(const char *func); + + private: + // Disabled + sc_attr_base(); + sc_attr_base &operator = (const sc_attr_base &); +}; + +template +class sc_attribute : public sc_attr_base +{ + public: + sc_attribute(const std::string &_name) : sc_attr_base(_name) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + sc_attribute(const std::string &_name, const T &t) : + sc_attr_base(_name), value(t) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + sc_attribute(const sc_attribute &other) : + sc_attr_base(other.name()), value(other.value) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + virtual ~sc_attribute() { warn_unimpl(__PRETTY_FUNCTION__); } + T value; + + private: + // Disabled + sc_attribute() {} + sc_attribute &operator = (const sc_attribute &) { return *this; } +}; + +class sc_attr_cltn +{ + public: + typedef sc_attr_base *elem_type; + typedef elem_type *iterator; + typedef const elem_type *const_iterator; + + iterator begin(); + const_iterator begin() const; + iterator end(); + const_iterator end() const; +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_ATTR_HH__ diff --git a/src/systemc/ext/core/sc_event.hh b/src/systemc/ext/core/sc_event.hh new file mode 100644 index 000000000..d4d719b95 --- /dev/null +++ b/src/systemc/ext/core/sc_event.hh @@ -0,0 +1,151 @@ +/* + * 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_CORE_SC_EVENT_HH__ +#define __SYSTEMC_EXT_CORE_SC_EVENT_HH__ + +#include + +#include "sc_time.hh" + +namespace sc_core +{ + +class sc_event; +class sc_event_and_expr; +class sc_event_or_expr; +class sc_object; +class sc_port_base; + +class sc_event_finder +{ + protected: + void warn_unimpl(const char *func) const; +}; + +template +class sc_event_finder_t : public sc_event_finder +{ + public: + sc_event_finder_t(const sc_port_base &, + const sc_event & (IF::*event_method)() const) + { + warn_unimpl(__PRETTY_FUNCTION__); + } +}; + +class sc_event_and_list +{ + public: + sc_event_and_list(); + sc_event_and_list(const sc_event_and_list &); + sc_event_and_list(const sc_event &); + sc_event_and_list &operator = (const sc_event_and_list &); + + int size() const; + void swap(sc_event_and_list &); + + sc_event_and_list &operator &= (const sc_event &); + sc_event_and_list &operator &= (const sc_event_and_list &); + + sc_event_and_expr operator & (const sc_event &) const; + sc_event_and_expr operator & (const sc_event_and_list &); +}; + +class sc_event_or_list +{ + public: + sc_event_or_list(); + sc_event_or_list(const sc_event_or_list &); + sc_event_or_list(const sc_event &); + sc_event_or_list& operator = (const sc_event_or_list &); + ~sc_event_or_list(); + + int size() const; + void swap(sc_event_or_list &); + + sc_event_or_list &operator |= (const sc_event &); + sc_event_or_list &operator |= (const sc_event_or_list &); + + sc_event_or_expr operator | (const sc_event &) const; + sc_event_or_expr operator | (const sc_event_or_list &) const; +}; + +class sc_event_and_expr +{ + public: + operator const sc_event_and_list &() const; +}; + +sc_event_and_expr operator & (sc_event_and_expr, sc_event const &); +sc_event_and_expr operator & (sc_event_and_expr, sc_event_and_list const &); + +class sc_event_or_expr +{ + public: + operator const sc_event_or_list &() const; +}; + +sc_event_or_expr operator | (sc_event_or_expr, sc_event const &); +sc_event_or_expr operator | (sc_event_or_expr, sc_event_or_list const &); + +class sc_event +{ + public: + sc_event(); + explicit sc_event(const char *); + ~sc_event(); + + const char *name() const; + const char *basename() const; + bool in_hierarchy() const; + sc_object *get_parent_object() const; + + void notify(); + void notify(const sc_time &); + void notify(double, sc_time_unit); + void cancel(); + + sc_event_and_expr operator & (const sc_event &) const; + sc_event_and_expr operator & (const sc_event_and_list &) const; + sc_event_or_expr operator | (const sc_event &) const; + sc_event_or_expr operator | (const sc_event_or_list &) const; + + private: + // Disabled + sc_event(const sc_event &) {} + sc_event &operator = (const sc_event &) { return *this; } +}; + +const std::vector &sc_get_top_level_events(); +sc_event *sc_find_event(const char *); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_INTERFACE_HH__ diff --git a/src/systemc/ext/core/sc_export.hh b/src/systemc/ext/core/sc_export.hh new file mode 100644 index 000000000..dc2176492 --- /dev/null +++ b/src/systemc/ext/core/sc_export.hh @@ -0,0 +1,101 @@ +/* + * 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_CORE_SC_EXPORT_HH__ +#define __SYSTEMC_EXT_CORE_SC_EXPORT_HH__ + +#include "sc_object.hh" + +namespace sc_core +{ + +class sc_interface; + +class sc_export_base : public sc_object +{ + public: + void warn_unimpl(const char *func) const; +}; + +template +class sc_export : public sc_export_base +{ + public: + sc_export() { warn_unimpl(__PRETTY_FUNCTION__); } + explicit sc_export(const char *) { warn_unimpl(__PRETTY_FUNCTION__); } + virtual ~sc_export() { warn_unimpl(__PRETTY_FUNCTION__); }; + + virtual const char *kind() const { return "sc_export"; } + + void operator () (IF &) { warn_unimpl(__PRETTY_FUNCTION__); }; + virtual void bind(IF &) { warn_unimpl(__PRETTY_FUNCTION__); }; + operator IF & () { warn_unimpl(__PRETTY_FUNCTION__); }; + operator const IF & () const { warn_unimpl(__PRETTY_FUNCTION__); }; + + IF * + operator -> () + { + warn_unimpl(__PRETTY_FUNCTION__); + return nullptr; + } + const IF * + operator -> () const + { + warn_unimpl(__PRETTY_FUNCTION__); + return nullptr; + } + + virtual sc_interface * + get_iterface() + { + warn_unimpl(__PRETTY_FUNCTION__); + return nullptr; + } + virtual const sc_interface * + get_interface() const + { + warn_unimpl(__PRETTY_FUNCTION__); + return nullptr; + } + + protected: + virtual void before_end_of_elaboration() {} + virtual void end_of_elaboration() {} + virtual void start_of_simulation() {} + virtual void end_of_simulation() {} + + private: + // Disabled + sc_export(const sc_export &); + sc_export &operator = (const sc_export &); +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_EXPORT_HH__ diff --git a/src/systemc/ext/core/sc_interface.hh b/src/systemc/ext/core/sc_interface.hh new file mode 100644 index 000000000..2073f5362 --- /dev/null +++ b/src/systemc/ext/core/sc_interface.hh @@ -0,0 +1,57 @@ +/* + * 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_CORE_SC_INTERFACE_HH__ +#define __SYSTEMC_EXT_CORE_SC_INTERFACE_HH__ + +namespace sc_core +{ + +class sc_port_base; +class sc_event; + +class sc_interface +{ + public: + virtual void register_port(sc_port_base &, const char *); + virtual const sc_event &default_event() const; + virtual ~sc_interface(); + + protected: + sc_interface(); + + private: + // Disabled + sc_interface(const sc_interface &) {} + sc_interface &operator = (const sc_interface &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_INTERFACE_HH__ diff --git a/src/systemc/ext/core/sc_main.hh b/src/systemc/ext/core/sc_main.hh new file mode 100644 index 000000000..9bf0d0aae --- /dev/null +++ b/src/systemc/ext/core/sc_main.hh @@ -0,0 +1,44 @@ +/* + * 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_CORE_SC_MAIN_HH__ +#define __SYSTEMC_EXT_CORE_SC_MAIN_HH__ + +extern "C" int sc_main(int argc, char *argv[]); + +namespace sc_core +{ + extern "C" int sc_argc(); + + // The standard version of this function doesn't have these "const" + // qualifiers, but the canonical SystemC implementation does. + extern "C" const char *const *sc_argv(); +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_MAIN_HH__ diff --git a/src/systemc/ext/core/sc_module.hh b/src/systemc/ext/core/sc_module.hh new file mode 100644 index 000000000..4c4ebb269 --- /dev/null +++ b/src/systemc/ext/core/sc_module.hh @@ -0,0 +1,246 @@ +/* + * 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_CORE_EXT_SC_MODULE_HH__ +#define __SYSTEMC_CORE_EXT_SC_MODULE_HH__ + +#include + +#include "sc_object.hh" +#include "sc_sensitive.hh" +#include "sc_time.hh" + +namespace sc_core +{ + +template +class sc_in; +template +class sc_out; +template +class sc_inout; +template +class sc_signal_in_if; + +class sc_event; +class sc_event_and_list; +class sc_event_or_list; +class sc_module_name; + +class sc_bind_proxy +{ + public: + sc_bind_proxy(const sc_interface &interface); + sc_bind_proxy(const sc_port_base &port); +}; + +extern const sc_bind_proxy SC_BIND_PROXY_NIL; + +class sc_module : public sc_object +{ + public: + virtual ~sc_module(); + + virtual const char *kind() const; + + void operator () (const sc_bind_proxy &p001, + const sc_bind_proxy &p002 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p003 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p004 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p005 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p006 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p007 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p008 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p009 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p010 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p011 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p012 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p013 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p014 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p015 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p016 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p017 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p018 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p019 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p020 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p021 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p022 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p023 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p024 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p025 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p026 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p027 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p028 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p029 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p030 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p031 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p032 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p033 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p034 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p035 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p036 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p037 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p038 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p039 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p040 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p041 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p042 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p043 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p044 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p045 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p046 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p047 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p048 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p049 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p050 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p051 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p052 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p053 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p054 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p055 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p056 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p057 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p058 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p059 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p060 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p061 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p062 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p063 = SC_BIND_PROXY_NIL, + const sc_bind_proxy &p064 = SC_BIND_PROXY_NIL); + + virtual const std::vector &get_child_objects() const; + virtual const std::vector &get_child_events() const; + + protected: + sc_module(const sc_module_name &); + sc_module(); + + void reset_signal_is(const sc_in &, bool); + void reset_signal_is(const sc_inout &, bool); + void reset_signal_is(const sc_out &, bool); + void reset_signal_is(const sc_signal_in_if &, bool); + + void async_reset_signal_is(const sc_in &, bool); + void async_reset_signal_is(const sc_inout &, bool); + void async_reset_signal_is(const sc_out &, bool); + void async_reset_signal_is(const sc_signal_in_if &, bool); + + sc_sensitive sensitive; + + void dont_initialize(); + void set_stack_size(size_t); + + void next_trigger(); + void next_trigger(const sc_event &); + void next_trigger(const sc_event_or_list &); + void next_trigger(const sc_event_and_list &); + void next_trigger(const sc_time &); + void next_trigger(double, sc_time_unit); + void next_trigger(const sc_time &, const sc_event &); + void next_trigger(double, sc_time_unit, const sc_event &); + void next_trigger(const sc_time &, const sc_event_or_list &); + void next_trigger(double, sc_time_unit, const sc_event_or_list &); + void next_trigger(const sc_time &, const sc_event_and_list &); + void next_trigger(double, sc_time_unit, const sc_event_and_list &); + + void wait(); + void wait(int); + void wait(const sc_event &); + void wait(const sc_event_or_list &); + void wait(const sc_event_and_list &); + void wait(const sc_time &); + void wait(double, sc_time_unit); + void wait(const sc_time &, const sc_event &); + void wait(double, sc_time_unit, const sc_event &); + void wait(const sc_time &, const sc_event_or_list &); + void wait(double, sc_time_unit, const sc_event_or_list &); + void wait(const sc_time &, const sc_event_and_list &); + void wait(double, sc_time_unit, const sc_event_and_list &); + + virtual void before_end_of_elaboration() {} + virtual void end_of_elaboration() {} + virtual void start_of_simulation() {} + virtual void end_of_simulation() {} + + private: + // Disabled + sc_module(const sc_module &) : sc_object() {}; + sc_module &operator = (const sc_module &) { return *this; } +}; + +void next_trigger(); +void next_trigger(const sc_event &); +void next_trigger(const sc_event_or_list &); +void next_trigger(const sc_event_and_list &); +void next_trigger(const sc_time &); +void next_trigger(double, sc_time_unit); +void next_trigger(const sc_time &, const sc_event &); +void next_trigger(double, sc_time_unit, const sc_event &); +void next_trigger(const sc_time &, const sc_event_or_list &); +void next_trigger(double, sc_time_unit, const sc_event_or_list &); +void next_trigger(const sc_time &, const sc_event_and_list &); +void next_trigger(double, sc_time_unit, const sc_event_and_list &); + +void wait(); +void wait(int); +void wait(const sc_event &); +void wait(const sc_event_or_list &); +void wait(const sc_event_and_list &); +void wait(const sc_time &); +void wait(double, sc_time_unit); +void wait(const sc_time &, const sc_event &); +void wait(double, sc_time_unit, const sc_event &); +void wait(const sc_time &, const sc_event_or_list &); +void wait(double, sc_time_unit, const sc_event_or_list &); +void wait(const sc_time &, const sc_event_and_list &); +void wait(double, sc_time_unit, const sc_event_and_list &); + +#define SC_MODULE(name) struct name : ::sc_core::sc_module + +#define SC_CTOR(name) \ + typedef name SC_CURRENT_USER_MODULE; \ + name(::sc_core::sc_module_name) + +#define SC_HAS_PROCESS(name) typedef name SC_CURRENT_USER_MODULE + +#define SC_METHOD(name) /* Implementation defined */ +#define SC_THREAD(name) /* Implementation defined */ +#define SC_CTHREAD(name, clk) /* Implementation defined */ + +const char *sc_gen_unique_name(const char *); + +typedef sc_module sc_behavior; +typedef sc_module sc_channel; + +bool sc_start_of_simulation_invoked(); +bool sc_end_of_simulation_invoked(); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_MODULE_HH__ diff --git a/src/systemc/ext/core/sc_module_name.hh b/src/systemc/ext/core/sc_module_name.hh new file mode 100644 index 000000000..7ae2fd689 --- /dev/null +++ b/src/systemc/ext/core/sc_module_name.hh @@ -0,0 +1,56 @@ +/* + * 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_CORE_SC_MODULE_NAME_HH__ +#define __SYSTEMC_EXT_CORE_SC_MODULE_NAME_HH__ + +namespace sc_core +{ + +class sc_module_name +{ + public: + sc_module_name(const char *); + sc_module_name(const sc_module_name &); + ~sc_module_name(); + + operator const char *() const; + + private: + const char *_name; + bool _on_the_stack; + + // Disabled + sc_module_name() {} + sc_module_name &operator = (const sc_module_name &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_MODULE_NAME_HH__ diff --git a/src/systemc/ext/core/sc_object.hh b/src/systemc/ext/core/sc_object.hh new file mode 100644 index 000000000..0e975814f --- /dev/null +++ b/src/systemc/ext/core/sc_object.hh @@ -0,0 +1,80 @@ +/* + * 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_CORE_SC_OBJECT_HH__ +#define __SYSTEMC_EXT_CORE_SC_OBJECT_HH__ + +#include +#include +#include + +namespace sc_core +{ + +class sc_event; +class sc_attr_base; +class sc_attr_cltn; + +class sc_object +{ + public: + const char *name() const; + const char *basename() const; + + virtual const char *kind() const; + + virtual void print(std::ostream & =std::cout) const; + virtual void dump(std::ostream & =std::cout) const; + + virtual const std::vector &get_child_objects() const; + virtual const std::vector &get_child_events() const; + sc_object *get_parent_object() const; + + bool add_attribute(sc_attr_base &); + sc_attr_base *get_attribute(const std::string &); + sc_attr_base *remove_attribute(const std::string &); + void remove_all_attributes(); + int num_attributes() const; + sc_attr_cltn &attr_cltn(); + const sc_attr_cltn &attr_cltn() const; + + protected: + sc_object(); + sc_object(const char *); + sc_object(const sc_object &); + sc_object &operator = (const sc_object &); + virtual ~sc_object(); +}; + +const std::vector &sc_get_top_level_objects(); +sc_object *sc_find_object(const char *); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_OBJECT_HH__ diff --git a/src/systemc/ext/core/sc_port.hh b/src/systemc/ext/core/sc_port.hh new file mode 100644 index 000000000..1d32422a5 --- /dev/null +++ b/src/systemc/ext/core/sc_port.hh @@ -0,0 +1,192 @@ +/* + * 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_CORE_SC_PORT_HH__ +#define __SYSTEMC_EXT_CORE_SC_PORT_HH__ + +#include "sc_object.hh" + +namespace sc_core +{ + +class sc_interface; + +enum sc_port_policy +{ + SC_ONE_OR_MORE_BOUND, // Default + SC_ZERO_OR_MORE_BOUND, + SC_ALL_BOUND +}; + +class sc_port_base : public sc_object +{ + public: + void warn_unimpl(const char *func); +}; + +template +class sc_port_b : public sc_port_base +{ + public: + void + operator () (IF &) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + void + operator () (sc_port_b &) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + bind(IF &) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + bind(sc_port_b &) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + int + size() const + { + warn_unimpl(__PRETTY_FUNCTION__); + return 0; + } + + IF * + operator -> () + { + warn_unimpl(__PRETTY_FUNCTION__); + return (IF *)nullptr; + } + + const IF * + operator -> () const + { + warn_unimpl(__PRETTY_FUNCTION__); + return (IF *)nullptr; + } + + IF * + operator [] (int) + { + warn_unimpl(__PRETTY_FUNCTION__); + return (IF *)nullptr; + } + + const IF * + operator [] (int) const + { + warn_unimpl(__PRETTY_FUNCTION__); + return (IF *)nullptr; + } + + virtual sc_interface * + get_interface() + { + warn_unimpl(__PRETTY_FUNCTION__); + return (sc_interface *)nullptr; + } + + virtual const sc_interface * + get_interface() const + { + warn_unimpl(__PRETTY_FUNCTION__); + return (sc_interface *)nullptr; + } + + protected: + virtual void before_end_of_elaboration() {} + virtual void end_of_elaboration() {} + virtual void start_of_elaboration() {} + virtual void end_of_simulation() {} + + explicit sc_port_b(int, sc_port_policy) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + sc_port_b(const char *, int, sc_port_policy) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual ~sc_port_b() + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + private: + // Disabled + sc_port_b() {} + sc_port_b(const sc_port_b &) {} + sc_port_b &operator = (const sc_port_b &) { return *this; } +}; + +template +class sc_port : public sc_port_b +{ + public: + sc_port() + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + explicit sc_port(const char *) + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual ~sc_port() + { + warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual const char * + kind() const + { + warn_unimpl(__PRETTY_FUNCTION__); + return ""; + } + + private: + // Disabled + sc_port(const sc_port &) {} + sc_port &operator = (const sc_port &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_PORT_HH__ diff --git a/src/systemc/ext/core/sc_prim.hh b/src/systemc/ext/core/sc_prim.hh new file mode 100644 index 000000000..d6265cb56 --- /dev/null +++ b/src/systemc/ext/core/sc_prim.hh @@ -0,0 +1,97 @@ +/* + * 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_CORE_SC_PRIM_HH__ +#define __SYSTEMC_EXT_CORE_SC_PRIM_HH__ + +#include "sc_object.hh" +#include "sc_time.hh" + +namespace sc_core +{ + +class sc_event; +class sc_event_and_list; +class sc_event_or_list; + +class sc_prim_channel : public sc_object +{ + public: + virtual const char *kind() const; + + protected: + sc_prim_channel(); + explicit sc_prim_channel(const char *); + virtual ~sc_prim_channel() {} + + void request_update(); + void async_request_update(); + virtual void update() {} + + void next_trigger(); + void next_trigger(const sc_event &); + void next_trigger(const sc_event_or_list &); + void next_trigger(const sc_event_and_list &); + void next_trigger(const sc_time &); + void next_trigger(double, sc_time_unit); + void next_trigger(const sc_time &, const sc_event &); + void next_trigger(double, sc_time_unit, const sc_event &); + void next_trigger(const sc_time &, const sc_event_or_list &); + void next_trigger(double, sc_time_unit, const sc_event_or_list &); + void next_trigger(const sc_time &, const sc_event_and_list &); + void next_trigger(double, sc_time_unit, const sc_event_and_list &); + + void wait(); + void wait(int); + void wait(const sc_event &); + void wait(const sc_event_or_list &); + void wait(const sc_event_and_list &); + void wait(const sc_time &); + void wait(double, sc_time_unit); + void wait(const sc_time &, const sc_event &); + void wait(double, sc_time_unit, const sc_event &); + void wait(const sc_time &, const sc_event_or_list &); + void wait(double, sc_time_unit, const sc_event_or_list &); + void wait(const sc_time &, const sc_event_and_list &); + void wait(double, sc_time_unit, const sc_event_and_list &); + + virtual void before_end_of_elaboration() {} + virtual void end_of_elaboration() {} + virtual void start_of_simulation() {} + virtual void end_of_simulation() {} + + private: + // Disabled + sc_prim_channel(const sc_prim_channel &); + sc_prim_channel &operator = (const sc_prim_channel &); +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_PRIM_HH__ diff --git a/src/systemc/ext/core/sc_sensitive.hh b/src/systemc/ext/core/sc_sensitive.hh new file mode 100644 index 000000000..62f18b6d2 --- /dev/null +++ b/src/systemc/ext/core/sc_sensitive.hh @@ -0,0 +1,52 @@ +/* + * 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_CORE_SC_SENSITIVE_HH__ +#define __SYSTEMC_EXT_CORE_SC_SENSITIVE_HH__ + +namespace sc_core +{ + +class sc_event; +class sc_event_finder; +class sc_interface; +class sc_port_base; + +class sc_sensitive +{ + public: + sc_sensitive &operator << (const sc_event &); + sc_sensitive &operator << (const sc_interface &); + sc_sensitive &operator << (const sc_port_base &); + sc_sensitive &operator << (sc_event_finder &); +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_SENSITIVE_HH__ diff --git a/src/systemc/ext/core/sc_time.hh b/src/systemc/ext/core/sc_time.hh new file mode 100644 index 000000000..456d59e02 --- /dev/null +++ b/src/systemc/ext/core/sc_time.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_CORE_SC_TIME_HH__ +#define __SYSTEMC_EXT_CORE_SC_TIME_HH__ + +#include + +#include + +#include "../dt/int/sc_nbdefs.hh" + +namespace sc_core +{ + +enum sc_time_unit { + SC_FS = 0, + SC_PS, + SC_NS, + SC_US, + SC_MS, + SC_SEC +}; + +class sc_time +{ + public: + sc_time(); + sc_time(double, sc_time_unit); + sc_time(const sc_time &); + + sc_time &operator = (const sc_time &); + + sc_dt::uint64 value() const; + double to_double() const; + double to_seconds() const; + const std::string to_string() const; + + bool operator == (const sc_time &) const; + bool operator != (const sc_time &) const; + bool operator < (const sc_time &) const; + bool operator <= (const sc_time &) const; + bool operator > (const sc_time &) const; + bool operator >= (const sc_time &) const; + + sc_time &operator += (const sc_time &); + sc_time &operator -= (const sc_time &); + sc_time &operator *= (double); + sc_time &operator /= (double); + + void print(std::ostream & =std::cout) const; +}; + +const sc_time operator + (const sc_time &, const sc_time &); +const sc_time operator - (const sc_time &, const sc_time &); + +const sc_time operator * (const sc_time &, double); +const sc_time operator * (double, const sc_time &); +const sc_time operator / (const sc_time &, double); +double operator / (const sc_time &, const sc_time &); + +std::ostream &operator << (std::ostream &, const sc_time &); + +extern const sc_time SC_ZERO_TIME; + +void sc_set_time_resolution(double, sc_time_unit); +sc_time sc_get_time_resolution(); +const sc_time &sc_max_time(); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CORE_SC_TIME_HH__ diff --git a/src/systemc/ext/dt/int/sc_nbdefs.hh b/src/systemc/ext/dt/int/sc_nbdefs.hh new file mode 100644 index 000000000..48d735adf --- /dev/null +++ b/src/systemc/ext/dt/int/sc_nbdefs.hh @@ -0,0 +1,168 @@ +/***************************************************************************** + + Licensed to Accellera Systems Initiative Inc. (Accellera) under one or + more contributor license agreements. See the NOTICE file distributed + with this work for additional information regarding copyright ownership. + Accellera licenses this file to you under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with the + License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied. See the License for the specific language governing + permissions and limitations under the License. + + *****************************************************************************/ + +/***************************************************************************** + sc_nbdefs.h -- Top level header file for arbitrary precision signed/unsigned + arithmetic. This file defines all the constants needed. + *****************************************************************************/ + +#ifndef __SYSTEMC_DT_SC_NBDEFS_H__ +#define __SYSTEMC_DT_SC_NBDEFS_H__ + +#include + +#include + +namespace sc_dt +{ + +// ---------------------------------------------------------------------------- +// ENUM : sc_numrep +// +// Enumeration of number representations for character string conversion. +// ---------------------------------------------------------------------------- + +enum sc_numrep +{ + SC_NOBASE = 0, + SC_BIN = 2, + SC_OCT = 8, + SC_DEC = 10, + SC_HEX = 16, + SC_BIN_US, + SC_BIN_SM, + SC_OCT_US, + SC_OCT_SM, + SC_HEX_US, + SC_HEX_SM, + SC_CSD +}; + + +// Sign of a number: +#define SC_NEG -1 // Negative number +#define SC_ZERO 0 // Zero +#define SC_POS 1 // Positive number +#define SC_NOSIGN 2 // Uninitialized sc_signed number + +typedef unsigned char uchar; + +// A small_type number is at least a char. Defining an int is probably +// better for alignment. +typedef int small_type; + +// Attributes of a byte. +#define BITS_PER_BYTE 8 +#define BYTE_RADIX 256 +#define BYTE_MASK 255 + +// LOG2_BITS_PER_BYTE = log2(BITS_PER_BYTE), assuming that +// BITS_PER_BYTE is a power of 2. +#define LOG2_BITS_PER_BYTE 3 + +// Attributes of the unsigned long. These definitions are used mainly in +// the functions that are aware of the internal representation of digits, +// e.g., get/set_packed_rep(). +#define BYTES_PER_DIGIT_TYPE 4 +#define BITS_PER_DIGIT_TYPE 32 + +// Attributes of a digit, i.e., unsigned long less the overflow bits. +#define BYTES_PER_DIGIT 4 +#define BITS_PER_DIGIT 30 +#define DIGIT_RADIX (1ul << BITS_PER_DIGIT) +#define DIGIT_MASK (DIGIT_RADIX - 1) +// Make sure that BYTES_PER_DIGIT = ceil(BITS_PER_DIGIT / BITS_PER_BYTE). + +// Similar attributes for the half of a digit. Note that +// HALF_DIGIT_RADIX is equal to the square root of DIGIT_RADIX. These +// definitions are used mainly in the multiplication routines. +#define BITS_PER_HALF_DIGIT (BITS_PER_DIGIT / 2) +#define HALF_DIGIT_RADIX (1ul << BITS_PER_HALF_DIGIT) +#define HALF_DIGIT_MASK (HALF_DIGIT_RADIX - 1) + +// DIV_CEIL2(x, y) = ceil(x / y). x and y are positive numbers. +#define DIV_CEIL2(x, y) (((x) - 1) / (y) + 1) + +// DIV_CEIL(x) = ceil(x / BITS_PER_DIGIT) = the number of digits to +// store x bits. x is a positive number. +#define DIV_CEIL(x) DIV_CEIL2(x, BITS_PER_DIGIT) + +#ifdef SC_MAX_NBITS +static const int MAX_NDIGITS = DIV_CEIL(SC_MAX_NBITS) + 2; +// Consider a number with x bits another with y bits. The maximum +// number of bits happens when we multiply them. The result will have +// (x + y) bits. Assume that x + y <= SC_MAX_NBITS. Then, DIV_CEIL(x) + +// DIV_CEIL(y) <= DIV_CEIL(SC_MAX_NBITS) + 2. This is the reason for +2 +// above. With this change, MAX_NDIGITS must be enough to hold the +// result of any operation. +#endif + +// Support for "digit" vectors used to hold the values of sc_signed, +// sc_unsigned, sc_bv_base, and sc_lv_base data types. This type is also used +// in the concatenation support. An sc_digit is currently an unsigned 32-bit +// quantity. The typedef used is an unsigned int, rather than an unsigned long, +// since the unsigned long data type varies in size between 32-bit and 64-bit +// machines. + +typedef unsigned int sc_digit; // 32-bit unsigned integer + +// Support for the long long type. This type is not in the standard +// but is usually supported by compilers. +typedef int64_t int64; +typedef uint64_t uint64; + +static const uint64 UINT64_ZERO = 0ULL; +static const uint64 UINT64_ONE = 1ULL; +static const uint64 UINT64_32ONES = 0x00000000ffffffffULL; + +// Bits per ... +// will be deleted in the future. Use numeric_limits instead +#define BITS_PER_CHAR 8 +#define BITS_PER_INT (sizeof(int) * BITS_PER_CHAR) +#define BITS_PER_LONG (sizeof(long) * BITS_PER_CHAR) +#define BITS_PER_INT64 (sizeof(::sc_dt::int64) * BITS_PER_CHAR) +#define BITS_PER_UINT (sizeof(unsigned int) * BITS_PER_CHAR) +#define BITS_PER_ULONG (sizeof(unsigned long) * BITS_PER_CHAR) +#define BITS_PER_UINT64 (sizeof(::sc_dt::uint64) * BITS_PER_CHAR) + +// Digits per ... +#define DIGITS_PER_CHAR 1 +#define DIGITS_PER_INT ((BITS_PER_INT+29)/30) +#define DIGITS_PER_LONG ((BITS_PER_LONG+29)/30) +#define DIGITS_PER_INT64 ((BITS_PER_INT64+29)/30) +#define DIGITS_PER_UINT ((BITS_PER_UINT+29)/30) +#define DIGITS_PER_ULONG ((BITS_PER_ULONG+29)/30) +#define DIGITS_PER_UINT64 ((BITS_PER_UINT64+29)/30) + +// Above, BITS_PER_X is mainly used for sc_signed, and BITS_PER_UX is +// mainly used for sc_unsigned. + +static const small_type NB_DEFAULT_BASE = SC_DEC; + +// For sc_int code: + +typedef int64 int_type; +typedef uint64 uint_type; +#define SC_INTWIDTH 64 +static const uint64 UINT_ZERO = UINT64_ZERO; +static const uint64 UINT_ONE = UINT64_ONE; + +} // namespace sc_dt + +#endif diff --git a/src/systemc/kernel.cc b/src/systemc/kernel.cc deleted file mode 100644 index e52d04e11..000000000 --- a/src/systemc/kernel.cc +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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/kernel.hh" - -namespace SystemC -{ - -Kernel::Kernel(Params *params) : SimObject(params) -{ -} - -} // namespace SystemC - -SystemC::Kernel * -SystemC_KernelParams::create() -{ - return new SystemC::Kernel(this); -} diff --git a/src/systemc/kernel.hh b/src/systemc/kernel.hh deleted file mode 100644 index 9a81d9db4..000000000 --- a/src/systemc/kernel.hh +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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_KERNEL_HH__ -#define __SYSTEMC_KERNEL_HH__ - -#include "params/SystemC_Kernel.hh" -#include "sim/sim_object.hh" - -namespace SystemC -{ - -/* - * This class represents the systemc kernel. There should be exactly one in - * the simulation. It receives gem5 SimObject lifecycle callbacks (init, - * regStats, etc.) and manages the lifecycle of the systemc simulation - * accordingly. It also acts as a collecting point for systemc related - * control functionality. - */ -class Kernel : public SimObject -{ - public: - typedef SystemC_KernelParams Params; - Kernel(Params *params); -}; - -} // namespace SystemC - -#endif // __SYSTEMC_KERNEL_H__ diff --git a/src/systemc/sc_attr.cc b/src/systemc/sc_attr.cc deleted file mode 100644 index 6128f9378..000000000 --- a/src/systemc/sc_attr.cc +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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/sc_attr.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -sc_attr_base::sc_attr_base(const std::string &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_attr_base::sc_attr_base(const sc_attr_base &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_attr_base::~sc_attr_base() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const std::string & -sc_attr_base::name() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const std::string *)nullptr; -} - -void -sc_attr_base::warn_unimpl(const char *func) -{ - warn("%s not implemented.\n", func); -} - -sc_attr_cltn::iterator -sc_attr_cltn::begin() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return (iterator)nullptr; -} - -sc_attr_cltn::const_iterator -sc_attr_cltn::begin() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return (const_iterator)nullptr; -} - -sc_attr_cltn::iterator -sc_attr_cltn::end() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return (iterator)nullptr; -} - -sc_attr_cltn::const_iterator -sc_attr_cltn::end() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return (const_iterator)nullptr; -} - -} // namespace sc_core diff --git a/src/systemc/sc_attr.hh b/src/systemc/sc_attr.hh deleted file mode 100644 index 6db5893d0..000000000 --- a/src/systemc/sc_attr.hh +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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_SC_ATTR_HH__ -#define __SYSTEMC_SC_ATTR_HH__ - -#include - -namespace sc_core -{ - -class sc_attr_base -{ - public: - sc_attr_base(const std::string &); - sc_attr_base(const sc_attr_base &); - virtual ~sc_attr_base(); - - const std::string &name() const; - - protected: - void warn_unimpl(const char *func); - - private: - // Disabled - sc_attr_base(); - sc_attr_base &operator = (const sc_attr_base &); -}; - -template -class sc_attribute : public sc_attr_base -{ - public: - sc_attribute(const std::string &_name) : sc_attr_base(_name) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - sc_attribute(const std::string &_name, const T &t) : - sc_attr_base(_name), value(t) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - sc_attribute(const sc_attribute &other) : - sc_attr_base(other.name()), value(other.value) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - virtual ~sc_attribute() { warn_unimpl(__PRETTY_FUNCTION__); } - T value; - - private: - // Disabled - sc_attribute() {} - sc_attribute &operator = (const sc_attribute &) { return *this; } -}; - -class sc_attr_cltn -{ - public: - typedef sc_attr_base *elem_type; - typedef elem_type *iterator; - typedef const elem_type *const_iterator; - - iterator begin(); - const_iterator begin() const; - iterator end(); - const_iterator end() const; -}; - -} // namespace sc_core - -#endif //__SYSTEMC_SC_ATTR_HH__ diff --git a/src/systemc/sc_event.cc b/src/systemc/sc_event.cc deleted file mode 100644 index e641af6dc..000000000 --- a/src/systemc/sc_event.cc +++ /dev/null @@ -1,323 +0,0 @@ -/* - * 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/sc_event.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -void -sc_event_finder::warn_unimpl(const char *func) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_and_list::sc_event_and_list() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_and_list::sc_event_and_list(const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_and_list::sc_event_and_list(const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_and_list & -sc_event_and_list::operator = (const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -int -sc_event_and_list::size() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return 0; -} - -void -sc_event_and_list::swap(sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_and_list & -sc_event_and_list::operator &= (const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_event_and_list & -sc_event_and_list::operator &= (const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_event_and_expr -sc_event_and_list::operator & (const sc_event &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_event_and_expr(); -} - -sc_event_and_expr -sc_event_and_list::operator & (const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_event_and_expr(); -} - -sc_event_or_list::sc_event_or_list() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_or_list::sc_event_or_list(const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_or_list::sc_event_or_list(const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_or_list& -sc_event_or_list::operator = (const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_event_or_list::~sc_event_or_list() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -int -sc_event_or_list::size() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return 0; -} - -void -sc_event_or_list::swap(sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_or_list & -sc_event_or_list::operator |= (const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_event_or_list & -sc_event_or_list::operator |= (const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_event_or_expr -sc_event_or_list::operator | (const sc_event &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_event_or_expr(); -} - -sc_event_or_expr -sc_event_or_list::operator | (const sc_event_or_list &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_event_or_expr(); -} - -sc_event_and_expr::operator const sc_event_and_list &() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const sc_event_and_list *)nullptr; -} - -sc_event_and_expr -operator & (sc_event_and_expr expr, sc_event const &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return expr; -} - -sc_event_and_expr -operator & (sc_event_and_expr expr, sc_event_and_list const &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return expr; -} - -sc_event_or_expr::operator const sc_event_or_list &() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const sc_event_or_list *)nullptr; -} - -sc_event_or_expr -operator | (sc_event_or_expr expr, sc_event const &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return expr; -} - -sc_event_or_expr -operator | (sc_event_or_expr expr, sc_event_or_list const &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return expr; -} - -sc_event::sc_event() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event::sc_event(const char *) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event::~sc_event() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const char * -sc_event::name() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return ""; -} - -const char * -sc_event::basename() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return ""; -} - -bool -sc_event::in_hierarchy() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return false; -} - -sc_object * -sc_event::get_parent_object() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return (sc_object *)nullptr; -} - -void -sc_event::notify() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_event::notify(const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_event::notify(double, sc_time_unit) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_event::cancel() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_event_and_expr -sc_event::operator & (const sc_event &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_event_and_expr(); -} - -sc_event_and_expr -sc_event::operator & (const sc_event_and_list &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_event_and_expr(); -} - -sc_event_or_expr -sc_event::operator | (const sc_event &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_event_or_expr(); -} - -sc_event_or_expr -sc_event::operator | (const sc_event_or_list &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_event_or_expr(); -} - -const std::vector & -sc_get_top_level_events() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const std::vector *)nullptr; -} - -sc_event * -sc_find_event(const char *) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return (sc_event *)nullptr; -} - -} // namespace sc_core diff --git a/src/systemc/sc_event.hh b/src/systemc/sc_event.hh deleted file mode 100644 index 98a16bd0c..000000000 --- a/src/systemc/sc_event.hh +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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_SC_EVENT_HH__ -#define __SYSTEMC_SC_EVENT_HH__ - -#include - -#include "sc_time.hh" - -namespace sc_core -{ - -class sc_event; -class sc_event_and_expr; -class sc_event_or_expr; -class sc_object; -class sc_port_base; - -class sc_event_finder -{ - protected: - void warn_unimpl(const char *func) const; -}; - -template -class sc_event_finder_t : public sc_event_finder -{ - public: - sc_event_finder_t(const sc_port_base &, - const sc_event & (IF::*event_method)() const) - { - warn_unimpl(__PRETTY_FUNCTION__); - } -}; - -class sc_event_and_list -{ - public: - sc_event_and_list(); - sc_event_and_list(const sc_event_and_list &); - sc_event_and_list(const sc_event &); - sc_event_and_list &operator = (const sc_event_and_list &); - - int size() const; - void swap(sc_event_and_list &); - - sc_event_and_list &operator &= (const sc_event &); - sc_event_and_list &operator &= (const sc_event_and_list &); - - sc_event_and_expr operator & (const sc_event &) const; - sc_event_and_expr operator & (const sc_event_and_list &); -}; - -class sc_event_or_list -{ - public: - sc_event_or_list(); - sc_event_or_list(const sc_event_or_list &); - sc_event_or_list(const sc_event &); - sc_event_or_list& operator = (const sc_event_or_list &); - ~sc_event_or_list(); - - int size() const; - void swap(sc_event_or_list &); - - sc_event_or_list &operator |= (const sc_event &); - sc_event_or_list &operator |= (const sc_event_or_list &); - - sc_event_or_expr operator | (const sc_event &) const; - sc_event_or_expr operator | (const sc_event_or_list &) const; -}; - -class sc_event_and_expr -{ - public: - operator const sc_event_and_list &() const; -}; - -sc_event_and_expr operator & (sc_event_and_expr, sc_event const &); -sc_event_and_expr operator & (sc_event_and_expr, sc_event_and_list const &); - -class sc_event_or_expr -{ - public: - operator const sc_event_or_list &() const; -}; - -sc_event_or_expr operator | (sc_event_or_expr, sc_event const &); -sc_event_or_expr operator | (sc_event_or_expr, sc_event_or_list const &); - -class sc_event -{ - public: - sc_event(); - explicit sc_event(const char *); - ~sc_event(); - - const char *name() const; - const char *basename() const; - bool in_hierarchy() const; - sc_object *get_parent_object() const; - - void notify(); - void notify(const sc_time &); - void notify(double, sc_time_unit); - void cancel(); - - sc_event_and_expr operator & (const sc_event &) const; - sc_event_and_expr operator & (const sc_event_and_list &) const; - sc_event_or_expr operator | (const sc_event &) const; - sc_event_or_expr operator | (const sc_event_or_list &) const; - - private: - // Disabled - sc_event(const sc_event &) {} - sc_event &operator = (const sc_event &) { return *this; } -}; - -const std::vector &sc_get_top_level_events(); -sc_event *sc_find_event(const char *); - -} // namespace sc_core - -#endif //__SYSTEMC_SC_INTERFACE_HH__ diff --git a/src/systemc/sc_export.cc b/src/systemc/sc_export.cc deleted file mode 100644 index ab1252a92..000000000 --- a/src/systemc/sc_export.cc +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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/sc_export.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -void -sc_export_base::warn_unimpl(const char *func) const -{ - warn("%s not implemented.\n", func); -} - -} // namespace sc_core diff --git a/src/systemc/sc_export.hh b/src/systemc/sc_export.hh deleted file mode 100644 index 5cbd564a0..000000000 --- a/src/systemc/sc_export.hh +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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_SC_EXPORT_HH__ -#define __SYSTEMC_SC_EXPORT_HH__ - -#include "sc_object.hh" - -namespace sc_core -{ - -class sc_interface; - -class sc_export_base : public sc_object -{ - public: - void warn_unimpl(const char *func) const; -}; - -template -class sc_export : public sc_export_base -{ - public: - sc_export() { warn_unimpl(__PRETTY_FUNCTION__); } - explicit sc_export(const char *) { warn_unimpl(__PRETTY_FUNCTION__); } - virtual ~sc_export() { warn_unimpl(__PRETTY_FUNCTION__); }; - - virtual const char *kind() const { return "sc_export"; } - - void operator () (IF &) { warn_unimpl(__PRETTY_FUNCTION__); }; - virtual void bind(IF &) { warn_unimpl(__PRETTY_FUNCTION__); }; - operator IF & () { warn_unimpl(__PRETTY_FUNCTION__); }; - operator const IF & () const { warn_unimpl(__PRETTY_FUNCTION__); }; - - IF * - operator -> () - { - warn_unimpl(__PRETTY_FUNCTION__); - return nullptr; - } - const IF * - operator -> () const - { - warn_unimpl(__PRETTY_FUNCTION__); - return nullptr; - } - - virtual sc_interface * - get_iterface() - { - warn_unimpl(__PRETTY_FUNCTION__); - return nullptr; - } - virtual const sc_interface * - get_interface() const - { - warn_unimpl(__PRETTY_FUNCTION__); - return nullptr; - } - - protected: - virtual void before_end_of_elaboration() {} - virtual void end_of_elaboration() {} - virtual void start_of_simulation() {} - virtual void end_of_simulation() {} - - private: - // Disabled - sc_export(const sc_export &); - sc_export &operator = (const sc_export &); -}; - -} // namespace sc_core - -#endif //__SYSTEMC_SC_EXPORT_HH__ diff --git a/src/systemc/sc_interface.cc b/src/systemc/sc_interface.cc deleted file mode 100644 index 18124abc4..000000000 --- a/src/systemc/sc_interface.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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/sc_interface.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -void -sc_interface::register_port(sc_port_base &, const char *) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const sc_event & -sc_interface::default_event() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(sc_event *)nullptr; -} - -sc_interface::~sc_interface() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_interface::sc_interface() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -} // namespace sc_core diff --git a/src/systemc/sc_interface.hh b/src/systemc/sc_interface.hh deleted file mode 100644 index 4418a9520..000000000 --- a/src/systemc/sc_interface.hh +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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_SC_INTERFACE_HH__ -#define __SYSTEMC_SC_INTERFACE_HH__ - -namespace sc_core -{ - -class sc_port_base; -class sc_event; - -class sc_interface -{ - public: - virtual void register_port(sc_port_base &, const char *); - virtual const sc_event &default_event() const; - virtual ~sc_interface(); - - protected: - sc_interface(); - - private: - // Disabled - sc_interface(const sc_interface &) {} - sc_interface &operator = (const sc_interface &) { return *this; } -}; - -} // namespace sc_core - -#endif //__SYSTEMC_SC_INTERFACE_HH__ diff --git a/src/systemc/sc_main.cc b/src/systemc/sc_main.cc deleted file mode 100644 index 88d51baff..000000000 --- a/src/systemc/sc_main.cc +++ /dev/null @@ -1,125 +0,0 @@ -/* - * 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/sc_main.hh" - -#include - -#include "base/logging.hh" -#include "python/pybind11/pybind.hh" -#include "sim/init.hh" - -// A default version of this function in case one isn't otherwise defined. -// This ensures everything will link properly whether or not the user defined -// a custom sc_main function. If they didn't but still try to call it, throw -// an error and die. -[[gnu::weak]] int -sc_main(int argc, char *argv[]) -{ - // If python attempts to call sc_main but no sc_main was defined... - fatal("sc_main called but not defined.\n"); -} - -namespace sc_core -{ - -namespace -{ - -bool scMainCalled = false; - -int _argc = 0; -char **_argv = NULL; - -// This wrapper adapts the python version of sc_main to the c++ version. -void -sc_main(pybind11::args args) -{ - panic_if(scMainCalled, "sc_main called more than once."); - - _argc = args.size(); - _argv = new char *[_argc]; - - // Initialize all the _argvs to NULL so we can delete [] them - // unconditionally. - for (int idx = 0; idx < _argc; idx++) - _argv[idx] = NULL; - - // Attempt to convert all the arguments to strings. If that fails, clean - // up after ourselves. Also don't count this as a call to sc_main since - // we never got to the c++ version of that function. - try { - for (int idx = 0; idx < _argc; idx++) { - std::string arg = args[idx].cast(); - _argv[idx] = new char[arg.length() + 1]; - strcpy(_argv[idx], arg.c_str()); - } - } catch (...) { - // If that didn't work for some reason (probably a conversion error) - // blow away _argv and _argc and pass on the exception. - for (int idx = 0; idx < _argc; idx++) - delete [] _argv[idx]; - delete [] _argv; - _argc = 0; - throw; - } - - // At this point we're going to call the c++ sc_main, so we can't try - // again later. - scMainCalled = true; - - //TODO Start a new fiber to call sc_main from. - ::sc_main(_argc, _argv); -} - -// Make our sc_main wrapper available in the internal _m5 python module under -// the systemc submodule. -void -systemc_pybind(pybind11::module &m_internal) -{ - pybind11::module m = m_internal.def_submodule("systemc"); - m.def("sc_main", &sc_main); -} -EmbeddedPyBind embed_("systemc", &systemc_pybind); - -} // anonymous namespace - -int -sc_argc() -{ - return _argc; -} - -const char *const * -sc_argv() -{ - return _argv; -} - -} // namespace sc_core diff --git a/src/systemc/sc_main.hh b/src/systemc/sc_main.hh deleted file mode 100644 index d9fd2b1d2..000000000 --- a/src/systemc/sc_main.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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_SC_MAIN_HH__ -#define __SYSTEMC_SC_MAIN_HH__ - -extern "C" int sc_main(int argc, char *argv[]); - -namespace sc_core -{ - extern "C" int sc_argc(); - - // The standard version of this function doesn't have these "const" - // qualifiers, but the canonical SystemC implementation does. - extern "C" const char *const *sc_argv(); -} // namespace sc_core - -#endif //__SYSTEMC_SC_MAIN_HH__ diff --git a/src/systemc/sc_module.cc b/src/systemc/sc_module.cc deleted file mode 100644 index 60c07bf0c..000000000 --- a/src/systemc/sc_module.cc +++ /dev/null @@ -1,543 +0,0 @@ -/* - * 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/sc_module.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -sc_bind_proxy::sc_bind_proxy(const sc_interface &interface) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_bind_proxy::sc_bind_proxy(const sc_port_base &port) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const sc_bind_proxy SC_BIND_PROXY_NUL(*(const sc_port_base *)nullptr); - -sc_module::~sc_module() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const char * -sc_module::kind() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return ""; -} - -const sc_bind_proxy SC_BIND_PROXY_NIL(*(const sc_port_base *)nullptr); - -void -sc_module::operator () (const sc_bind_proxy &p001, - const sc_bind_proxy &p002, - const sc_bind_proxy &p003, - const sc_bind_proxy &p004, - const sc_bind_proxy &p005, - const sc_bind_proxy &p006, - const sc_bind_proxy &p007, - const sc_bind_proxy &p008, - const sc_bind_proxy &p009, - const sc_bind_proxy &p010, - const sc_bind_proxy &p011, - const sc_bind_proxy &p012, - const sc_bind_proxy &p013, - const sc_bind_proxy &p014, - const sc_bind_proxy &p015, - const sc_bind_proxy &p016, - const sc_bind_proxy &p017, - const sc_bind_proxy &p018, - const sc_bind_proxy &p019, - const sc_bind_proxy &p020, - const sc_bind_proxy &p021, - const sc_bind_proxy &p022, - const sc_bind_proxy &p023, - const sc_bind_proxy &p024, - const sc_bind_proxy &p025, - const sc_bind_proxy &p026, - const sc_bind_proxy &p027, - const sc_bind_proxy &p028, - const sc_bind_proxy &p029, - const sc_bind_proxy &p030, - const sc_bind_proxy &p031, - const sc_bind_proxy &p032, - const sc_bind_proxy &p033, - const sc_bind_proxy &p034, - const sc_bind_proxy &p035, - const sc_bind_proxy &p036, - const sc_bind_proxy &p037, - const sc_bind_proxy &p038, - const sc_bind_proxy &p039, - const sc_bind_proxy &p040, - const sc_bind_proxy &p041, - const sc_bind_proxy &p042, - const sc_bind_proxy &p043, - const sc_bind_proxy &p044, - const sc_bind_proxy &p045, - const sc_bind_proxy &p046, - const sc_bind_proxy &p047, - const sc_bind_proxy &p048, - const sc_bind_proxy &p049, - const sc_bind_proxy &p050, - const sc_bind_proxy &p051, - const sc_bind_proxy &p052, - const sc_bind_proxy &p053, - const sc_bind_proxy &p054, - const sc_bind_proxy &p055, - const sc_bind_proxy &p056, - const sc_bind_proxy &p057, - const sc_bind_proxy &p058, - const sc_bind_proxy &p059, - const sc_bind_proxy &p060, - const sc_bind_proxy &p061, - const sc_bind_proxy &p062, - const sc_bind_proxy &p063, - const sc_bind_proxy &p064) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const std::vector & -sc_module::get_child_objects() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const std::vector *)nullptr; -} - -const std::vector & -sc_module::get_child_events() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const std::vector *)nullptr; -} - -sc_module::sc_module(const sc_module_name &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_module::sc_module() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::reset_signal_is(const sc_in &, bool) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::reset_signal_is(const sc_inout &, bool) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::reset_signal_is(const sc_out &, bool) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::reset_signal_is(const sc_signal_in_if &, bool) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - - -void -sc_module::async_reset_signal_is(const sc_in &, bool) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::async_reset_signal_is(const sc_inout &, bool) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::async_reset_signal_is(const sc_out &, bool) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::async_reset_signal_is(const sc_signal_in_if &, bool) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - - -void -sc_module::dont_initialize() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::set_stack_size(size_t) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - - -void -sc_module::next_trigger() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(double, sc_time_unit) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(const sc_time &, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(double, sc_time_unit, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(const sc_time &, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(double, sc_time_unit, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(const sc_time &, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::next_trigger(double, sc_time_unit, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - - -void -sc_module::wait() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(int) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(double, sc_time_unit) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(const sc_time &, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(double, sc_time_unit, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(const sc_time &, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(double, sc_time_unit, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(const sc_time &, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_module::wait(double, sc_time_unit, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - - -void -next_trigger() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(double, sc_time_unit) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(const sc_time &, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(double, sc_time_unit, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(const sc_time &, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(double, sc_time_unit, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(const sc_time &, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -next_trigger(double, sc_time_unit, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - - -void -wait() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(int) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(double, sc_time_unit) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(const sc_time &, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(double, sc_time_unit, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(const sc_time &, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(double, sc_time_unit, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(const sc_time &, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -wait(double, sc_time_unit, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const char * -sc_gen_unique_name(const char *) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return ""; -} - -bool -sc_start_of_simulation_invoked() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return false; -} - -bool -sc_end_of_simulation_invoked() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return false; -} - -} // namespace sc_core diff --git a/src/systemc/sc_module.hh b/src/systemc/sc_module.hh deleted file mode 100644 index 2fd85b68a..000000000 --- a/src/systemc/sc_module.hh +++ /dev/null @@ -1,246 +0,0 @@ -/* - * 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_SC_MODULE_HH__ -#define __SYSTEMC_SC_MODULE_HH__ - -#include - -#include "sc_object.hh" -#include "sc_sensitive.hh" -#include "sc_time.hh" - -namespace sc_core -{ - -template -class sc_in; -template -class sc_out; -template -class sc_inout; -template -class sc_signal_in_if; - -class sc_event; -class sc_event_and_list; -class sc_event_or_list; -class sc_module_name; - -class sc_bind_proxy -{ - public: - sc_bind_proxy(const sc_interface &interface); - sc_bind_proxy(const sc_port_base &port); -}; - -extern const sc_bind_proxy SC_BIND_PROXY_NIL; - -class sc_module : public sc_object -{ - public: - virtual ~sc_module(); - - virtual const char *kind() const; - - void operator () (const sc_bind_proxy &p001, - const sc_bind_proxy &p002 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p003 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p004 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p005 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p006 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p007 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p008 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p009 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p010 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p011 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p012 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p013 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p014 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p015 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p016 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p017 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p018 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p019 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p020 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p021 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p022 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p023 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p024 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p025 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p026 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p027 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p028 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p029 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p030 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p031 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p032 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p033 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p034 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p035 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p036 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p037 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p038 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p039 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p040 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p041 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p042 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p043 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p044 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p045 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p046 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p047 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p048 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p049 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p050 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p051 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p052 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p053 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p054 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p055 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p056 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p057 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p058 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p059 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p060 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p061 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p062 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p063 = SC_BIND_PROXY_NIL, - const sc_bind_proxy &p064 = SC_BIND_PROXY_NIL); - - virtual const std::vector &get_child_objects() const; - virtual const std::vector &get_child_events() const; - - protected: - sc_module(const sc_module_name &); - sc_module(); - - void reset_signal_is(const sc_in &, bool); - void reset_signal_is(const sc_inout &, bool); - void reset_signal_is(const sc_out &, bool); - void reset_signal_is(const sc_signal_in_if &, bool); - - void async_reset_signal_is(const sc_in &, bool); - void async_reset_signal_is(const sc_inout &, bool); - void async_reset_signal_is(const sc_out &, bool); - void async_reset_signal_is(const sc_signal_in_if &, bool); - - sc_sensitive sensitive; - - void dont_initialize(); - void set_stack_size(size_t); - - void next_trigger(); - void next_trigger(const sc_event &); - void next_trigger(const sc_event_or_list &); - void next_trigger(const sc_event_and_list &); - void next_trigger(const sc_time &); - void next_trigger(double, sc_time_unit); - void next_trigger(const sc_time &, const sc_event &); - void next_trigger(double, sc_time_unit, const sc_event &); - void next_trigger(const sc_time &, const sc_event_or_list &); - void next_trigger(double, sc_time_unit, const sc_event_or_list &); - void next_trigger(const sc_time &, const sc_event_and_list &); - void next_trigger(double, sc_time_unit, const sc_event_and_list &); - - void wait(); - void wait(int); - void wait(const sc_event &); - void wait(const sc_event_or_list &); - void wait(const sc_event_and_list &); - void wait(const sc_time &); - void wait(double, sc_time_unit); - void wait(const sc_time &, const sc_event &); - void wait(double, sc_time_unit, const sc_event &); - void wait(const sc_time &, const sc_event_or_list &); - void wait(double, sc_time_unit, const sc_event_or_list &); - void wait(const sc_time &, const sc_event_and_list &); - void wait(double, sc_time_unit, const sc_event_and_list &); - - virtual void before_end_of_elaboration() {} - virtual void end_of_elaboration() {} - virtual void start_of_simulation() {} - virtual void end_of_simulation() {} - - private: - // Disabled - sc_module(const sc_module &) : sc_object() {}; - sc_module &operator = (const sc_module &) { return *this; } -}; - -void next_trigger(); -void next_trigger(const sc_event &); -void next_trigger(const sc_event_or_list &); -void next_trigger(const sc_event_and_list &); -void next_trigger(const sc_time &); -void next_trigger(double, sc_time_unit); -void next_trigger(const sc_time &, const sc_event &); -void next_trigger(double, sc_time_unit, const sc_event &); -void next_trigger(const sc_time &, const sc_event_or_list &); -void next_trigger(double, sc_time_unit, const sc_event_or_list &); -void next_trigger(const sc_time &, const sc_event_and_list &); -void next_trigger(double, sc_time_unit, const sc_event_and_list &); - -void wait(); -void wait(int); -void wait(const sc_event &); -void wait(const sc_event_or_list &); -void wait(const sc_event_and_list &); -void wait(const sc_time &); -void wait(double, sc_time_unit); -void wait(const sc_time &, const sc_event &); -void wait(double, sc_time_unit, const sc_event &); -void wait(const sc_time &, const sc_event_or_list &); -void wait(double, sc_time_unit, const sc_event_or_list &); -void wait(const sc_time &, const sc_event_and_list &); -void wait(double, sc_time_unit, const sc_event_and_list &); - -#define SC_MODULE(name) struct name : ::sc_core::sc_module - -#define SC_CTOR(name) \ - typedef name SC_CURRENT_USER_MODULE; \ - name(::sc_core::sc_module_name) - -#define SC_HAS_PROCESS(name) typedef name SC_CURRENT_USER_MODULE - -#define SC_METHOD(name) /* Implementation defined */ -#define SC_THREAD(name) /* Implementation defined */ -#define SC_CTHREAD(name, clk) /* Implementation defined */ - -const char *sc_gen_unique_name(const char *); - -typedef sc_module sc_behavior; -typedef sc_module sc_channel; - -bool sc_start_of_simulation_invoked(); -bool sc_end_of_simulation_invoked(); - -} // namespace sc_core - -#endif //__SYSTEMC_SC_MODULE_HH__ diff --git a/src/systemc/sc_module_name.cc b/src/systemc/sc_module_name.cc deleted file mode 100644 index 06291e61c..000000000 --- a/src/systemc/sc_module_name.cc +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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/sc_module_name.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -sc_module_name::sc_module_name(const char *name) : - _name(name), _on_the_stack(true) -{ - warn("%s: Module name not added to stack.\n", __PRETTY_FUNCTION__); -} - -sc_module_name::sc_module_name(const sc_module_name &other) : - _name(other._name), _on_the_stack(false) -{} - -sc_module_name::~sc_module_name() -{ - if (_on_the_stack) { - warn("%s: Module name not removed from stack.\n", __PRETTY_FUNCTION__); - } -} - -sc_module_name::operator const char *() const -{ - return _name; -} - -} // namespace sc_core diff --git a/src/systemc/sc_module_name.hh b/src/systemc/sc_module_name.hh deleted file mode 100644 index 40279b366..000000000 --- a/src/systemc/sc_module_name.hh +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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_SC_MODULE_NAME_HH__ -#define __SYSTEMC_SC_MODULE_NAME_HH__ - -namespace sc_core -{ - -class sc_module_name -{ - public: - sc_module_name(const char *); - sc_module_name(const sc_module_name &); - ~sc_module_name(); - - operator const char *() const; - - private: - const char *_name; - bool _on_the_stack; - - // Disabled - sc_module_name() {} - sc_module_name &operator = (const sc_module_name &) { return *this; } -}; - -} // namespace sc_core - -#endif //__SYSTEMC_SC_MODULE_NAME_HH__ diff --git a/src/systemc/sc_object.cc b/src/systemc/sc_object.cc deleted file mode 100644 index 6b9fc251c..000000000 --- a/src/systemc/sc_object.cc +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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/sc_object.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -const char * -sc_object::name() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return "sc_object"; -} - -const char * -sc_object::basename() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return "sc_object"; -} - -const char * -sc_object::kind() const -{ - return "sc_object"; -} - -void -sc_object::print(std::ostream &out) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_object::dump(std::ostream &out) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const std::vector & -sc_object::get_child_objects() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const std::vector *)nullptr; -} - -const std::vector & -sc_object::get_child_events() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const std::vector *)nullptr; -} - -sc_object * -sc_object::get_parent_object() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return NULL; -} - -bool -sc_object::add_attribute(sc_attr_base &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return false; -} - -sc_attr_base * -sc_object::get_attribute(const std::string &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return NULL; -} - -sc_attr_base * -sc_object::remove_attribute(const std::string &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return NULL; -} - -void -sc_object::remove_all_attributes() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -int -sc_object::num_attributes() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return 0; -} - -sc_attr_cltn & -sc_object::attr_cltn() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(sc_attr_cltn *)NULL; -} - -const sc_attr_cltn & -sc_object::attr_cltn() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(sc_attr_cltn *)NULL; -} - -sc_object::sc_object() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_object::sc_object(const char *name) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_object::sc_object(const sc_object &arg) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_object & -sc_object::operator = (const sc_object &) -{ - return *this; -} - -sc_object::~sc_object() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const std::vector & -sc_get_top_level_objects() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const std::vector *)nullptr; -} - -sc_object * -sc_find_object(const char *) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return NULL; -} - -} // namespace sc_core diff --git a/src/systemc/sc_object.hh b/src/systemc/sc_object.hh deleted file mode 100644 index 51ca19759..000000000 --- a/src/systemc/sc_object.hh +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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_SC_OBJECT_HH__ -#define __SYSTEMC_SC_OBJECT_HH__ - -#include -#include -#include - -namespace sc_core -{ - -class sc_event; -class sc_attr_base; -class sc_attr_cltn; - -class sc_object -{ - public: - const char *name() const; - const char *basename() const; - - virtual const char *kind() const; - - virtual void print(std::ostream & =std::cout) const; - virtual void dump(std::ostream & =std::cout) const; - - virtual const std::vector &get_child_objects() const; - virtual const std::vector &get_child_events() const; - sc_object *get_parent_object() const; - - bool add_attribute(sc_attr_base &); - sc_attr_base *get_attribute(const std::string &); - sc_attr_base *remove_attribute(const std::string &); - void remove_all_attributes(); - int num_attributes() const; - sc_attr_cltn &attr_cltn(); - const sc_attr_cltn &attr_cltn() const; - - protected: - sc_object(); - sc_object(const char *); - sc_object(const sc_object &); - sc_object &operator = (const sc_object &); - virtual ~sc_object(); -}; - -const std::vector &sc_get_top_level_objects(); -sc_object *sc_find_object(const char *); - -} // namespace sc_core - -#endif //__SYSTEMC_SC_OBJECT_HH__ diff --git a/src/systemc/sc_port.cc b/src/systemc/sc_port.cc deleted file mode 100644 index 42c55bd46..000000000 --- a/src/systemc/sc_port.cc +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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/sc_port.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -void -sc_port_base::warn_unimpl(const char *func) -{ - warn("%s not implemented.\n", func); -} - -} // namespace sc_core diff --git a/src/systemc/sc_port.hh b/src/systemc/sc_port.hh deleted file mode 100644 index 6c39667ea..000000000 --- a/src/systemc/sc_port.hh +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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_SC_PORT_HH__ -#define __SYSTEMC_SC_PORT_HH__ - -#include "sc_object.hh" - -namespace sc_core -{ - -class sc_interface; - -enum sc_port_policy -{ - SC_ONE_OR_MORE_BOUND, // Default - SC_ZERO_OR_MORE_BOUND, - SC_ALL_BOUND -}; - -class sc_port_base : public sc_object -{ - public: - void warn_unimpl(const char *func); -}; - -template -class sc_port_b : public sc_port_base -{ - public: - void - operator () (IF &) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - void - operator () (sc_port_b &) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - virtual void - bind(IF &) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - virtual void - bind(sc_port_b &) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - int - size() const - { - warn_unimpl(__PRETTY_FUNCTION__); - return 0; - } - - IF * - operator -> () - { - warn_unimpl(__PRETTY_FUNCTION__); - return (IF *)nullptr; - } - - const IF * - operator -> () const - { - warn_unimpl(__PRETTY_FUNCTION__); - return (IF *)nullptr; - } - - IF * - operator [] (int) - { - warn_unimpl(__PRETTY_FUNCTION__); - return (IF *)nullptr; - } - - const IF * - operator [] (int) const - { - warn_unimpl(__PRETTY_FUNCTION__); - return (IF *)nullptr; - } - - virtual sc_interface * - get_interface() - { - warn_unimpl(__PRETTY_FUNCTION__); - return (sc_interface *)nullptr; - } - - virtual const sc_interface * - get_interface() const - { - warn_unimpl(__PRETTY_FUNCTION__); - return (sc_interface *)nullptr; - } - - protected: - virtual void before_end_of_elaboration() {} - virtual void end_of_elaboration() {} - virtual void start_of_elaboration() {} - virtual void end_of_simulation() {} - - explicit sc_port_b(int, sc_port_policy) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - sc_port_b(const char *, int, sc_port_policy) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - virtual ~sc_port_b() - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - private: - // Disabled - sc_port_b() {} - sc_port_b(const sc_port_b &) {} - sc_port_b &operator = (const sc_port_b &) { return *this; } -}; - -template -class sc_port : public sc_port_b -{ - public: - sc_port() - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - explicit sc_port(const char *) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - virtual ~sc_port() - { - warn_unimpl(__PRETTY_FUNCTION__); - } - - virtual const char * - kind() const - { - warn_unimpl(__PRETTY_FUNCTION__); - return ""; - } - - private: - // Disabled - sc_port(const sc_port &) {} - sc_port &operator = (const sc_port &) { return *this; } -}; - -} // namespace sc_core - -#endif //__SYSTEMC_SC_PORT_HH__ diff --git a/src/systemc/sc_prim.cc b/src/systemc/sc_prim.cc deleted file mode 100644 index 516eab2d6..000000000 --- a/src/systemc/sc_prim.cc +++ /dev/null @@ -1,216 +0,0 @@ -/* - * 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/sc_prim.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -const char * -sc_prim_channel::kind() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return ""; -} - -sc_prim_channel::sc_prim_channel() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_prim_channel::sc_prim_channel(const char *) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::request_update() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::async_request_update() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(double, sc_time_unit) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(const sc_time &, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(double, sc_time_unit, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(const sc_time &, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(double, sc_time_unit, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(const sc_time &, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::next_trigger(double, sc_time_unit, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(int) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(double, sc_time_unit) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(const sc_time &, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(double, sc_time_unit, const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(const sc_time &, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(double, sc_time_unit, const sc_event_or_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(const sc_time &, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -void -sc_prim_channel::wait(double, sc_time_unit, const sc_event_and_list &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -} // namespace sc_core diff --git a/src/systemc/sc_prim.hh b/src/systemc/sc_prim.hh deleted file mode 100644 index 1bf15fa83..000000000 --- a/src/systemc/sc_prim.hh +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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_SC_PRIM_HH__ -#define __SYSTEMC_SC_PRIM_HH__ - -#include "sc_object.hh" -#include "sc_time.hh" - -namespace sc_core -{ - -class sc_event; -class sc_event_and_list; -class sc_event_or_list; - -class sc_prim_channel : public sc_object -{ - public: - virtual const char *kind() const; - - protected: - sc_prim_channel(); - explicit sc_prim_channel(const char *); - virtual ~sc_prim_channel() {} - - void request_update(); - void async_request_update(); - virtual void update() {} - - void next_trigger(); - void next_trigger(const sc_event &); - void next_trigger(const sc_event_or_list &); - void next_trigger(const sc_event_and_list &); - void next_trigger(const sc_time &); - void next_trigger(double, sc_time_unit); - void next_trigger(const sc_time &, const sc_event &); - void next_trigger(double, sc_time_unit, const sc_event &); - void next_trigger(const sc_time &, const sc_event_or_list &); - void next_trigger(double, sc_time_unit, const sc_event_or_list &); - void next_trigger(const sc_time &, const sc_event_and_list &); - void next_trigger(double, sc_time_unit, const sc_event_and_list &); - - void wait(); - void wait(int); - void wait(const sc_event &); - void wait(const sc_event_or_list &); - void wait(const sc_event_and_list &); - void wait(const sc_time &); - void wait(double, sc_time_unit); - void wait(const sc_time &, const sc_event &); - void wait(double, sc_time_unit, const sc_event &); - void wait(const sc_time &, const sc_event_or_list &); - void wait(double, sc_time_unit, const sc_event_or_list &); - void wait(const sc_time &, const sc_event_and_list &); - void wait(double, sc_time_unit, const sc_event_and_list &); - - virtual void before_end_of_elaboration() {} - virtual void end_of_elaboration() {} - virtual void start_of_simulation() {} - virtual void end_of_simulation() {} - - private: - // Disabled - sc_prim_channel(const sc_prim_channel &); - sc_prim_channel &operator = (const sc_prim_channel &); -}; - -} // namespace sc_core - -#endif //__SYSTEMC_SC_PRIM_HH__ diff --git a/src/systemc/sc_sensitive.cc b/src/systemc/sc_sensitive.cc deleted file mode 100644 index eedade0f1..000000000 --- a/src/systemc/sc_sensitive.cc +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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/sc_sensitive.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -sc_sensitive & -sc_sensitive::operator << (const sc_event &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_sensitive & -sc_sensitive::operator << (const sc_interface &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_sensitive & -sc_sensitive::operator << (const sc_port_base &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_sensitive & -sc_sensitive::operator << (sc_event_finder &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -} // namespace sc_core diff --git a/src/systemc/sc_sensitive.hh b/src/systemc/sc_sensitive.hh deleted file mode 100644 index cd0dadb5b..000000000 --- a/src/systemc/sc_sensitive.hh +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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_SC_SENSITIVE_HH__ -#define __SYSTEMC_SC_SENSITIVE_HH__ - -namespace sc_core -{ - -class sc_event; -class sc_event_finder; -class sc_interface; -class sc_port_base; - -class sc_sensitive -{ - public: - sc_sensitive &operator << (const sc_event &); - sc_sensitive &operator << (const sc_interface &); - sc_sensitive &operator << (const sc_port_base &); - sc_sensitive &operator << (sc_event_finder &); -}; - -} // namespace sc_core - -#endif //__SYSTEMC_SC_SENSITIVE_HH__ diff --git a/src/systemc/sc_time.cc b/src/systemc/sc_time.cc deleted file mode 100644 index 7c1b4eef7..000000000 --- a/src/systemc/sc_time.cc +++ /dev/null @@ -1,233 +0,0 @@ -/* - * 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/sc_time.hh" - -#include "base/logging.hh" - -namespace sc_core -{ - -sc_time::sc_time() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_time::sc_time(double, sc_time_unit) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_time::sc_time(const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_time & -sc_time::operator = (const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_dt::uint64 -sc_time::value() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return 0; -} - -double -sc_time::to_double() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return 0.0; -} -double -sc_time::to_seconds() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return 0.0; -} - -const std::string -sc_time::to_string() const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return ""; -} - -bool -sc_time::operator == (const sc_time &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return true; -} - -bool -sc_time::operator != (const sc_time &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return false; -} - -bool -sc_time::operator < (const sc_time &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return false; -} - -bool -sc_time::operator <= (const sc_time &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return true; -} - -bool -sc_time::operator > (const sc_time &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return false; -} - -bool -sc_time::operator >= (const sc_time &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return true; -} - -sc_time & -sc_time::operator += (const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_time & -sc_time::operator -= (const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_time & -sc_time::operator *= (double) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -sc_time & -sc_time::operator /= (double) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *this; -} - -void -sc_time::print(std::ostream &) const -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -const sc_time -operator + (const sc_time &, const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_time(); -} - -const sc_time -operator - (const sc_time &, const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_time(); -} - -const sc_time -operator * (const sc_time &, double) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_time(); -} - -const sc_time -operator * (double, const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_time(); -} - -const sc_time -operator / (const sc_time &, double) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_time(); -} - -double -operator / (const sc_time &, const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return 0.0; -} - -std::ostream & -operator << (std::ostream &os, const sc_time &) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return os; -} - -const sc_time SC_ZERO_TIME; - -void -sc_set_time_resolution(double, sc_time_unit) -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); -} - -sc_time -sc_get_time_resolution() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return sc_time(); -} - -const sc_time & -sc_max_time() -{ - warn("%s not implemented.\n", __PRETTY_FUNCTION__); - return *(const sc_time *)nullptr; -} - -} // namespace sc_core diff --git a/src/systemc/sc_time.hh b/src/systemc/sc_time.hh deleted file mode 100644 index 3c70ba9b9..000000000 --- a/src/systemc/sc_time.hh +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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_SC_TIME_HH__ -#define __SYSTEMC_SC_TIME_HH__ - -#include - -#include - -#include "dt/int/sc_nbdefs.hh" - -namespace sc_core -{ - -enum sc_time_unit { - SC_FS = 0, - SC_PS, - SC_NS, - SC_US, - SC_MS, - SC_SEC -}; - -class sc_time -{ - public: - sc_time(); - sc_time(double, sc_time_unit); - sc_time(const sc_time &); - - sc_time &operator = (const sc_time &); - - sc_dt::uint64 value() const; - double to_double() const; - double to_seconds() const; - const std::string to_string() const; - - bool operator == (const sc_time &) const; - bool operator != (const sc_time &) const; - bool operator < (const sc_time &) const; - bool operator <= (const sc_time &) const; - bool operator > (const sc_time &) const; - bool operator >= (const sc_time &) const; - - sc_time &operator += (const sc_time &); - sc_time &operator -= (const sc_time &); - sc_time &operator *= (double); - sc_time &operator /= (double); - - void print(std::ostream & =std::cout) const; -}; - -const sc_time operator + (const sc_time &, const sc_time &); -const sc_time operator - (const sc_time &, const sc_time &); - -const sc_time operator * (const sc_time &, double); -const sc_time operator * (double, const sc_time &); -const sc_time operator / (const sc_time &, double); -double operator / (const sc_time &, const sc_time &); - -std::ostream &operator << (std::ostream &, const sc_time &); - -extern const sc_time SC_ZERO_TIME; - -void sc_set_time_resolution(double, sc_time_unit); -sc_time sc_get_time_resolution(); -const sc_time &sc_max_time(); - -} // namespace sc_core - -#endif //__SYSTEMC_SC_TIME_HH__ -- cgit v1.2.3