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_IN_HH__ 31#define __SYSTEMC_EXT_CHANNEL_SC_IN_HH__ 32 33#include <string> 34
| 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_IN_HH__ 31#define __SYSTEMC_EXT_CHANNEL_SC_IN_HH__ 32 33#include <string> 34
|
| 35#include "../core/sc_event.hh"
|
35#include "../core/sc_port.hh" 36#include "sc_signal_in_if.hh" 37#include "sc_signal_inout_if.hh" 38#include "warn_unimpl.hh" 39 40namespace sc_core 41{ 42 43class sc_event;
| 36#include "../core/sc_port.hh" 37#include "sc_signal_in_if.hh" 38#include "sc_signal_inout_if.hh" 39#include "warn_unimpl.hh" 40 41namespace sc_core 42{ 43 44class sc_event;
|
44class sc_event_finder;
| |
45class sc_trace_file; 46 47template <class T> 48class sc_in : public sc_port<sc_signal_in_if<T>, 1> 49{ 50 public:
| 45class sc_trace_file; 46 47template <class T> 48class sc_in : public sc_port<sc_signal_in_if<T>, 1> 49{ 50 public:
|
51 sc_in() : sc_port<sc_signal_in_if<T>, 1>() {} 52 explicit sc_in(const char *name) : sc_port<sc_signal_in_if<T>, 1>(name) {}
| 51 sc_in() : sc_port<sc_signal_in_if<T>, 1>(), 52 _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 53 {} 54 explicit sc_in(const char *name) : sc_port<sc_signal_in_if<T>, 1>(name), 55 _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 56 {}
|
53 virtual ~sc_in() {} 54 55 // Deprecated binding constructors. 56 explicit sc_in(const sc_signal_in_if<T> &interface) :
| 57 virtual ~sc_in() {} 58 59 // Deprecated binding constructors. 60 explicit sc_in(const sc_signal_in_if<T> &interface) :
|
57 sc_port, 1>(interface)
| 61 sc_port<sc_signal_in_if<T>, 1>(interface), 62 _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event)
|
58 {} 59 sc_in(const char *name, const sc_signal_in_if<T> &interface) :
| 63 {} 64 sc_in(const char *name, const sc_signal_in_if<T> &interface) :
|
60 sc_port, 1>(name, interface)
| 65 sc_port<sc_signal_in_if<T>, 1>(name, interface), 66 _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event)
|
61 {} 62 explicit sc_in(sc_port_b<sc_signal_in_if<T> > &parent) :
| 67 {} 68 explicit sc_in(sc_port_b<sc_signal_in_if<T> > &parent) :
|
63 sc_port, 1>(parent)
| 69 sc_port<sc_signal_in_if<T>, 1>(parent), 70 _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event)
|
64 {} 65 sc_in(const char *name, sc_port_b<sc_signal_in_if<T> > &parent) :
| 71 {} 72 sc_in(const char *name, sc_port_b<sc_signal_in_if<T> > &parent) :
|
66 sc_port, 1>(name, parent)
| 73 sc_port<sc_signal_in_if<T>, 1>(name, parent), 74 _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event)
|
67 {} 68 explicit sc_in(sc_port<sc_signal_in_if<T>, 1> &parent) :
| 75 {} 76 explicit sc_in(sc_port<sc_signal_in_if<T>, 1> &parent) :
|
69 sc_port, 1>(parent)
| 77 sc_port<sc_signal_in_if<T>, 1>(parent), 78 _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event)
|
70 {} 71 sc_in(const char *name, sc_port<sc_signal_in_if<T>, 1> &parent) :
| 79 {} 80 sc_in(const char *name, sc_port<sc_signal_in_if<T>, 1> &parent) :
|
72 sc_port, 1>(name, parent)
| 81 sc_port<sc_signal_in_if<T>, 1>(name, parent), 82 _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event)
|
73 {} 74 75 virtual void
| 83 {} 84 85 virtual void
|
76 bind(const sc_signal_in_if &)
| 86 bind(const sc_signal_in_if<T> &i)
|
77 {
| 87 {
|
78 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 88 sc_port<sc_signal_in_if<T>, 1>::bind( 89 const_cast<sc_signal_in_if<T> &>(i));
|
79 }
| 90 }
|
80 void 81 operator () (const sc_signal_in_if<T> &) 82 { 83 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 84 }
| 91 void operator () (const sc_signal_in_if<T> &i) { bind(i); }
|
85 86 virtual void
| 92 93 virtual void
|
87 bind(sc_port, 1> &)
| 94 bind(sc_port<sc_signal_in_if<T>, 1> &i)
|
88 {
| 95 {
|
89 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 96 sc_port<sc_signal_in_if<T>, 1>::bind(i);
|
90 } 91 void
| 97 } 98 void
|
92 operator () (sc_port, 1> &)
| 99 operator () (sc_port<sc_signal_in_if<T>, 1> &p)
|
93 {
| 100 {
|
94 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 101 bind(p);
|
95 } 96 97 virtual void
| 102 } 103 104 virtual void
|
98 bind(sc_port, 1> &)
| 105 bind(sc_port<sc_signal_inout_if<T>, 1> &p)
|
99 {
| 106 {
|
100 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 107 sc_port_base::bind(p);
|
101 } 102 void
| 108 } 109 void
|
103 operator () (sc_port, 1> &)
| 110 operator () (sc_port<sc_signal_inout_if<T>, 1> &p)
|
104 {
| 111 {
|
105 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 112 bind(p);
|
106 } 107
| 113 } 114
|
108 virtual void 109 end_of_elaboration() 110 { 111 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 112 }
| 115 virtual void end_of_elaboration() { /* Implementation defined. */ }
|
113
| 116
|
114 const T & 115 read() const 116 { 117 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 118 return *(const T *)nullptr; 119 } 120 operator const T& () const 121 { 122 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 123 return *(const T *)nullptr; 124 }
| 117 const T &read() const { return (*this)->read(); } 118 operator const T& () const { return (*this)->read(); }
|
125
| 119
|
| 120 const sc_event &default_event() const { return (*this)->default_event(); }
|
126 const sc_event &
| 121 const sc_event &
|
127 default_event() const 128 { 129 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 130 return *(const sc_event *)nullptr; 131 } 132 const sc_event &
| |
133 value_changed_event() const 134 {
| 122 value_changed_event() const 123 {
|
135 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 136 return *(const sc_event *)nullptr;
| 124 return (*this)->value_changed_event();
|
137 }
| 125 }
|
138 bool 139 event() const 140 { 141 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 142 return false; 143 } 144 sc_event_finder & 145 value_changed() const 146 { 147 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 148 return *(sc_event_finder *)nullptr; 149 }
| 126 bool event() const { return (*this)->event(); } 127 sc_event_finder &value_changed() const { return _valueChangedFinder; }
|
150 151 virtual const char *kind() const { return "sc_in"; } 152 153 private:
| 128 129 virtual const char *kind() const { return "sc_in"; } 130 131 private:
|
| 132 mutable sc_event_finder_t<sc_signal_in_if<T> > _valueChangedFinder; 133
|
154 // Disabled
| 134 // Disabled
|
155 sc_in(const sc_in<T> &) : sc_port<sc_signal_in_if<T>, 1>() {} 156 sc_in<T> &operator = (const sc_in<T> &) { return *this; }
| 135 sc_in(const sc_in<T> &); 136 sc_in<T> &operator = (const sc_in<T> &);
|
157}; 158 159template <class T> 160inline void 161sc_trace(sc_trace_file *, const sc_in<T> &, const std::string &) 162{ 163 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 164} 165 166template <> 167class sc_in<bool> : public sc_port<sc_signal_in_if<bool>, 1> 168{ 169 public:
| 137}; 138 139template <class T> 140inline void 141sc_trace(sc_trace_file *, const sc_in<T> &, const std::string &) 142{ 143 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 144} 145 146template <> 147class sc_in<bool> : public sc_port<sc_signal_in_if<bool>, 1> 148{ 149 public:
|
170 sc_in() : sc_port<sc_signal_in_if<bool>, 1>() {}
| 150 sc_in() : sc_port<sc_signal_in_if<bool>, 1>(), 151 _valueChangedFinder(*this, 152 &sc_signal_in_if<bool>::value_changed_event), 153 _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 154 _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 155 {}
|
171 explicit sc_in(const char *name) :
| 156 explicit sc_in(const char *name) :
|
172 sc_port<sc_signal_in_if<bool>, 1>(name) {}
| 157 sc_port<sc_signal_in_if<bool>, 1>(name), 158 _valueChangedFinder(*this, 159 &sc_signal_in_if<bool>::value_changed_event), 160 _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 161 _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 162 {}
|
173 virtual ~sc_in() {} 174 175 // Deprecated binding constructors. 176 explicit sc_in(const sc_signal_in_if<bool> &interface) :
| 163 virtual ~sc_in() {} 164 165 // Deprecated binding constructors. 166 explicit sc_in(const sc_signal_in_if<bool> &interface) :
|
177 sc_port, 1>(interface)
| 167 sc_port<sc_signal_in_if<bool>, 1>(interface), 168 _valueChangedFinder(*this, 169 &sc_signal_in_if<bool>::value_changed_event), 170 _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 171 _negFinder(*this, &sc_signal_in_if<bool>::negedge_event)
|
178 {} 179 sc_in(const char *name, const sc_signal_in_if<bool> &interface) :
| 172 {} 173 sc_in(const char *name, const sc_signal_in_if<bool> &interface) :
|
180 sc_port, 1>(name, interface)
| 174 sc_port<sc_signal_in_if<bool>, 1>(name, interface), 175 _valueChangedFinder(*this, 176 &sc_signal_in_if<bool>::value_changed_event), 177 _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 178 _negFinder(*this, &sc_signal_in_if<bool>::negedge_event)
|
181 {} 182 explicit sc_in(sc_port_b<sc_signal_in_if<bool> > &parent) :
| 179 {} 180 explicit sc_in(sc_port_b<sc_signal_in_if<bool> > &parent) :
|
183 sc_port, 1>(parent)
| 181 sc_port<sc_signal_in_if<bool>, 1>(parent), 182 _valueChangedFinder(*this, 183 &sc_signal_in_if<bool>::value_changed_event), 184 _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 185 _negFinder(*this, &sc_signal_in_if<bool>::negedge_event)
|
184 {} 185 sc_in(const char *name, sc_port_b<sc_signal_in_if<bool> > &parent) :
| 186 {} 187 sc_in(const char *name, sc_port_b<sc_signal_in_if<bool> > &parent) :
|
186 sc_port, 1>(name, parent)
| 188 sc_port<sc_signal_in_if<bool>, 1>(name, parent), 189 _valueChangedFinder(*this, 190 &sc_signal_in_if<bool>::value_changed_event), 191 _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 192 _negFinder(*this, &sc_signal_in_if<bool>::negedge_event)
|
187 {} 188 explicit sc_in(sc_port<sc_signal_in_if<bool>, 1> &parent) :
| 193 {} 194 explicit sc_in(sc_port<sc_signal_in_if<bool>, 1> &parent) :
|
189 sc_port, 1>(parent)
| 195 sc_port<sc_signal_in_if<bool>, 1>(parent), 196 _valueChangedFinder(*this, 197 &sc_signal_in_if<bool>::value_changed_event), 198 _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 199 _negFinder(*this, &sc_signal_in_if<bool>::negedge_event)
|
190 {} 191 sc_in(const char *name, sc_port<sc_signal_in_if<bool>, 1> &parent) :
| 200 {} 201 sc_in(const char *name, sc_port<sc_signal_in_if<bool>, 1> &parent) :
|
192 sc_port, 1>(name, parent)
| 202 sc_port<sc_signal_in_if<bool>, 1>(name, parent), 203 _valueChangedFinder(*this, 204 &sc_signal_in_if<bool>::value_changed_event), 205 _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 206 _negFinder(*this, &sc_signal_in_if<bool>::negedge_event)
|
193 {} 194 195 virtual void
| 207 {} 208 209 virtual void
|
196 bind(const sc_signal_in_if &)
| 210 bind(const sc_signal_in_if<bool> &i)
|
197 {
| 211 {
|
198 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 212 sc_port<sc_signal_in_if<bool>, 1>::bind( 213 const_cast<sc_signal_in_if<bool> &>(i));
|
199 }
| 214 }
|
200 void 201 operator () (const sc_signal_in_if<bool> &) 202 { 203 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 204 }
| 215 void operator () (const sc_signal_in_if<bool> &i) { bind(i); }
|
205 206 virtual void
| 216 217 virtual void
|
207 bind(sc_port, 1> &)
| 218 bind(sc_port<sc_signal_in_if<bool>, 1> &p)
|
208 {
| 219 {
|
209 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 220 sc_port<sc_signal_in_if<bool>, 1>::bind(p);
|
210 } 211 void
| 221 } 222 void
|
212 operator () (sc_port, 1> &)
| 223 operator () (sc_port<sc_signal_in_if<bool>, 1> &p)
|
213 {
| 224 {
|
214 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 225 bind(p);
|
215 } 216 217 virtual void
| 226 } 227 228 virtual void
|
218 bind(sc_port, 1> &)
| 229 bind(sc_port<sc_signal_inout_if<bool>, 1> &p)
|
219 {
| 230 {
|
220 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 231 sc_port_base::bind(p);
|
221 } 222 void
| 232 } 233 void
|
223 operator () (sc_port, 1> &)
| 234 operator () (sc_port<sc_signal_inout_if<bool>, 1> &p)
|
224 {
| 235 {
|
225 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 236 bind(p);
|
226 } 227
| 237 } 238
|
228 virtual void 229 end_of_elaboration() 230 { 231 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 232 }
| 239 virtual void end_of_elaboration() { /* Implementation defined. */ }
|
233
| 240
|
234 const bool & 235 read() const 236 { 237 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 238 return *(const bool *)nullptr; 239 } 240 operator const bool& () const 241 { 242 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 243 return *(const bool *)nullptr; 244 }
| 241 const bool &read() const { return (*this)->read(); } 242 operator const bool& () const { return (*this)->read(); }
|
245
| 243
|
| 244 const sc_event &default_event() const { return (*this)->default_event(); }
|
246 const sc_event &
| 245 const sc_event &
|
247 default_event() const 248 { 249 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 250 return *(const sc_event *)nullptr; 251 } 252 const sc_event &
| |
253 value_changed_event() const 254 {
| 246 value_changed_event() const 247 {
|
255 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 256 return *(const sc_event *)nullptr;
| 248 return (*this)->value_changed_event();
|
257 } 258 const sc_event & 259 posedge_event() const 260 {
| 249 } 250 const sc_event & 251 posedge_event() const 252 {
|
261 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 262 return *(const sc_event *)nullptr;
| 253 return (*this)->posedge_event();
|
263 } 264 const sc_event & 265 negedge_event() const 266 {
| 254 } 255 const sc_event & 256 negedge_event() const 257 {
|
267 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 268 return *(const sc_event *)nullptr;
| 258 return (*this)->negedge_event();
|
269 } 270
| 259 } 260
|
271 bool 272 event() const 273 { 274 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 275 return false; 276 } 277 bool 278 posedge() const 279 { 280 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 281 return false; 282 } 283 bool 284 negedge() const 285 { 286 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 287 return false; 288 }
| 261 bool event() const { return (*this)->event(); } 262 bool posedge() const { return (*this)->posedge(); } 263 bool negedge() const { return (*this)->negedge(); }
|
289
| 264
|
290 sc_event_finder & 291 value_changed() const 292 { 293 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 294 return *(sc_event_finder *)nullptr; 295 } 296 sc_event_finder & 297 pos() const 298 { 299 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 300 return *(sc_event_finder *)nullptr; 301 } 302 sc_event_finder & 303 neg() const 304 { 305 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 306 return *(sc_event_finder *)nullptr; 307 }
| 265 sc_event_finder &value_changed() const { return _valueChangedFinder; } 266 sc_event_finder &pos() const { return _posFinder; } 267 sc_event_finder &neg() const { return _negFinder; }
|
308 309 virtual const char *kind() const { return "sc_in"; } 310 311 private:
| 268 269 virtual const char *kind() const { return "sc_in"; } 270 271 private:
|
| 272 mutable sc_event_finder_t<sc_signal_in_if<bool> > _valueChangedFinder; 273 mutable sc_event_finder_t<sc_signal_in_if<bool> > _posFinder; 274 mutable sc_event_finder_t<sc_signal_in_if<bool> > _negFinder; 275
|
312 // Disabled
| 276 // Disabled
|
313 sc_in(const sc_in<bool> &) : sc_port<sc_signal_in_if<bool>, 1>() {} 314 sc_in<bool> &operator = (const sc_in<bool> &) { return *this; }
| 277 sc_in(const sc_in<bool> &); 278 sc_in<bool> &operator = (const sc_in<bool> &);
|
315}; 316 317template <> 318inline void 319sc_trace<bool>(sc_trace_file *, const sc_in<bool> &, const std::string &) 320{ 321 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 322} 323 324template <> 325class sc_in<sc_dt::sc_logic> : 326 public sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> 327{ 328 public:
| 279}; 280 281template <> 282inline void 283sc_trace<bool>(sc_trace_file *, const sc_in<bool> &, const std::string &) 284{ 285 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 286} 287 288template <> 289class sc_in<sc_dt::sc_logic> : 290 public sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> 291{ 292 public:
|
329 sc_in() : sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>() {}
| 293 sc_in() : sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(), 294 _valueChangedFinder(*this, 295 &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 296 _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 297 _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event) 298 {}
|
330 explicit sc_in(const char *name) :
| 299 explicit sc_in(const char *name) :
|
331 sc_port, 1>(name)
| 300 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(name), 301 _valueChangedFinder(*this, 302 &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 303 _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 304 _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event)
|
332 {} 333 virtual ~sc_in() {} 334 335 // Deprecated binding constructors. 336 explicit sc_in(const sc_signal_in_if<sc_dt::sc_logic> &interface) :
| 305 {} 306 virtual ~sc_in() {} 307 308 // Deprecated binding constructors. 309 explicit sc_in(const sc_signal_in_if<sc_dt::sc_logic> &interface) :
|
337 sc_port, 1>(interface)
| 310 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(interface), 311 _valueChangedFinder(*this, 312 &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 313 _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 314 _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event)
|
338 {} 339 sc_in(const char *name, 340 const sc_signal_in_if<sc_dt::sc_logic> &interface) :
| 315 {} 316 sc_in(const char *name, 317 const sc_signal_in_if<sc_dt::sc_logic> &interface) :
|
341 sc_port, 1>(name, interface)
| 318 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(name, interface), 319 _valueChangedFinder(*this, 320 &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 321 _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 322 _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event)
|
342 {} 343 explicit sc_in(sc_port_b<sc_signal_in_if<sc_dt::sc_logic> > &parent) :
| 323 {} 324 explicit sc_in(sc_port_b<sc_signal_in_if<sc_dt::sc_logic> > &parent) :
|
344 sc_port, 1>(parent)
| 325 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(parent), 326 _valueChangedFinder(*this, 327 &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 328 _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 329 _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event)
|
345 {} 346 sc_in(const char *name, 347 sc_port_b<sc_signal_in_if<sc_dt::sc_logic> > &parent) :
| 330 {} 331 sc_in(const char *name, 332 sc_port_b<sc_signal_in_if<sc_dt::sc_logic> > &parent) :
|
348 sc_port, 1>(name, parent)
| 333 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(name, parent), 334 _valueChangedFinder(*this, 335 &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 336 _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 337 _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event)
|
349 {} 350 explicit sc_in(sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &parent) :
| 338 {} 339 explicit sc_in(sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &parent) :
|
351 sc_port, 1>(parent)
| 340 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(parent), 341 _valueChangedFinder(*this, 342 &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 343 _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 344 _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event)
|
352 {} 353 sc_in(const char *name, 354 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &parent) :
| 345 {} 346 sc_in(const char *name, 347 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &parent) :
|
355 sc_port, 1>(name, parent)
| 348 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(name, parent), 349 _valueChangedFinder(*this, 350 &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 351 _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 352 _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event)
|
356 {} 357 358 virtual void
| 353 {} 354 355 virtual void
|
359 bind(const sc_signal_in_if &)
| 356 bind(const sc_signal_in_if<sc_dt::sc_logic> &i)
|
360 {
| 357 {
|
361 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 358 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>::bind( 359 const_cast<sc_signal_in_if<sc_dt::sc_logic> &>(i));
|
362 } 363 void
| 360 } 361 void
|
364 operator () (const sc_signal_in_if<sc_dt::sc_logic> &) 365 { 366 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 367 }
| 362 operator () (const sc_signal_in_if<sc_dt::sc_logic> &i) { bind(i); }
|
368 369 virtual void
| 363 364 virtual void
|
370 bind(sc_port, 1> &)
| 365 bind(sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &i)
|
371 {
| 366 {
|
372 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 367 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>::bind(i);
|
373 } 374 void
| 368 } 369 void
|
375 operator () (sc_port, 1> &)
| 370 operator () (sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &p)
|
376 {
| 371 {
|
377 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 372 bind(p);
|
378 } 379 380 virtual void
| 373 } 374 375 virtual void
|
381 bind(sc_port, 1> &)
| 376 bind(sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &p)
|
382 {
| 377 {
|
383 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 378 sc_port_base::bind(p);
|
384 } 385 void
| 379 } 380 void
|
386 operator () (sc_port, 1> &)
| 381 operator () (sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &p)
|
387 {
| 382 {
|
388 sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
| 383 bind(p);
|
389 } 390
| 384 } 385
|
391 virtual void 392 end_of_elaboration() 393 { 394 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 395 }
| 386 virtual void end_of_elaboration() { /* Implementation defined. */ }
|
396
| 387
|
397 const sc_dt::sc_logic & 398 read() const 399 { 400 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 401 return *(const sc_dt::sc_logic *)nullptr; 402 } 403 operator const sc_dt::sc_logic& () const 404 { 405 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 406 return *(const sc_dt::sc_logic *)nullptr; 407 }
| 388 const sc_dt::sc_logic &read() const { return (*this)->read(); } 389 operator const sc_dt::sc_logic& () const { return (*this)->read(); }
|
408
| 390
|
| 391 const sc_event &default_event() const { return (*this)->default_event(); }
|
409 const sc_event &
| 392 const sc_event &
|
410 default_event() const 411 { 412 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 413 return *(const sc_event *)nullptr; 414 } 415 const sc_event &
| |
416 value_changed_event() const 417 {
| 393 value_changed_event() const 394 {
|
418 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 419 return *(const sc_event *)nullptr;
| 395 return (*this)->value_changed_event();
|
420 }
| 396 }
|
421 const sc_event & 422 posedge_event() const 423 { 424 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 425 return *(const sc_event *)nullptr; 426 } 427 const sc_event & 428 negedge_event() const 429 { 430 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 431 return *(const sc_event *)nullptr; 432 }
| 397 const sc_event &posedge_event() const { return (*this)->posedge_event(); } 398 const sc_event &negedge_event() const { return (*this)->negedge_event(); }
|
433
| 399
|
434 bool 435 event() const 436 { 437 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 438 return false; 439 } 440 bool 441 posedge() const 442 { 443 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 444 return false; 445 } 446 bool 447 negedge() const 448 { 449 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 450 return false; 451 }
| 400 bool event() const { return (*this)->event(); } 401 bool posedge() const { return (*this)->posedge(); } 402 bool negedge() const { return (*this)->negedge(); }
|
452
| 403
|
453 sc_event_finder & 454 value_changed() const 455 { 456 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 457 return *(sc_event_finder *)nullptr; 458 } 459 sc_event_finder & 460 pos() const 461 { 462 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 463 return *(sc_event_finder *)nullptr; 464 } 465 sc_event_finder & 466 neg() const 467 { 468 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 469 return *(sc_event_finder *)nullptr; 470 }
| 404 sc_event_finder &value_changed() const { return _valueChangedFinder; } 405 sc_event_finder &pos() const { return _posFinder; } 406 sc_event_finder &neg() const { return _negFinder; }
|
471 472 virtual const char *kind() const { return "sc_in"; } 473 474 private:
| 407 408 virtual const char *kind() const { return "sc_in"; } 409 410 private:
|
| 411 mutable sc_event_finder_t<sc_signal_in_if<sc_dt::sc_logic> > 412 _valueChangedFinder; 413 mutable sc_event_finder_t<sc_signal_in_if<sc_dt::sc_logic> > _posFinder; 414 mutable sc_event_finder_t<sc_signal_in_if<sc_dt::sc_logic> > _negFinder; 415
|
475 // Disabled
| 416 // Disabled
|
476 sc_in(const sc_in<sc_dt::sc_logic> &) : 477 sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>() 478 {} 479 sc_in<sc_dt::sc_logic> & 480 operator = (const sc_in<sc_dt::sc_logic> &) 481 { 482 return *this; 483 }
| 417 sc_in(const sc_in<sc_dt::sc_logic> &); 418 sc_in<sc_dt::sc_logic> &operator = (const sc_in<sc_dt::sc_logic> &);
|
484}; 485 486template <> 487inline void 488sc_trace<sc_dt::sc_logic>( 489 sc_trace_file *, const sc_in<sc_dt::sc_logic> &, const std::string &) 490{ 491 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 492} 493 494} // namespace sc_core 495 496#endif //__SYSTEMC_EXT_CHANNEL_SC_IN_HH__
| 419}; 420 421template <> 422inline void 423sc_trace<sc_dt::sc_logic>( 424 sc_trace_file *, const sc_in<sc_dt::sc_logic> &, const std::string &) 425{ 426 sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 427} 428 429} // namespace sc_core 430 431#endif //__SYSTEMC_EXT_CHANNEL_SC_IN_HH__
|