diff options
author | Gabe Black <gabeblack@google.com> | 2018-05-09 18:42:03 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-07-24 21:45:55 +0000 |
commit | 5872389715a194dd91b17e46b770537415d50e30 (patch) | |
tree | db88c6c62d4055ff37c9456e3134ec6d8fda7d82 /src/systemc/ext | |
parent | 34467a211b43cf52e469f5e3842a3b8c431959c7 (diff) | |
download | gem5-5872389715a194dd91b17e46b770537415d50e30.tar.xz |
systemc: Stub out the predefined channels.
Change-Id: Ie030aad26875bd49e54981ec1e9076b7b5af6630
Reviewed-on: https://gem5-review.googlesource.com/10839
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/ext')
31 files changed, 3457 insertions, 0 deletions
diff --git a/src/systemc/ext/channel/_channel.hh b/src/systemc/ext/channel/_channel.hh new file mode 100644 index 000000000..d95cfc244 --- /dev/null +++ b/src/systemc/ext/channel/_channel.hh @@ -0,0 +1,60 @@ +/* + * 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_CHANNEL__CHANNEL_HH__ +#define __SYSTEMC_EXT_CHANNEL__CHANNEL_HH__ + +#include "sc_buffer.hh" +#include "sc_clock.hh" +#include "sc_event_queue.hh" +#include "sc_fifo.hh" +#include "sc_fifo_in.hh" +#include "sc_fifo_in_if.hh" +#include "sc_fifo_out.hh" +#include "sc_fifo_out_if.hh" +#include "sc_in.hh" +#include "sc_in_resolved.hh" +#include "sc_in_rv.hh" +#include "sc_inout.hh" +#include "sc_inout_resolved.hh" +#include "sc_inout_rv.hh" +#include "sc_mutex.hh" +#include "sc_mutex_if.hh" +#include "sc_out.hh" +#include "sc_out_resolved.hh" +#include "sc_out_rv.hh" +#include "sc_semaphore.hh" +#include "sc_semaphore_if.hh" +#include "sc_signal.hh" +#include "sc_signal_in_if.hh" +#include "sc_signal_inout_if.hh" +#include "sc_signal_resolved.hh" +#include "sc_signal_rv.hh" + +#endif //__SYSTEMC_EXT_CHANNEL__CHANNEL_HH__ diff --git a/src/systemc/ext/channel/_using.hh b/src/systemc/ext/channel/_using.hh new file mode 100644 index 000000000..58269d565 --- /dev/null +++ b/src/systemc/ext/channel/_using.hh @@ -0,0 +1,95 @@ +/* + * 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_CHANNEL__USING_HH__ +#define __SYSTEMC_EXT_CHANNEL__USING_HH__ + +#include "_channel.hh" + +using sc_core::sc_buffer; + +using sc_core::sc_in_clk; +using sc_core::sc_clock; + +using sc_core::sc_event_queue; + +using sc_core::sc_fifo; + +using sc_core::sc_fifo_in; + +using sc_core::sc_fifo_nonblocking_in_if; +using sc_core::sc_fifo_blocking_in_if; +using sc_core::sc_fifo_in_if; + +using sc_core::sc_fifo_out; + +using sc_core::sc_fifo_nonblocking_out_if; +using sc_core::sc_fifo_blocking_out_if; +using sc_core::sc_fifo_out_if; + +using sc_core::sc_in; + +using sc_core::sc_in_resolved; + +using sc_core::sc_in_rv; + +using sc_core::sc_inout; + +using sc_core::sc_inout_resolved; + +using sc_core::sc_inout_rv; + +using sc_core::sc_mutex; + +using sc_core::sc_mutex_if; + +using sc_core::sc_out; + +using sc_core::sc_out_resolved; + +using sc_core::sc_out_rv; + +using sc_core::sc_semaphore; + +using sc_core::sc_semaphore_if; + +using sc_core::sc_signal; + +using sc_core::sc_signal_in_if; + +using sc_core::SC_ONE_WRITER; +using sc_core::SC_MANY_WRITERS; +using sc_core::sc_signal_write_if; +using sc_core::sc_signal_inout_if; + +using sc_core::sc_signal_resolved; + +using sc_core::sc_signal_rv; + +#endif //__SYSTEMC_EXT_CHANNEL__USING_HH__ diff --git a/src/systemc/ext/channel/sc_buffer.hh b/src/systemc/ext/channel/sc_buffer.hh new file mode 100644 index 000000000..153b60b10 --- /dev/null +++ b/src/systemc/ext/channel/sc_buffer.hh @@ -0,0 +1,90 @@ +/* + * 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_CHANNEL_SC_BUFFER_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_BUFFER_HH__ + +#include "../core/sc_module.hh" // for sc_gen_unique_name +#include "sc_signal.hh" +#include "warn_unimpl.hh" // for warn_unimpl + +namespace sc_core +{ + +template <class T, sc_writer_policy WRITER_POLICY> +class sc_buffer : public sc_signal<T, WRITER_POLICY> +{ + public: + sc_buffer() : sc_signal<T, WRITER_POLICY>(sc_gen_unique_name("buffer")) {} + explicit sc_buffer(const char *name) : + sc_signal<T, WRITER_POLICY>(sc_gen_unique_name(name)) + {} + + virtual void + write(const T&) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + sc_buffer<T, WRITER_POLICY> & + operator = (const T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_buffer<T, WRITER_POLICY> & + operator = (const sc_signal<T, WRITER_POLICY> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_buffer<T, WRITER_POLICY> & + operator = (const sc_buffer<T, WRITER_POLICY> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + + virtual const char *kind() const { return "sc_buffer"; } + + protected: + virtual void + update() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + private: + // Disabled + sc_buffer(const sc_buffer<T, WRITER_POLICY> &) {} +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_BUFFER_HH__ diff --git a/src/systemc/ext/channel/sc_clock.hh b/src/systemc/ext/channel/sc_clock.hh new file mode 100644 index 000000000..9ca160c3a --- /dev/null +++ b/src/systemc/ext/channel/sc_clock.hh @@ -0,0 +1,85 @@ +/* + * 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_CHANNEL_SC_CLOCK_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_CLOCK_HH__ + +#include "../core/sc_time.hh" +#include "sc_signal.hh" + +namespace sc_core +{ + +template <class T> +class sc_in; + +class sc_time; + +class sc_clock : public sc_signal<bool> +{ + public: + sc_clock(); + explicit sc_clock(const char *name); + + sc_clock(const char *name, const sc_time &period, + double duty_cycle=0.5, const sc_time &start_time=SC_ZERO_TIME, + bool posedge_first=true); + + sc_clock(const char *name, double period_v, sc_time_unit period_tu, + double duty_cycle=0.5); + + sc_clock(const char *name, double period_v, sc_time_unit period_tu, + double duty_cycle, double start_time_v, + sc_time_unit start_time_tu, bool posedge_first=true); + + virtual ~sc_clock(); + + virtual void write(const bool &); + + const sc_time &period() const; + double duty_cycle() const; + const sc_time &start_time() const; + bool posedge_first() const; + + virtual const char *kind() const; + + protected: + virtual void before_end_of_elaboration(); + + private: + // Disabled + sc_clock(const sc_clock &) : sc_interface(), sc_signal<bool>() {} + sc_clock &operator = (const sc_clock &) { return *this; } +}; + +typedef sc_in<bool> sc_in_clk; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_CLOCK_HH__ diff --git a/src/systemc/ext/channel/sc_event_queue.hh b/src/systemc/ext/channel/sc_event_queue.hh new file mode 100644 index 000000000..aa2f72e77 --- /dev/null +++ b/src/systemc/ext/channel/sc_event_queue.hh @@ -0,0 +1,70 @@ +/* + * 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_CHANNEL_SC_EVENT_QUEUE_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_EVENT_QUEUE_HH__ + +#include "../core/sc_interface.hh" +#include "../core/sc_module.hh" // for sc_gen_unique_name +#include "../core/sc_module_name.hh" +#include "../core/sc_time.hh" +#include "warn_unimpl.hh" + +namespace sc_core +{ + +class sc_event; + +class sc_event_queue_if : public virtual sc_interface +{ + public: + virtual void notify(double, sc_time_unit) = 0; + virtual void notify(const sc_time &) = 0; + virtual void cancel_all() = 0; +}; + +class sc_event_queue : public sc_event_queue_if, public sc_module +{ + public: + sc_event_queue(sc_module_name name= + sc_module_name(sc_gen_unique_name("event_queue"))); + ~sc_event_queue(); + + virtual const char *kind() const; + + virtual void notify(double, sc_time_unit); + virtual void notify(const sc_time &); + virtual void cancel_all(); + + virtual const sc_event &default_event() const; +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_EVENT_QUEUE_HH__ diff --git a/src/systemc/ext/channel/sc_fifo.hh b/src/systemc/ext/channel/sc_fifo.hh new file mode 100644 index 000000000..668c6b8bd --- /dev/null +++ b/src/systemc/ext/channel/sc_fifo.hh @@ -0,0 +1,171 @@ +/* + * 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_CHANNEL_SC_FIFO_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_FIFO_HH__ + +#include "../core/sc_module.hh" // for sc_gen_unique_name +#include "../core/sc_prim.hh" +#include "sc_fifo_in_if.hh" +#include "sc_fifo_out_if.hh" +#include "warn_unimpl.hh" + +namespace sc_core +{ + +class sc_port_base; +class sc_event; + +template <class T> +class sc_fifo : public sc_fifo_in_if<T>, + public sc_fifo_out_if<T>, + public sc_prim_channel +{ + public: + explicit sc_fifo(int size=16) : + sc_fifo_in_if<T>(), sc_fifo_out_if<T>(), + sc_prim_channel(sc_gen_unique_name("fifo")) + {} + explicit sc_fifo(const char *name, int size=16) : + sc_fifo_in_if<T>(), sc_fifo_out_if<T>(), + sc_prim_channel(name) + {} + virtual ~sc_fifo() {} + + virtual void + register_port(sc_port_base &, const char *) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + read(T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual T + read() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(T *)nullptr; + } + virtual bool + nb_read(T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + operator T() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(T *)nullptr; + } + + virtual void + write(const T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual bool + nb_write(const T&) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + sc_fifo<T> & + operator = (const T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + + virtual const sc_event & + data_Written_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + virtual const sc_event & + data_read_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + + virtual int + num_available() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return 0; + } + virtual int + num_free() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return 0; + } + + virtual void + print(std::ostream & =std::cout) const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual void + dump(std::ostream & =std::cout) const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual const char *kind() const { return "sc_fifo"; } + + protected: + virtual void + update() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + private: + // Disabled + sc_fifo(const sc_fifo<T> &) : + sc_fifo_in_if<T>(), sc_fifo_in_if<T>(), sc_prim_channel() + {} + sc_fifo &operator = (const sc_fifo<T> &) { return *this; } +}; + +template <class T> +inline std::ostream & +operator << (std::ostream &os, const sc_fifo<T> &) +{ + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return os; +} + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_FIFO_HH__ diff --git a/src/systemc/ext/channel/sc_fifo_in.hh b/src/systemc/ext/channel/sc_fifo_in.hh new file mode 100644 index 000000000..7f593c16f --- /dev/null +++ b/src/systemc/ext/channel/sc_fifo_in.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_CHANNEL_SC_FIFO_IN_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_FIFO_IN_HH__ + +#include "../core/sc_port.hh" +#include "sc_fifo_in_if.hh" +#include "warn_unimpl.hh" + +namespace sc_core +{ + +class sc_event; +class sc_event_finder; + +template <class T> +class sc_fifo_in : public sc_port<sc_fifo_in_if<T>, 0> +{ + public: + sc_fifo_in() : sc_port<sc_fifo_in_if<T>, 0>() {} + explicit sc_fifo_in(const char *name) : sc_port<sc_fifo_in_if<T>, 0>(name) + {} + virtual ~sc_fifo_in() {} + + void + read(T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + T + read() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(T *)nullptr; + } + bool + nb_read(T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + const sc_event & + data_written_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + sc_event_finder & + data_written() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + int + num_available() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return 0; + } + virtual const char *kind() const { return "sc_fifo_in"; } + + private: + // Disabled + sc_fifo_in(const sc_fifo_in<T> &) : sc_port<sc_fifo_in_if<T>, 0>() {} + sc_fifo_in<T> &operator = (const sc_fifo_in<T> &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_FIFO_IN_HH__ diff --git a/src/systemc/ext/channel/sc_fifo_in_if.hh b/src/systemc/ext/channel/sc_fifo_in_if.hh new file mode 100644 index 000000000..a6ac4f544 --- /dev/null +++ b/src/systemc/ext/channel/sc_fifo_in_if.hh @@ -0,0 +1,74 @@ +/* + * 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_CHANNEL_SC_FIFO_IN_IF_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_FIFO_IN_IF_HH__ + +#include "../core/sc_interface.hh" + +namespace sc_core +{ + +class sc_event; + +template <class T> +class sc_fifo_nonblocking_in_if : virtual public sc_interface +{ + public: + virtual bool ab_read(T &) = 0; + virtual const sc_event &data_written_event() const = 0; +}; + +template <class T> +class sc_fifo_blocking_in_if : virtual public sc_interface +{ + public: + virtual void read(T &) = 0; + virtual T read() = 0; +}; + +template <class T> +class sc_fifo_in_if : public sc_fifo_nonblocking_in_if<T>, + public sc_fifo_blocking_in_if<T> +{ + public: + virtual int num_avaialble() const = 0; + + protected: + sc_fifo_in_if() : sc_interface() {} + + private: + // Disabled + sc_fifo_in_if(const sc_fifo_in_if<T> &); + sc_fifo_in_if<T> &operator = (const sc_fifo_in_if<T> &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_FIFO_IN_IF_HH__ diff --git a/src/systemc/ext/channel/sc_fifo_out.hh b/src/systemc/ext/channel/sc_fifo_out.hh new file mode 100644 index 000000000..4beb15d37 --- /dev/null +++ b/src/systemc/ext/channel/sc_fifo_out.hh @@ -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 + */ + +#ifndef __SYSTEMC_EXT_CHANNEL_SC_FIFO_OUT_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_FIFO_OUT_HH__ + +#include "../core/sc_port.hh" +#include "sc_fifo_out_if.hh" +#include "warn_unimpl.hh" + +namespace sc_core +{ + +class sc_event; +class sc_event_finder; + +template <class T> +class sc_fifo_out : public sc_port<sc_fifo_out_if<T>, 0> +{ + public: + sc_fifo_out() : sc_port<sc_fifo_out_if<T>, 0>() {} + explicit sc_fifo_out(const char *name) : + sc_port<sc_fifo_out_if<T>, 0>(name) + {} + virtual ~sc_fifo_out() {} + + void + write(const T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + bool + nb_write(const T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + const sc_event & + data_read_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + sc_event_finder & + data_read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + int + num_free() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return 0; + } + virtual const char *kind() const { return "sc_fifo_out"; } + + private: + // Disabled + sc_fifo_out(const sc_fifo_out<T> &) : sc_port<sc_fifo_out_if<T>, 0>() {} + sc_fifo_out<T> &operator = (const sc_fifo_out<T> &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_FIFO_OUT_HH__ diff --git a/src/systemc/ext/channel/sc_fifo_out_if.hh b/src/systemc/ext/channel/sc_fifo_out_if.hh new file mode 100644 index 000000000..ebc5d5cfd --- /dev/null +++ b/src/systemc/ext/channel/sc_fifo_out_if.hh @@ -0,0 +1,76 @@ +/* + * 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_CHANNEL_SC_FIFO_OUT_IF_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_FIFO_OUT_IF_HH__ + +#include "../core/sc_interface.hh" + +namespace sc_core +{ + +class sc_event; + +template <class T> +class sc_fifo_nonblocking_out_if : virtual public sc_interface +{ + public: + virtual bool ab_write(const T &) = 0; + virtual const sc_event &data_read_event() const = 0; +}; + +template <class T> +class sc_fifo_blocking_out_if : virtual public sc_interface +{ + public: + virtual void write(const T &) = 0; +}; + +template <class T> +class sc_fifo_out_if : public sc_fifo_nonblocking_out_if<T>, + public sc_fifo_blocking_out_if<T> +{ + public: + virtual int num_free() const = 0; + + protected: + sc_fifo_out_if() : sc_interface(), sc_fifo_nonblocking_out_if<T>(), + sc_fifo_blocking_out_if<T>() + {} + + private: + sc_fifo_out_if(const sc_fifo_out_if<T> &) : sc_interface(), + sc_fifo_nonblocking_out_if<T>(), sc_fifo_blocking_out_if<T>() + {} + sc_fifo_out_if<T> &operator = (const sc_fifo_out_if<T> &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_FIFO_OUT_IF_HH__ diff --git a/src/systemc/ext/channel/sc_in.hh b/src/systemc/ext/channel/sc_in.hh new file mode 100644 index 000000000..a283d0db3 --- /dev/null +++ b/src/systemc/ext/channel/sc_in.hh @@ -0,0 +1,433 @@ +/* + * 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_CHANNEL_SC_IN_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_IN_HH__ + +#include <string> + +#include "../core/sc_port.hh" +#include "sc_signal_in_if.hh" +#include "sc_signal_inout_if.hh" +#include "warn_unimpl.hh" + +namespace sc_core +{ + +class sc_event; +class sc_event_finder; +class sc_trace_file; + +template <class T> +class sc_in : public sc_port<sc_signal_in_if<T>, 1> +{ + public: + sc_in() : sc_port<sc_signal_in_if<T>, 1>() {} + explicit sc_in(const char *name) : sc_port<sc_signal_in_if<T>, 1>(name) {} + virtual ~sc_in() {} + + virtual void + bind(const sc_signal_in_if<T> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + operator () (const sc_signal_in_if<T> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + bind(sc_port<sc_signal_in_if<T>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + operator () (sc_port<sc_signal_in_if<T>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + bind(sc_port<sc_signal_inout_if<T>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + operator () (sc_port<sc_signal_inout_if<T>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + end_of_elaboration() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + const T & + read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const T *)nullptr; + } + operator const T& () const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const T *)nullptr; + } + + const sc_event & + default_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + const sc_event & + value_changed_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + bool + event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + sc_event_finder & + value_changed() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + + virtual const char *kind() const { return "sc_in"; } + + private: + // Disabled + sc_in(const sc_in<T> &) : sc_port<sc_signal_in_if<T>, 1>() {} + sc_in<T> &operator = (const sc_in<T> &) { return *this; } +}; + +template <class T> +inline void +sc_trace(sc_trace_file *, const sc_in<T> &, const std::string &) +{ + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +} + +template <> +class sc_in<bool> : public sc_port<sc_signal_in_if<bool>, 1> +{ + public: + sc_in() : sc_port<sc_signal_in_if<bool>, 1>() {} + explicit sc_in(const char *name) : + sc_port<sc_signal_in_if<bool>, 1>(name) {} + virtual ~sc_in() {} + + virtual void + bind(const sc_signal_in_if<bool> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + operator () (const sc_signal_in_if<bool> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + bind(sc_port<sc_signal_in_if<bool>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + operator () (sc_port<sc_signal_in_if<bool>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + bind(sc_port<sc_signal_inout_if<bool>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + operator () (sc_port<sc_signal_inout_if<bool>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + end_of_elaboration() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + const bool & + read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const bool *)nullptr; + } + operator const bool& () const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const bool *)nullptr; + } + + const sc_event & + default_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + const sc_event & + value_changed_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + const sc_event & + posedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + const sc_event & + negedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + + bool + event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + bool + posedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + bool + negedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + + sc_event_finder & + value_changed() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + sc_event_finder & + pos() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + sc_event_finder & + neg() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + + virtual const char *kind() const { return "sc_in"; } + + private: + // Disabled + sc_in(const sc_in<bool> &) : sc_port<sc_signal_in_if<bool>, 1>() {} + sc_in<bool> &operator = (const sc_in<bool> &) { return *this; } +}; + +template <> +inline void +sc_trace<bool>(sc_trace_file *, const sc_in<bool> &, const std::string &) +{ + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +} + +template <> +class sc_in<sc_dt::sc_logic> : + public sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> +{ + public: + sc_in() : sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>() {} + explicit sc_in(const char *name) : + sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(name) + {} + virtual ~sc_in() {} + + virtual void + bind(const sc_signal_in_if<sc_dt::sc_logic> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + operator () (const sc_signal_in_if<sc_dt::sc_logic> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + bind(sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + operator () (sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + bind(sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + operator () (sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + end_of_elaboration() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + const sc_dt::sc_logic & + read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_dt::sc_logic *)nullptr; + } + operator const sc_dt::sc_logic& () const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_dt::sc_logic *)nullptr; + } + + const sc_event & + default_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + const sc_event & + value_changed_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + const sc_event & + posedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + const sc_event & + negedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_event *)nullptr; + } + + bool + event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + bool + posedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + bool + negedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + + sc_event_finder & + value_changed() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + sc_event_finder & + pos() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + sc_event_finder & + neg() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + + virtual const char *kind() const { return "sc_in"; } + + private: + // Disabled + sc_in(const sc_in<sc_dt::sc_logic> &) : + sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>() + {} + sc_in<sc_dt::sc_logic> & + operator = (const sc_in<sc_dt::sc_logic> &) + { + return *this; + } +}; + +template <> +inline void +sc_trace<sc_dt::sc_logic>( + sc_trace_file *, const sc_in<sc_dt::sc_logic> &, const std::string &) +{ + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +} + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_IN_HH__ diff --git a/src/systemc/ext/channel/sc_in_resolved.hh b/src/systemc/ext/channel/sc_in_resolved.hh new file mode 100644 index 000000000..cfc8f4763 --- /dev/null +++ b/src/systemc/ext/channel/sc_in_resolved.hh @@ -0,0 +1,68 @@ +/* + * 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_CHANNEL_SC_IN_RESOLVED_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_IN_RESOLVED_HH__ + +#include "sc_in.hh" + +namespace +{ + +class sc_logic; + +} + +namespace sc_core +{ + +class sc_in_resolved : public sc_in<sc_dt::sc_logic> +{ + public: + sc_in_resolved(); + explicit sc_in_resolved(const char *name); + virtual ~sc_in_resolved(); + + virtual void end_of_elaboration(); + + virtual const char *kind() const; + + private: + // Disabled + sc_in_resolved(const sc_in_resolved &) : sc_in<sc_dt::sc_logic>() {} + sc_in_resolved & + operator = (const sc_in_resolved &) + { + return *this; + } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_IN_RESOLVED_HH__ diff --git a/src/systemc/ext/channel/sc_in_rv.hh b/src/systemc/ext/channel/sc_in_rv.hh new file mode 100644 index 000000000..eca2c0c7e --- /dev/null +++ b/src/systemc/ext/channel/sc_in_rv.hh @@ -0,0 +1,66 @@ +/* + * 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_CHANNEL_SC_IN_RV_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_IN_RV_HH__ + +#include "sc_in.hh" + +namespace sc_dt +{ + +template <int W> +class sc_lv; + +} // namespace sc_dt + +namespace sc_core +{ + +template <int W> +class sc_in_rv : public sc_in<sc_dt::sc_lv<W>> +{ + public: + sc_in_rv() : sc_in<sc_dt::sc_lv<W>>() {} + explicit sc_in_rv(const char *name) : sc_in<sc_dt::sc_lv<W>>(name) {} + virtual ~sc_in_rv() {}; + + virtual void end_of_elaboration() {} + + virtual const char *kind() const { return "sc_in_rv"; } + + private: + // Disabled + sc_in_rv(const sc_in_rv<W> &) : sc_in<sc_dt::sc_lv<W>>() {} + sc_in_rv<W> &operator = (const sc_in_rv<W> &) { *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_IN_RV_HH__ diff --git a/src/systemc/ext/channel/sc_inout.hh b/src/systemc/ext/channel/sc_inout.hh new file mode 100644 index 000000000..1802b2e8d --- /dev/null +++ b/src/systemc/ext/channel/sc_inout.hh @@ -0,0 +1,466 @@ +/* + * 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_CHANNEL_SC_INOUT_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_INOUT_HH__ + +#include <string> + +#include "../core/sc_port.hh" +#include "sc_signal_inout_if.hh" +#include "warn_unimpl.hh" + +namespace sc_dt +{ + +class sc_logic; + +} // namespace sc_dt + +namespace sc_core +{ + +class sc_event; +class sc_event_finder; +class sc_trace_file; + +template <class T> +class sc_inout : public sc_port<sc_signal_inout_if<T>, 1> +{ + public: + sc_inout() : sc_port<sc_signal_inout_if<T>, 1>() {} + explicit sc_inout(const char *name) : + sc_port<sc_signal_inout_if<T>, 1>(name) + {} + virtual ~sc_inout() {} + + void + initialize(const T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + initialize(const sc_signal_in_if<T> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void end_of_elaboration() {} + + const T & + read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const T *)nullptr; + } + operator const T& () const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const T *)nullptr; + } + + void + write(const T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + sc_inout<T> & + operator = (const T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<T> *)nullptr; + } + sc_inout<T> & + operator = (const sc_signal_in_if<T> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<T> *)nullptr; + } + sc_inout<T> & + operator = (const sc_port<sc_signal_in_if<T>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<T> *)nullptr; + } + sc_inout<T> & + operator = (const sc_port<sc_signal_inout_if<T>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<T> *)nullptr; + } + sc_inout<T> & + operator = (const sc_inout<T> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<T> *)nullptr; + } + + const sc_event & + default_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + const sc_event & + value_changed_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + bool + event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + sc_event_finder & + value_changed() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + + virtual const char *kind() const { return "sc_inout"; } + + private: + // Disabled + sc_inout(const sc_inout<T> &) : sc_port<sc_signal_inout_if<T>, 1>() {} +}; + +template <class T> +inline void +sc_trace(sc_trace_file *, const sc_inout<T> &, const std::string &) +{ + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +} + +template <> +class sc_inout<bool> : public sc_port<sc_signal_inout_if<bool>, 1> +{ + public: + sc_inout() : sc_port<sc_signal_inout_if<bool>, 1>() {} + explicit sc_inout(const char *name) : + sc_port<sc_signal_inout_if<bool>, 1>(name) + {} + virtual ~sc_inout() {} + + void + initialize(const bool &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + initialize(const sc_signal_in_if<bool> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void end_of_elaboration() {} + + const bool & + read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(bool *)nullptr; + } + operator const bool& () const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(bool *)nullptr; + } + + void + write(const bool &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + sc_inout<bool> & + operator = (const bool &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<bool> *)nullptr; + } + sc_inout<bool> & + operator = (const sc_signal_in_if<bool> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<bool> *)nullptr; + } + sc_inout<bool> & + operator = (const sc_port<sc_signal_in_if<bool>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<bool> *)nullptr; + } + sc_inout<bool> & + operator = (const sc_port<sc_signal_inout_if<bool>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<bool> *)nullptr; + } + sc_inout<bool> & + operator = (const sc_inout<bool> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<bool> *)nullptr; + } + + const sc_event & + default_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + const sc_event & + value_changed_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + const sc_event & + posedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + const sc_event & + negedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + + bool + event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + bool + posedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + bool + negedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + + sc_event_finder & + value_changed() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + sc_event_finder & + pos() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + sc_event_finder & + neg() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + + virtual const char *kind() const { return "sc_inout"; } + + private: + // Disabled + sc_inout(const sc_inout<bool> &) : + sc_port<sc_signal_inout_if<bool>, 1>() {} +}; + +template <> +inline void sc_trace<bool>( + sc_trace_file *, const sc_inout<bool> &, const std::string &) +{ + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +} + +template <> +class sc_inout<sc_dt::sc_logic> : + public sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> +{ + public: + sc_inout() : sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1>() {} + explicit sc_inout(const char *name) : + sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1>(name) + {} + virtual ~sc_inout() {} + + void + initialize(const sc_dt::sc_logic &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + void + initialize(const sc_signal_in_if<sc_dt::sc_logic> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void end_of_elaboration() {} + + const sc_dt::sc_logic & + read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_dt::sc_logic *)nullptr; + } + operator const sc_dt::sc_logic& () const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_dt::sc_logic *)nullptr; + } + + void + write(const sc_dt::sc_logic &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + sc_inout<sc_dt::sc_logic> & + operator = (const sc_dt::sc_logic &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<sc_dt::sc_logic> *)nullptr; + } + sc_inout<sc_dt::sc_logic> & + operator = (const sc_signal_in_if<sc_dt::sc_logic> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<sc_dt::sc_logic> *)nullptr; + } + sc_inout<sc_dt::sc_logic> & + operator = (const sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<sc_dt::sc_logic> *)nullptr; + } + sc_inout<sc_dt::sc_logic> & + operator = (const sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<sc_dt::sc_logic> *)nullptr; + } + sc_inout<sc_dt::sc_logic> & + operator = (const sc_inout<sc_dt::sc_logic> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_inout<sc_dt::sc_logic> *)nullptr; + } + + const sc_event & + default_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + const sc_event & + value_changed_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + const sc_event & + posedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + const sc_event & + negedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + + bool + event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + bool + posedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + bool + negedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + + sc_event_finder & + value_changed() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + sc_event_finder & + pos() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + sc_event_finder & + neg() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event_finder *)nullptr; + } + + virtual const char *kind() const { return "sc_inout"; } + + private: + // Disabled + sc_inout(const sc_inout<sc_dt::sc_logic> &) : + sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1>() + {} +}; + +template <> +inline void +sc_trace<sc_dt::sc_logic>(sc_trace_file *, const sc_inout<sc_dt::sc_logic> &, + const std::string &) +{ + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); +} + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_INOUT_HH__ diff --git a/src/systemc/ext/channel/sc_inout_resolved.hh b/src/systemc/ext/channel/sc_inout_resolved.hh new file mode 100644 index 000000000..3fea32f75 --- /dev/null +++ b/src/systemc/ext/channel/sc_inout_resolved.hh @@ -0,0 +1,75 @@ +/* + * 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_CHANNEL_SC_INOUT_RESOLVED_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_INOUT_RESOLVED_HH__ + +#include "sc_inout.hh" +#include "sc_signal_in_if.hh" +#include "sc_signal_inout_if.hh" +#include "warn_unimpl.hh" + +namespace +{ + +class sc_logic; + +} + +namespace sc_core +{ + +class sc_inout_resolved : public sc_inout<sc_dt::sc_logic> +{ + public: + sc_inout_resolved(); + explicit sc_inout_resolved(const char *name); + virtual ~sc_inout_resolved(); + + virtual void end_of_elaboration(); + + sc_inout_resolved &operator = (const sc_dt::sc_logic &); + sc_inout_resolved &operator = (const sc_signal_in_if<sc_dt::sc_logic> &); + sc_inout_resolved &operator = ( + const sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &); + sc_inout_resolved &operator = ( + const sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &); + sc_inout_resolved &operator = (const sc_inout_resolved &); + + virtual const char *kind() const; + + private: + // Disabled + sc_inout_resolved(const sc_inout_resolved &) : + sc_inout<sc_dt::sc_logic>() {} +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_INOUT_RESOLVED_HH__ diff --git a/src/systemc/ext/channel/sc_inout_rv.hh b/src/systemc/ext/channel/sc_inout_rv.hh new file mode 100644 index 000000000..f231d9311 --- /dev/null +++ b/src/systemc/ext/channel/sc_inout_rv.hh @@ -0,0 +1,95 @@ +/* + * 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_CHANNEL_SC_INOUT_RV_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_INOUT_RV_HH__ + +#include "../core/sc_port.hh" +#include "sc_signal_in_if.hh" +#include "sc_signal_inout_if.hh" +#include "warn_unimpl.hh" + +namespace sc_dt +{ + +template <int W> +class sc_lv; + +} // namespace sc_dt + +namespace sc_core +{ + +template <int W> +class sc_inout_rv : public sc_inout<sc_dt::sc_lv<W>> +{ + public: + sc_inout_rv() : sc_inout<sc_dt::sc_lv<W>>() {} + explicit sc_inout_rv(const char *name) : sc_inout<sc_dt::sc_lv<W>>(name) {} + virtual ~sc_inout_rv() {} + + sc_inout_rv<W> & + operator = (const sc_dt::sc_lv<W> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_inout_rv<W> & + operator = (const sc_signal_in_if<sc_dt::sc_lv<W>> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_inout_rv<W> & + operator = (const sc_port<sc_signal_in_if<sc_dt::sc_lv<W>>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_inout_rv<W> & + operator = (const sc_port<sc_signal_inout_if<sc_dt::sc_lv<W>>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_inout_rv<W> & + operator = (const sc_inout_rv<W> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + + virtual void end_of_elaboration() {}; + + virtual const char *kind() const { return "sc_inout_rv"; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_INOUT_RV_HH__ diff --git a/src/systemc/ext/channel/sc_mutex.hh b/src/systemc/ext/channel/sc_mutex.hh new file mode 100644 index 000000000..af35bdd65 --- /dev/null +++ b/src/systemc/ext/channel/sc_mutex.hh @@ -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 + */ + +#ifndef __SYSTEMC_EXT_CHANNEL_SC_MUTEX_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_MUTEX_HH__ + +#include "../core/sc_object.hh" +#include "sc_mutex_if.hh" + +namespace sc_core +{ + +class sc_mutex : public sc_mutex_if, public sc_object +{ + public: + sc_mutex(); + explicit sc_mutex(const char *name); + + virtual int lock(); + virtual int trylock(); + virtual int unlock(); + + virtual const char *kind() const; + + private: + // Disabled + sc_mutex(const sc_mutex &) : sc_interface(), sc_mutex_if(), sc_object() {} + sc_mutex &operator = (const sc_mutex &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_MUTEX_HH__ diff --git a/src/systemc/ext/channel/sc_mutex_if.hh b/src/systemc/ext/channel/sc_mutex_if.hh new file mode 100644 index 000000000..97044edcf --- /dev/null +++ b/src/systemc/ext/channel/sc_mutex_if.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_CHANNEL_SC_MUTEX_IF_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_MUTEX_IF_HH__ + +#include "../core/sc_interface.hh" + +namespace sc_core +{ + +class sc_mutex_if : virtual public sc_interface +{ + public: + virtual int lock() = 0; + virtual int trylock() = 0; + virtual int unlock() = 0; + + protected: + sc_mutex_if() : sc_interface() {} + + private: + // Disabled + sc_mutex_if(const sc_mutex_if &) : sc_interface() {} + sc_mutex_if &operator = (const sc_mutex_if &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_MUTEX_IF_HH__ diff --git a/src/systemc/ext/channel/sc_out.hh b/src/systemc/ext/channel/sc_out.hh new file mode 100644 index 000000000..e55a821d4 --- /dev/null +++ b/src/systemc/ext/channel/sc_out.hh @@ -0,0 +1,88 @@ +/* + * 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_CHANNEL_SC_OUT_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_OUT_HH__ + +#include "../core/sc_port.hh" +#include "sc_inout.hh" +#include "warn_unimpl.hh" + +namespace sc_core +{ + +template <class T> +class sc_out : public sc_inout<T> +{ + public: + sc_out() : sc_inout<T>() {} + explicit sc_out(const char *name) : sc_inout<T>(name) {} + virtual ~sc_out() {} + + sc_out<T> & + operator = (const T &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_out<T> *)nullptr; + } + sc_out<T> & + operator = (const sc_signal_in_if<T> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_out<T> *)nullptr; + } + sc_out<T> & + operator = (const sc_port<sc_signal_in_if<T>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_out<T> *)nullptr; + } + sc_out<T> & + operator = (const sc_port<sc_signal_inout_if<T>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_out<T> *)nullptr; + } + sc_out<T> & + operator = (const sc_out<T> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_out<T> *)nullptr; + } + + virtual const char *kind() const { return "sc_out"; } + + private: + // Disabled + sc_out(const sc_out<T> &) : sc_inout<T>() {} +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_OUT_HH__ diff --git a/src/systemc/ext/channel/sc_out_resolved.hh b/src/systemc/ext/channel/sc_out_resolved.hh new file mode 100644 index 000000000..8f4aa52e4 --- /dev/null +++ b/src/systemc/ext/channel/sc_out_resolved.hh @@ -0,0 +1,72 @@ +/* + * 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_CHANNEL_SC_OUT_RESOLVED_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_OUT_RESOLVED_HH__ + +#include "sc_out.hh" +#include "sc_signal_in_if.hh" +#include "sc_signal_inout_if.hh" +#include "warn_unimpl.hh" + +namespace +{ + +class sc_logic; + +} + +namespace sc_core +{ + +class sc_out_resolved : public sc_out<sc_dt::sc_logic> +{ + public: + sc_out_resolved(); + explicit sc_out_resolved(const char *name); + virtual ~sc_out_resolved(); + + sc_out_resolved &operator = (const sc_dt::sc_logic &); + sc_out_resolved &operator = (const sc_signal_in_if<sc_dt::sc_logic> &); + sc_out_resolved &operator = ( + const sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &); + sc_out_resolved &operator = ( + const sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &); + sc_out_resolved &operator = (const sc_out_resolved &); + + virtual const char *kind() const; + + private: + // Disabled + sc_out_resolved(const sc_out_resolved &) : sc_out<sc_dt::sc_logic>() {} +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_OUT_RESOLVED_HH__ diff --git a/src/systemc/ext/channel/sc_out_rv.hh b/src/systemc/ext/channel/sc_out_rv.hh new file mode 100644 index 000000000..af5b05526 --- /dev/null +++ b/src/systemc/ext/channel/sc_out_rv.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_CHANNEL_SC_OUT_RV_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_OUT_RV_HH__ + +#include "../core/sc_port.hh" +#include "sc_inout_rv.hh" +#include "sc_signal_in_if.hh" +#include "sc_signal_inout_if.hh" +#include "warn_unimpl.hh" + +namespace sc_dt +{ + +template <int W> +class sc_lv; + +} // namespace sc_dt + +namespace sc_core +{ + +template <int W> +class sc_out_rv : public sc_inout_rv<W> +{ + public: + sc_out_rv() : sc_inout_rv<W>() {} + explicit sc_out_rv(const char *name) : sc_inout_rv<W>(name) {} + virtual ~sc_out_rv() {}; + + sc_out_rv<W> & + operator = (const sc_dt::sc_lv<W> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_out_rv<W> & + operator = (const sc_signal_in_if<sc_dt::sc_lv<W>> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_out_rv<W> & + operator = (const sc_port<sc_signal_in_if<sc_dt::sc_lv<W>>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_out_rv<W> & + operator = (const sc_port<sc_signal_inout_if<sc_dt::sc_lv<W>>, 1> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_out_rv<W> & + operator = (const sc_out_rv<W> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + + virtual const char *kind() const { return "sc_out_rv"; } + + private: + // Disabled + sc_out_rv(const sc_out_rv<W> &) : sc_inout_rv<W>() {} +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_OUT_RV_HH__ diff --git a/src/systemc/ext/channel/sc_semaphore.hh b/src/systemc/ext/channel/sc_semaphore.hh new file mode 100644 index 000000000..fb1e82547 --- /dev/null +++ b/src/systemc/ext/channel/sc_semaphore.hh @@ -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 + */ + +#ifndef __SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_HH__ + +#include "../core/sc_object.hh" +#include "sc_semaphore_if.hh" + +namespace sc_core +{ + +class sc_semaphore : public sc_semaphore_if, public sc_object +{ + public: + explicit sc_semaphore(int); + sc_semaphore(const char *name, int); + + virtual int wait(); + virtual int trywait(); + virtual int post(); + virtual int get_value() const; + + virtual const char *kind() const; + + private: + // Disabled + sc_semaphore(const sc_semaphore &) : + sc_interface(), sc_semaphore_if(), sc_object() + {} + + sc_semaphore &operator = (const sc_semaphore &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_HH__ diff --git a/src/systemc/ext/channel/sc_semaphore_if.hh b/src/systemc/ext/channel/sc_semaphore_if.hh new file mode 100644 index 000000000..2beb9b76b --- /dev/null +++ b/src/systemc/ext/channel/sc_semaphore_if.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_CHANNEL_SC_SEMAPHORE_IF_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_IF_HH__ + +#include "../core/sc_interface.hh" + +namespace sc_core +{ + +class sc_semaphore_if : virtual public sc_interface +{ + public: + virtual int wait() = 0; + virtual int trywait() = 0; + virtual int post() = 0; + virtual int get_value() const = 0; + + protected: + sc_semaphore_if() : sc_interface() {} + + private: + // Disabled + sc_semaphore_if(const sc_semaphore_if &) : sc_interface() {} + sc_semaphore_if &operator = (const sc_semaphore_if &) { return *this; } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_SEMAPHORE_IF_HH__ diff --git a/src/systemc/ext/channel/sc_signal.hh b/src/systemc/ext/channel/sc_signal.hh new file mode 100644 index 000000000..e1ed619bf --- /dev/null +++ b/src/systemc/ext/channel/sc_signal.hh @@ -0,0 +1,414 @@ +/* + * 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_CHANNEL_SC_SIGNAL_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_SIGNAL_HH__ + +#include <iostream> + +#include "../core/sc_module.hh" // for sc_gen_unique_name +#include "../core/sc_prim.hh" +#include "sc_signal_inout_if.hh" +#include "warn_unimpl.hh" // for warn_unimpl + +namespace sc_core +{ + +class sc_port_base; + +template <class T, sc_writer_policy WRITER_POLICY=SC_ONE_WRITER> +class sc_signal : public sc_signal_inout_if<T>, + public sc_prim_channel +{ + public: + sc_signal() : sc_signal_inout_if<T>(), + sc_prim_channel(sc_gen_unique_name("signal")) + {} + explicit sc_signal(const char *name) : sc_signal_inout_if<T>(), + sc_prim_channel(name) + {} + virtual ~sc_signal() {} + + virtual void + register_port(sc_port_base &, const char *) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual const T& + read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const T *)nullptr; + } + operator const T&() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const T *)nullptr; + } + + virtual sc_writer_policy + get_writer_policy() const + { + return WRITER_POLICY; + } + virtual void + write(const T&) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + sc_signal<T, WRITER_POLICY> & + operator = (const T&) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_signal<T, WRITER_POLICY> & + operator = (const sc_signal<T, WRITER_POLICY> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + + virtual const sc_event & + default_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + virtual const sc_event & + value_changed_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + virtual bool + event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + + virtual void + print(std::ostream & =std::cout) const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual void + dump(std::ostream & =std::cout) const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual const char *kind() const { return "sc_signal"; } + + protected: + virtual void + update() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + private: + // Disabled + sc_signal(const sc_signal<T, WRITER_POLICY> &) : + sc_signal_inout_if<T>(), sc_prim_channel("") + {} +}; + +template <class T, sc_writer_policy WRITER_POLICY> +inline std::ostream & +operator << (std::ostream &os, const sc_signal<T, WRITER_POLICY> &) +{ + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return os; +} + +template <sc_writer_policy WRITER_POLICY> +class sc_signal<bool, WRITER_POLICY> : + public sc_signal_inout_if<bool>, public sc_prim_channel +{ + public: + sc_signal() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + explicit sc_signal(const char *) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual ~sc_signal() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + register_port(sc_port_base &, const char *) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual const bool & + read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const bool *)nullptr; + } + operator const bool &() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const bool *)nullptr; + } + + virtual sc_writer_policy + get_writer_policy() const + { + return WRITER_POLICY; + } + virtual void + write(const bool &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + sc_signal<bool, WRITER_POLICY> & + operator = (const bool &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_signal<bool, WRITER_POLICY> & + operator = (const sc_signal<bool, WRITER_POLICY> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + + virtual const sc_event & + default_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + + virtual const sc_event & + value_changed_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + virtual const sc_event & + posedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + virtual const sc_event & + negedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + + virtual bool + event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + virtual bool + posedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + virtual bool + negedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + + virtual void + print(std::ostream & =std::cout) const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual void + dump(std::ostream & =std::cout) const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual const char *kind() const { return "sc_signal"; } + + protected: + virtual void + update() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + private: + // Disabled + sc_signal(const sc_signal<bool, WRITER_POLICY> &) : + sc_signal_inout_if<bool>(), sc_prim_channel("") + {} +}; + +template <sc_writer_policy WRITER_POLICY> +class sc_signal<sc_dt::sc_logic, WRITER_POLICY> : + public sc_signal_inout_if<sc_dt::sc_logic>, public sc_prim_channel +{ + public: + sc_signal() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + explicit sc_signal(const char *) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual ~sc_signal() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + register_port(sc_port_base &, const char *) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual const sc_dt::sc_logic & + read() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_dt::sc_logic *)nullptr; + } + operator const sc_dt::sc_logic &() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(const sc_dt::sc_logic *)nullptr; + } + + virtual sc_writer_policy + get_writer_policy() const + { + return WRITER_POLICY; + } + virtual void + write(const sc_dt::sc_logic &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + sc_signal<sc_dt::sc_logic, WRITER_POLICY> & + operator = (const sc_dt::sc_logic &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_signal<sc_dt::sc_logic, WRITER_POLICY> & + operator = (const sc_signal<sc_dt::sc_logic, WRITER_POLICY> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + + virtual const sc_event & + default_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + + virtual const sc_event & + value_changed_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + virtual const sc_event & + posedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + virtual const sc_event & + negedge_event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *(sc_event *)nullptr; + } + + virtual bool + event() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + virtual bool + posedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + virtual bool + negedge() const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return false; + } + + virtual void + print(std::ostream & =std::cout) const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual void + dump(std::ostream & =std::cout) const + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + virtual const char *kind() const { return "sc_signal"; } + + protected: + virtual void + update() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + private: + // Disabled + sc_signal(const sc_signal<sc_dt::sc_logic, WRITER_POLICY> &) : + sc_signal_inout_if<sc_dt::sc_logic>(), sc_prim_channel("") + {} +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_SIGNAL_HH__ diff --git a/src/systemc/ext/channel/sc_signal_in_if.hh b/src/systemc/ext/channel/sc_signal_in_if.hh new file mode 100644 index 000000000..6fac35860 --- /dev/null +++ b/src/systemc/ext/channel/sc_signal_in_if.hh @@ -0,0 +1,126 @@ +/* + * 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_CHANNEL_SC_SIGNAL_IN_IF_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_SIGNAL_IN_IF_HH__ + +#include "../core/sc_interface.hh" + +namespace sc_dt +{ + +class sc_logic; + +}; + +namespace sc_core +{ + +class sc_event; + +template <class T> +class sc_signal_in_if : virtual public sc_interface +{ + public: + virtual const T &read() const = 0; + virtual const sc_event &value_changed_event() const = 0; + virtual bool event() const = 0; + + protected: + sc_signal_in_if() : sc_interface() {} + + private: + // Disabled + sc_signal_in_if(const sc_signal_in_if<T> &) : sc_interface() {} + sc_signal_in_if<T> & + operator = (const sc_signal_in_if<T> &) + { + return *this; + } +}; + +template <> +class sc_signal_in_if<bool> : virtual public sc_interface +{ + public: + virtual const bool &read() const = 0; + + virtual const sc_event &value_changed_event() const = 0; + virtual const sc_event &posedge_event() const = 0; + virtual const sc_event &negedge_event() const = 0; + + virtual bool event() const = 0; + virtual bool posedge() const = 0; + virtual bool negedge() const = 0; + + protected: + sc_signal_in_if() : sc_interface() {} + + private: + // Disabled + sc_signal_in_if(const sc_signal_in_if<bool> &) : sc_interface() {} + sc_signal_in_if<bool> & + operator = (const sc_signal_in_if<bool> &) + { + return *this; + } +}; + +template <> +class sc_signal_in_if<sc_dt::sc_logic> : virtual public sc_interface +{ + public: + virtual const sc_dt::sc_logic &read() const = 0; + + virtual const sc_event &value_changed_event() const = 0; + virtual const sc_event &posedge_event() const = 0; + virtual const sc_event &negedge_event() const = 0; + + virtual bool event() const = 0; + virtual bool posedge() const = 0; + virtual bool negedge() const = 0; + + protected: + sc_signal_in_if() : sc_interface() {} + + private: + // Disabled + sc_signal_in_if(const sc_signal_in_if<sc_dt::sc_logic> &) : + sc_interface() + {} + sc_signal_in_if<sc_dt::sc_logic> & + operator = (const sc_signal_in_if<sc_dt::sc_logic> &) + { + return *this; + } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_SIGNAL_IN_IF_HH__ diff --git a/src/systemc/ext/channel/sc_signal_inout_if.hh b/src/systemc/ext/channel/sc_signal_inout_if.hh new file mode 100644 index 000000000..c39c4a501 --- /dev/null +++ b/src/systemc/ext/channel/sc_signal_inout_if.hh @@ -0,0 +1,90 @@ +/* + * 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_CHANNEL_SC_SIGNAL_INOUT_IF_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_SIGNAL_INOUT_IF_HH__ + +#include "../core/sc_interface.hh" +#include "sc_signal_in_if.hh" + +namespace sc_core +{ + +enum sc_writer_policy +{ + SC_ONE_WRITER, + SC_MANY_WRITERS +}; + +template <class T> +class sc_signal_write_if : virtual public sc_interface +{ + public: + virtual sc_writer_policy + get_writer_policy() const + { + return SC_ONE_WRITER; + } + virtual void write(const T &) = 0; + + protected: + sc_signal_write_if() : sc_interface() {} + + private: + // Disabled + sc_signal_write_if(const sc_signal_write_if<T> &) : sc_interface() {} + sc_signal_write_if<T> & + operator = (const sc_signal_write_if<T> &) + { + return *this; + } +}; + +template <class T> +class sc_signal_inout_if : public sc_signal_in_if<T>, + public sc_signal_write_if<T> +{ + protected: + sc_signal_inout_if() : sc_signal_in_if<T>(), sc_signal_write_if<T>() {} + + private: + // Disabled + sc_signal_inout_if(const sc_signal_inout_if<T> &) : + sc_signal_in_if<T>(), sc_signal_write_if<T>() + {} + sc_signal_inout_if<T> & + operator = (const sc_signal_inout_if<T> &) + { + return *this; + } +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_SIGNAL_INOUT_IF_HH__ diff --git a/src/systemc/ext/channel/sc_signal_resolved.hh b/src/systemc/ext/channel/sc_signal_resolved.hh new file mode 100644 index 000000000..f04fa363f --- /dev/null +++ b/src/systemc/ext/channel/sc_signal_resolved.hh @@ -0,0 +1,75 @@ +/* + * 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_CHANNEL_SC_SIGNAL_RESOLVED_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_SIGNAL_RESOLVED_HH__ + +#include "sc_signal.hh" +#include "sc_signal_inout_if.hh" + +namespace sc_dt +{ + +class sc_logic; + +}; + +namespace sc_core +{ + +class sc_port_base; + +class sc_signal_resolved : public sc_signal<sc_dt::sc_logic, SC_MANY_WRITERS> +{ + public: + sc_signal_resolved(); + explicit sc_signal_resolved(const char *name); + virtual ~sc_signal_resolved(); + + virtual void register_port(sc_port_base &, const char *); + + virtual void write(const sc_dt::sc_logic &); + sc_signal_resolved &operator = (const sc_dt::sc_logic &); + sc_signal_resolved &operator = (const sc_signal_resolved &); + + virtual const char *kind() const; + + protected: + virtual void update(); + + private: + // Disabled + sc_signal_resolved(const sc_signal_resolved &) : + sc_interface(), sc_signal<sc_dt::sc_logic, SC_MANY_WRITERS>() + {} +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_SIGNAL_RESOLVED_HH__ diff --git a/src/systemc/ext/channel/sc_signal_rv.hh b/src/systemc/ext/channel/sc_signal_rv.hh new file mode 100644 index 000000000..723c2b45d --- /dev/null +++ b/src/systemc/ext/channel/sc_signal_rv.hh @@ -0,0 +1,104 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_CHANNEL_SC_SIGNAL_RV_HH__ +#define __SYSTEMC_EXT_CHANNEL_SC_SIGNAL_RV_HH__ + +#include "../core/sc_module.hh" // for sc_gen_unique_name +#include "sc_signal.hh" +#include "warn_unimpl.hh" + +namespace sc_dt +{ + +template <int W> +class sc_lv; + +}; + +namespace sc_core +{ + +class sc_port_base; + +template <int W> +class sc_signal_rv : public sc_signal<sc_dt::sc_lv<W>, SC_MANY_WRITERS> +{ + public: + sc_signal_rv() : sc_signal<sc_dt::sc_lv<W>, SC_MANY_WRITERS>( + sc_gen_unique_name("signal_rv")) + {} + sc_signal_rv(const char *name) : + sc_signal<sc_dt::sc_lv<W>, SC_MANY_WRITERS>(name) + {} + virtual ~sc_signal_rv() {} + + virtual void + register_port(sc_port_base &, const char *) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + virtual void + write(const sc_dt::sc_lv<W> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + sc_signal_rv<W> & + operator = (const sc_dt::sc_lv<W> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + sc_signal_rv<W> & + operator = (const sc_signal_rv<W> &) + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + return *this; + } + + virtual const char *kind() const { return "sc_signal_rv"; } + + protected: + virtual void + update() + { + sc_channel_warn_unimpl(__PRETTY_FUNCTION__); + } + + private: + // Disabled + sc_signal_rv(const sc_signal_rv<W> &) : + sc_signal<sc_dt::sc_lv<W>, SC_MANY_WRITERS>() + {} +}; + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_SC_SIGNAL_RV_HH__ diff --git a/src/systemc/ext/channel/warn_unimpl.hh b/src/systemc/ext/channel/warn_unimpl.hh new file mode 100644 index 000000000..8262ae29e --- /dev/null +++ b/src/systemc/ext/channel/warn_unimpl.hh @@ -0,0 +1,40 @@ +/* + * Copyright 2018 Google, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer; + * redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution; + * neither the name of the copyright holders nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Authors: Gabe Black + */ + +#ifndef __SYSTEMC_EXT_CHANNEL_WARN_UNIMPL_HH__ +#define __SYSTEMC_EXT_CHANNEL_WARN_UNIMPL_HH__ + +namespace sc_core +{ + +void sc_channel_warn_unimpl(const char *func); + +} // namespace sc_core + +#endif //__SYSTEMC_EXT_CHANNEL_WARN_UNIMPL_HH__ diff --git a/src/systemc/ext/systemc b/src/systemc/ext/systemc index f16a92e72..633b84eb9 100644 --- a/src/systemc/ext/systemc +++ b/src/systemc/ext/systemc @@ -30,6 +30,7 @@ #ifndef __SYSTEMC_EXT_SYSTEMC__ #define __SYSTEMC_EXT_SYSTEMC__ +#include "channel/_channel.hh" #include "core/_core.hh" #include "dt/_dt.hh" diff --git a/src/systemc/ext/systemc.h b/src/systemc/ext/systemc.h index 77230d0ab..4b4927225 100644 --- a/src/systemc/ext/systemc.h +++ b/src/systemc/ext/systemc.h @@ -33,6 +33,7 @@ #include "systemc" // Collect "using" declarations for the various namespaces. +#include "channel/_using.hh" #include "core/_using.hh" #include "dt/_using.hh" |