sc_signal_in_if.hh revision 12841:22aa7ba47bf9
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#ifndef __SYSTEMC_EXT_CHANNEL_SC_SIGNAL_IN_IF_HH__
31#define __SYSTEMC_EXT_CHANNEL_SC_SIGNAL_IN_IF_HH__
32
33#include "../core/sc_interface.hh"
34
35namespace sc_dt
36{
37
38class sc_logic;
39
40};
41
42namespace sc_core
43{
44
45class sc_event;
46
47template <class T>
48class sc_signal_in_if : virtual public sc_interface
49{
50  public:
51    virtual const T &read() const = 0;
52    virtual const sc_event &value_changed_event() const = 0;
53    virtual bool event() const = 0;
54
55  protected:
56    sc_signal_in_if() : sc_interface() {}
57
58  private:
59    // Disabled
60    sc_signal_in_if(const sc_signal_in_if<T> &) : sc_interface() {}
61    sc_signal_in_if<T> &
62    operator = (const sc_signal_in_if<T> &)
63    {
64        return *this;
65    }
66};
67
68template <>
69class sc_signal_in_if<bool> : virtual public sc_interface
70{
71  public:
72    virtual const bool &read() const = 0;
73
74    virtual const sc_event &value_changed_event() const = 0;
75    virtual const sc_event &posedge_event() const = 0;
76    virtual const sc_event &negedge_event() const = 0;
77
78    virtual bool event() const = 0;
79    virtual bool posedge() const = 0;
80    virtual bool negedge() const = 0;
81
82  protected:
83    sc_signal_in_if() : sc_interface() {}
84
85  private:
86    // Disabled
87    sc_signal_in_if(const sc_signal_in_if<bool> &) : sc_interface() {}
88    sc_signal_in_if<bool> &
89    operator = (const sc_signal_in_if<bool> &)
90    {
91        return *this;
92    }
93};
94
95template <>
96class sc_signal_in_if<sc_dt::sc_logic> : virtual public sc_interface
97{
98  public:
99    virtual const sc_dt::sc_logic &read() const = 0;
100
101    virtual const sc_event &value_changed_event() const = 0;
102    virtual const sc_event &posedge_event() const = 0;
103    virtual const sc_event &negedge_event() const = 0;
104
105    virtual bool event() const = 0;
106    virtual bool posedge() const = 0;
107    virtual bool negedge() const = 0;
108
109  protected:
110    sc_signal_in_if() : sc_interface() {}
111
112  private:
113    // Disabled
114    sc_signal_in_if(const sc_signal_in_if<sc_dt::sc_logic> &) :
115            sc_interface()
116    {}
117    sc_signal_in_if<sc_dt::sc_logic> &
118    operator = (const sc_signal_in_if<sc_dt::sc_logic> &)
119    {
120        return *this;
121    }
122};
123
124} // namespace sc_core
125
126#endif  //__SYSTEMC_EXT_CHANNEL_SC_SIGNAL_IN_IF_HH__
127