sc_in.hh revision 13054
112841Sgabeblack@google.com/* 212841Sgabeblack@google.com * Copyright 2018 Google, Inc. 312841Sgabeblack@google.com * 412841Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 512841Sgabeblack@google.com * modification, are permitted provided that the following conditions are 612841Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 712841Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 812841Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 912841Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1012841Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1112841Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1212841Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1312841Sgabeblack@google.com * this software without specific prior written permission. 1412841Sgabeblack@google.com * 1512841Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1612841Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1712841Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1812841Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1912841Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2012841Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2112841Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2212841Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2312841Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2412841Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2512841Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2612841Sgabeblack@google.com * 2712841Sgabeblack@google.com * Authors: Gabe Black 2812841Sgabeblack@google.com */ 2912841Sgabeblack@google.com 3012841Sgabeblack@google.com#ifndef __SYSTEMC_EXT_CHANNEL_SC_IN_HH__ 3112841Sgabeblack@google.com#define __SYSTEMC_EXT_CHANNEL_SC_IN_HH__ 3212841Sgabeblack@google.com 3312841Sgabeblack@google.com#include <string> 3412841Sgabeblack@google.com 3513054Sgabeblack@google.com#include "../core/sc_event.hh" 3612841Sgabeblack@google.com#include "../core/sc_port.hh" 3712841Sgabeblack@google.com#include "sc_signal_in_if.hh" 3812841Sgabeblack@google.com#include "sc_signal_inout_if.hh" 3912841Sgabeblack@google.com#include "warn_unimpl.hh" 4012841Sgabeblack@google.com 4112841Sgabeblack@google.comnamespace sc_core 4212841Sgabeblack@google.com{ 4312841Sgabeblack@google.com 4412841Sgabeblack@google.comclass sc_event; 4512841Sgabeblack@google.comclass sc_trace_file; 4612841Sgabeblack@google.com 4712841Sgabeblack@google.comtemplate <class T> 4812841Sgabeblack@google.comclass sc_in : public sc_port<sc_signal_in_if<T>, 1> 4912841Sgabeblack@google.com{ 5012841Sgabeblack@google.com public: 5113054Sgabeblack@google.com sc_in() : sc_port<sc_signal_in_if<T>, 1>(), 5213054Sgabeblack@google.com _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 5313054Sgabeblack@google.com {} 5413054Sgabeblack@google.com explicit sc_in(const char *name) : sc_port<sc_signal_in_if<T>, 1>(name), 5513054Sgabeblack@google.com _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 5613054Sgabeblack@google.com {} 5712841Sgabeblack@google.com virtual ~sc_in() {} 5812841Sgabeblack@google.com 5912868Sgabeblack@google.com // Deprecated binding constructors. 6012868Sgabeblack@google.com explicit sc_in(const sc_signal_in_if<T> &interface) : 6113054Sgabeblack@google.com sc_port<sc_signal_in_if<T>, 1>(interface), 6213054Sgabeblack@google.com _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 6312868Sgabeblack@google.com {} 6412868Sgabeblack@google.com sc_in(const char *name, const sc_signal_in_if<T> &interface) : 6513054Sgabeblack@google.com sc_port<sc_signal_in_if<T>, 1>(name, interface), 6613054Sgabeblack@google.com _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 6712868Sgabeblack@google.com {} 6812868Sgabeblack@google.com explicit sc_in(sc_port_b<sc_signal_in_if<T> > &parent) : 6913054Sgabeblack@google.com sc_port<sc_signal_in_if<T>, 1>(parent), 7013054Sgabeblack@google.com _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 7112868Sgabeblack@google.com {} 7212868Sgabeblack@google.com sc_in(const char *name, sc_port_b<sc_signal_in_if<T> > &parent) : 7313054Sgabeblack@google.com sc_port<sc_signal_in_if<T>, 1>(name, parent), 7413054Sgabeblack@google.com _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 7512868Sgabeblack@google.com {} 7612868Sgabeblack@google.com explicit sc_in(sc_port<sc_signal_in_if<T>, 1> &parent) : 7713054Sgabeblack@google.com sc_port<sc_signal_in_if<T>, 1>(parent), 7813054Sgabeblack@google.com _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 7912868Sgabeblack@google.com {} 8012868Sgabeblack@google.com sc_in(const char *name, sc_port<sc_signal_in_if<T>, 1> &parent) : 8113054Sgabeblack@google.com sc_port<sc_signal_in_if<T>, 1>(name, parent), 8213054Sgabeblack@google.com _valueChangedFinder(*this, &sc_signal_in_if<T>::value_changed_event) 8312868Sgabeblack@google.com {} 8412868Sgabeblack@google.com 8512841Sgabeblack@google.com virtual void 8613054Sgabeblack@google.com bind(const sc_signal_in_if<T> &i) 8712841Sgabeblack@google.com { 8813054Sgabeblack@google.com sc_port<sc_signal_in_if<T>, 1>::bind( 8913054Sgabeblack@google.com const_cast<sc_signal_in_if<T> &>(i)); 9013054Sgabeblack@google.com } 9113054Sgabeblack@google.com void operator () (const sc_signal_in_if<T> &i) { bind(i); } 9213054Sgabeblack@google.com 9313054Sgabeblack@google.com virtual void 9413054Sgabeblack@google.com bind(sc_port<sc_signal_in_if<T>, 1> &i) 9513054Sgabeblack@google.com { 9613054Sgabeblack@google.com sc_port<sc_signal_in_if<T>, 1>::bind(i); 9712841Sgabeblack@google.com } 9812841Sgabeblack@google.com void 9913054Sgabeblack@google.com operator () (sc_port<sc_signal_in_if<T>, 1> &p) 10012841Sgabeblack@google.com { 10113054Sgabeblack@google.com bind(p); 10212841Sgabeblack@google.com } 10312841Sgabeblack@google.com 10412841Sgabeblack@google.com virtual void 10513054Sgabeblack@google.com bind(sc_port<sc_signal_inout_if<T>, 1> &p) 10612841Sgabeblack@google.com { 10713054Sgabeblack@google.com sc_port_base::bind(p); 10812841Sgabeblack@google.com } 10912841Sgabeblack@google.com void 11013054Sgabeblack@google.com operator () (sc_port<sc_signal_inout_if<T>, 1> &p) 11112841Sgabeblack@google.com { 11213054Sgabeblack@google.com bind(p); 11312841Sgabeblack@google.com } 11412841Sgabeblack@google.com 11513054Sgabeblack@google.com virtual void end_of_elaboration() { /* Implementation defined. */ } 11612841Sgabeblack@google.com 11713054Sgabeblack@google.com const T &read() const { return (*this)->read(); } 11813054Sgabeblack@google.com operator const T& () const { return (*this)->read(); } 11912841Sgabeblack@google.com 12013054Sgabeblack@google.com const sc_event &default_event() const { return (*this)->default_event(); } 12112841Sgabeblack@google.com const sc_event & 12212841Sgabeblack@google.com value_changed_event() const 12312841Sgabeblack@google.com { 12413054Sgabeblack@google.com return (*this)->value_changed_event(); 12512841Sgabeblack@google.com } 12613054Sgabeblack@google.com bool event() const { return (*this)->event(); } 12713054Sgabeblack@google.com sc_event_finder &value_changed() const { return _valueChangedFinder; } 12812841Sgabeblack@google.com 12912841Sgabeblack@google.com virtual const char *kind() const { return "sc_in"; } 13012841Sgabeblack@google.com 13112841Sgabeblack@google.com private: 13213054Sgabeblack@google.com mutable sc_event_finder_t<sc_signal_in_if<T> > _valueChangedFinder; 13313054Sgabeblack@google.com 13412841Sgabeblack@google.com // Disabled 13513054Sgabeblack@google.com sc_in(const sc_in<T> &); 13613054Sgabeblack@google.com sc_in<T> &operator = (const sc_in<T> &); 13712841Sgabeblack@google.com}; 13812841Sgabeblack@google.com 13912841Sgabeblack@google.comtemplate <class T> 14012841Sgabeblack@google.cominline void 14112841Sgabeblack@google.comsc_trace(sc_trace_file *, const sc_in<T> &, const std::string &) 14212841Sgabeblack@google.com{ 14312841Sgabeblack@google.com sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 14412841Sgabeblack@google.com} 14512841Sgabeblack@google.com 14612841Sgabeblack@google.comtemplate <> 14712841Sgabeblack@google.comclass sc_in<bool> : public sc_port<sc_signal_in_if<bool>, 1> 14812841Sgabeblack@google.com{ 14912841Sgabeblack@google.com public: 15013054Sgabeblack@google.com sc_in() : sc_port<sc_signal_in_if<bool>, 1>(), 15113054Sgabeblack@google.com _valueChangedFinder(*this, 15213054Sgabeblack@google.com &sc_signal_in_if<bool>::value_changed_event), 15313054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 15413054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 15513054Sgabeblack@google.com {} 15612841Sgabeblack@google.com explicit sc_in(const char *name) : 15713054Sgabeblack@google.com sc_port<sc_signal_in_if<bool>, 1>(name), 15813054Sgabeblack@google.com _valueChangedFinder(*this, 15913054Sgabeblack@google.com &sc_signal_in_if<bool>::value_changed_event), 16013054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 16113054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 16213054Sgabeblack@google.com {} 16312841Sgabeblack@google.com virtual ~sc_in() {} 16412841Sgabeblack@google.com 16512868Sgabeblack@google.com // Deprecated binding constructors. 16612868Sgabeblack@google.com explicit sc_in(const sc_signal_in_if<bool> &interface) : 16713054Sgabeblack@google.com sc_port<sc_signal_in_if<bool>, 1>(interface), 16813054Sgabeblack@google.com _valueChangedFinder(*this, 16913054Sgabeblack@google.com &sc_signal_in_if<bool>::value_changed_event), 17013054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 17113054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 17212868Sgabeblack@google.com {} 17312868Sgabeblack@google.com sc_in(const char *name, const sc_signal_in_if<bool> &interface) : 17413054Sgabeblack@google.com sc_port<sc_signal_in_if<bool>, 1>(name, interface), 17513054Sgabeblack@google.com _valueChangedFinder(*this, 17613054Sgabeblack@google.com &sc_signal_in_if<bool>::value_changed_event), 17713054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 17813054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 17912868Sgabeblack@google.com {} 18012868Sgabeblack@google.com explicit sc_in(sc_port_b<sc_signal_in_if<bool> > &parent) : 18113054Sgabeblack@google.com sc_port<sc_signal_in_if<bool>, 1>(parent), 18213054Sgabeblack@google.com _valueChangedFinder(*this, 18313054Sgabeblack@google.com &sc_signal_in_if<bool>::value_changed_event), 18413054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 18513054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 18612868Sgabeblack@google.com {} 18712868Sgabeblack@google.com sc_in(const char *name, sc_port_b<sc_signal_in_if<bool> > &parent) : 18813054Sgabeblack@google.com sc_port<sc_signal_in_if<bool>, 1>(name, parent), 18913054Sgabeblack@google.com _valueChangedFinder(*this, 19013054Sgabeblack@google.com &sc_signal_in_if<bool>::value_changed_event), 19113054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 19213054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 19312868Sgabeblack@google.com {} 19412868Sgabeblack@google.com explicit sc_in(sc_port<sc_signal_in_if<bool>, 1> &parent) : 19513054Sgabeblack@google.com sc_port<sc_signal_in_if<bool>, 1>(parent), 19613054Sgabeblack@google.com _valueChangedFinder(*this, 19713054Sgabeblack@google.com &sc_signal_in_if<bool>::value_changed_event), 19813054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 19913054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 20012868Sgabeblack@google.com {} 20112868Sgabeblack@google.com sc_in(const char *name, sc_port<sc_signal_in_if<bool>, 1> &parent) : 20213054Sgabeblack@google.com sc_port<sc_signal_in_if<bool>, 1>(name, parent), 20313054Sgabeblack@google.com _valueChangedFinder(*this, 20413054Sgabeblack@google.com &sc_signal_in_if<bool>::value_changed_event), 20513054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<bool>::posedge_event), 20613054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<bool>::negedge_event) 20712868Sgabeblack@google.com {} 20812868Sgabeblack@google.com 20912841Sgabeblack@google.com virtual void 21013054Sgabeblack@google.com bind(const sc_signal_in_if<bool> &i) 21112841Sgabeblack@google.com { 21213054Sgabeblack@google.com sc_port<sc_signal_in_if<bool>, 1>::bind( 21313054Sgabeblack@google.com const_cast<sc_signal_in_if<bool> &>(i)); 21413054Sgabeblack@google.com } 21513054Sgabeblack@google.com void operator () (const sc_signal_in_if<bool> &i) { bind(i); } 21613054Sgabeblack@google.com 21713054Sgabeblack@google.com virtual void 21813054Sgabeblack@google.com bind(sc_port<sc_signal_in_if<bool>, 1> &p) 21913054Sgabeblack@google.com { 22013054Sgabeblack@google.com sc_port<sc_signal_in_if<bool>, 1>::bind(p); 22112841Sgabeblack@google.com } 22212841Sgabeblack@google.com void 22313054Sgabeblack@google.com operator () (sc_port<sc_signal_in_if<bool>, 1> &p) 22412841Sgabeblack@google.com { 22513054Sgabeblack@google.com bind(p); 22612841Sgabeblack@google.com } 22712841Sgabeblack@google.com 22812841Sgabeblack@google.com virtual void 22913054Sgabeblack@google.com bind(sc_port<sc_signal_inout_if<bool>, 1> &p) 23012841Sgabeblack@google.com { 23113054Sgabeblack@google.com sc_port_base::bind(p); 23212841Sgabeblack@google.com } 23312841Sgabeblack@google.com void 23413054Sgabeblack@google.com operator () (sc_port<sc_signal_inout_if<bool>, 1> &p) 23512841Sgabeblack@google.com { 23613054Sgabeblack@google.com bind(p); 23712841Sgabeblack@google.com } 23812841Sgabeblack@google.com 23913054Sgabeblack@google.com virtual void end_of_elaboration() { /* Implementation defined. */ } 24012841Sgabeblack@google.com 24113054Sgabeblack@google.com const bool &read() const { return (*this)->read(); } 24213054Sgabeblack@google.com operator const bool& () const { return (*this)->read(); } 24312841Sgabeblack@google.com 24413054Sgabeblack@google.com const sc_event &default_event() const { return (*this)->default_event(); } 24512841Sgabeblack@google.com const sc_event & 24612841Sgabeblack@google.com value_changed_event() const 24712841Sgabeblack@google.com { 24813054Sgabeblack@google.com return (*this)->value_changed_event(); 24912841Sgabeblack@google.com } 25012841Sgabeblack@google.com const sc_event & 25112841Sgabeblack@google.com posedge_event() const 25212841Sgabeblack@google.com { 25313054Sgabeblack@google.com return (*this)->posedge_event(); 25412841Sgabeblack@google.com } 25512841Sgabeblack@google.com const sc_event & 25612841Sgabeblack@google.com negedge_event() const 25712841Sgabeblack@google.com { 25813054Sgabeblack@google.com return (*this)->negedge_event(); 25912841Sgabeblack@google.com } 26012841Sgabeblack@google.com 26113054Sgabeblack@google.com bool event() const { return (*this)->event(); } 26213054Sgabeblack@google.com bool posedge() const { return (*this)->posedge(); } 26313054Sgabeblack@google.com bool negedge() const { return (*this)->negedge(); } 26412841Sgabeblack@google.com 26513054Sgabeblack@google.com sc_event_finder &value_changed() const { return _valueChangedFinder; } 26613054Sgabeblack@google.com sc_event_finder &pos() const { return _posFinder; } 26713054Sgabeblack@google.com sc_event_finder &neg() const { return _negFinder; } 26812841Sgabeblack@google.com 26912841Sgabeblack@google.com virtual const char *kind() const { return "sc_in"; } 27012841Sgabeblack@google.com 27112841Sgabeblack@google.com private: 27213054Sgabeblack@google.com mutable sc_event_finder_t<sc_signal_in_if<bool> > _valueChangedFinder; 27313054Sgabeblack@google.com mutable sc_event_finder_t<sc_signal_in_if<bool> > _posFinder; 27413054Sgabeblack@google.com mutable sc_event_finder_t<sc_signal_in_if<bool> > _negFinder; 27513054Sgabeblack@google.com 27612841Sgabeblack@google.com // Disabled 27713054Sgabeblack@google.com sc_in(const sc_in<bool> &); 27813054Sgabeblack@google.com sc_in<bool> &operator = (const sc_in<bool> &); 27912841Sgabeblack@google.com}; 28012841Sgabeblack@google.com 28112841Sgabeblack@google.comtemplate <> 28212841Sgabeblack@google.cominline void 28312841Sgabeblack@google.comsc_trace<bool>(sc_trace_file *, const sc_in<bool> &, const std::string &) 28412841Sgabeblack@google.com{ 28512841Sgabeblack@google.com sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 28612841Sgabeblack@google.com} 28712841Sgabeblack@google.com 28812841Sgabeblack@google.comtemplate <> 28912841Sgabeblack@google.comclass sc_in<sc_dt::sc_logic> : 29012841Sgabeblack@google.com public sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> 29112841Sgabeblack@google.com{ 29212841Sgabeblack@google.com public: 29313054Sgabeblack@google.com sc_in() : sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(), 29413054Sgabeblack@google.com _valueChangedFinder(*this, 29513054Sgabeblack@google.com &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 29613054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 29713054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event) 29813054Sgabeblack@google.com {} 29912841Sgabeblack@google.com explicit sc_in(const char *name) : 30013054Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(name), 30113054Sgabeblack@google.com _valueChangedFinder(*this, 30213054Sgabeblack@google.com &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 30313054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 30413054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event) 30512841Sgabeblack@google.com {} 30612841Sgabeblack@google.com virtual ~sc_in() {} 30712841Sgabeblack@google.com 30812868Sgabeblack@google.com // Deprecated binding constructors. 30912868Sgabeblack@google.com explicit sc_in(const sc_signal_in_if<sc_dt::sc_logic> &interface) : 31013054Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(interface), 31113054Sgabeblack@google.com _valueChangedFinder(*this, 31213054Sgabeblack@google.com &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 31313054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 31413054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event) 31512868Sgabeblack@google.com {} 31612868Sgabeblack@google.com sc_in(const char *name, 31712868Sgabeblack@google.com const sc_signal_in_if<sc_dt::sc_logic> &interface) : 31813054Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(name, interface), 31913054Sgabeblack@google.com _valueChangedFinder(*this, 32013054Sgabeblack@google.com &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 32113054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 32213054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event) 32312868Sgabeblack@google.com {} 32412868Sgabeblack@google.com explicit sc_in(sc_port_b<sc_signal_in_if<sc_dt::sc_logic> > &parent) : 32513054Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(parent), 32613054Sgabeblack@google.com _valueChangedFinder(*this, 32713054Sgabeblack@google.com &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 32813054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 32913054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event) 33012868Sgabeblack@google.com {} 33112868Sgabeblack@google.com sc_in(const char *name, 33212868Sgabeblack@google.com sc_port_b<sc_signal_in_if<sc_dt::sc_logic> > &parent) : 33313054Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(name, parent), 33413054Sgabeblack@google.com _valueChangedFinder(*this, 33513054Sgabeblack@google.com &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 33613054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 33713054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event) 33812868Sgabeblack@google.com {} 33912868Sgabeblack@google.com explicit sc_in(sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &parent) : 34013054Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(parent), 34113054Sgabeblack@google.com _valueChangedFinder(*this, 34213054Sgabeblack@google.com &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 34313054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 34413054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event) 34512868Sgabeblack@google.com {} 34612868Sgabeblack@google.com sc_in(const char *name, 34712868Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &parent) : 34813054Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>(name, parent), 34913054Sgabeblack@google.com _valueChangedFinder(*this, 35013054Sgabeblack@google.com &sc_signal_in_if<sc_dt::sc_logic>::value_changed_event), 35113054Sgabeblack@google.com _posFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::posedge_event), 35213054Sgabeblack@google.com _negFinder(*this, &sc_signal_in_if<sc_dt::sc_logic>::negedge_event) 35312868Sgabeblack@google.com {} 35412868Sgabeblack@google.com 35512841Sgabeblack@google.com virtual void 35613054Sgabeblack@google.com bind(const sc_signal_in_if<sc_dt::sc_logic> &i) 35712841Sgabeblack@google.com { 35813054Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>::bind( 35913054Sgabeblack@google.com const_cast<sc_signal_in_if<sc_dt::sc_logic> &>(i)); 36012841Sgabeblack@google.com } 36112841Sgabeblack@google.com void 36213054Sgabeblack@google.com operator () (const sc_signal_in_if<sc_dt::sc_logic> &i) { bind(i); } 36313054Sgabeblack@google.com 36413054Sgabeblack@google.com virtual void 36513054Sgabeblack@google.com bind(sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &i) 36612841Sgabeblack@google.com { 36713054Sgabeblack@google.com sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1>::bind(i); 36813054Sgabeblack@google.com } 36913054Sgabeblack@google.com void 37013054Sgabeblack@google.com operator () (sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &p) 37113054Sgabeblack@google.com { 37213054Sgabeblack@google.com bind(p); 37312841Sgabeblack@google.com } 37412841Sgabeblack@google.com 37512841Sgabeblack@google.com virtual void 37613054Sgabeblack@google.com bind(sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &p) 37712841Sgabeblack@google.com { 37813054Sgabeblack@google.com sc_port_base::bind(p); 37912841Sgabeblack@google.com } 38012841Sgabeblack@google.com void 38113054Sgabeblack@google.com operator () (sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &p) 38212841Sgabeblack@google.com { 38313054Sgabeblack@google.com bind(p); 38412841Sgabeblack@google.com } 38512841Sgabeblack@google.com 38613054Sgabeblack@google.com virtual void end_of_elaboration() { /* Implementation defined. */ } 38712841Sgabeblack@google.com 38813054Sgabeblack@google.com const sc_dt::sc_logic &read() const { return (*this)->read(); } 38913054Sgabeblack@google.com operator const sc_dt::sc_logic& () const { return (*this)->read(); } 39012841Sgabeblack@google.com 39113054Sgabeblack@google.com const sc_event &default_event() const { return (*this)->default_event(); } 39212841Sgabeblack@google.com const sc_event & 39312841Sgabeblack@google.com value_changed_event() const 39412841Sgabeblack@google.com { 39513054Sgabeblack@google.com return (*this)->value_changed_event(); 39612841Sgabeblack@google.com } 39713054Sgabeblack@google.com const sc_event &posedge_event() const { return (*this)->posedge_event(); } 39813054Sgabeblack@google.com const sc_event &negedge_event() const { return (*this)->negedge_event(); } 39912841Sgabeblack@google.com 40013054Sgabeblack@google.com bool event() const { return (*this)->event(); } 40113054Sgabeblack@google.com bool posedge() const { return (*this)->posedge(); } 40213054Sgabeblack@google.com bool negedge() const { return (*this)->negedge(); } 40312841Sgabeblack@google.com 40413054Sgabeblack@google.com sc_event_finder &value_changed() const { return _valueChangedFinder; } 40513054Sgabeblack@google.com sc_event_finder &pos() const { return _posFinder; } 40613054Sgabeblack@google.com sc_event_finder &neg() const { return _negFinder; } 40712841Sgabeblack@google.com 40812841Sgabeblack@google.com virtual const char *kind() const { return "sc_in"; } 40912841Sgabeblack@google.com 41012841Sgabeblack@google.com private: 41113054Sgabeblack@google.com mutable sc_event_finder_t<sc_signal_in_if<sc_dt::sc_logic> > 41213054Sgabeblack@google.com _valueChangedFinder; 41313054Sgabeblack@google.com mutable sc_event_finder_t<sc_signal_in_if<sc_dt::sc_logic> > _posFinder; 41413054Sgabeblack@google.com mutable sc_event_finder_t<sc_signal_in_if<sc_dt::sc_logic> > _negFinder; 41513054Sgabeblack@google.com 41612841Sgabeblack@google.com // Disabled 41713054Sgabeblack@google.com sc_in(const sc_in<sc_dt::sc_logic> &); 41813054Sgabeblack@google.com sc_in<sc_dt::sc_logic> &operator = (const sc_in<sc_dt::sc_logic> &); 41912841Sgabeblack@google.com}; 42012841Sgabeblack@google.com 42112841Sgabeblack@google.comtemplate <> 42212841Sgabeblack@google.cominline void 42312841Sgabeblack@google.comsc_trace<sc_dt::sc_logic>( 42412841Sgabeblack@google.com sc_trace_file *, const sc_in<sc_dt::sc_logic> &, const std::string &) 42512841Sgabeblack@google.com{ 42612841Sgabeblack@google.com sc_channel_warn_unimpl(__PRETTY_FUNCTION__); 42712841Sgabeblack@google.com} 42812841Sgabeblack@google.com 42912841Sgabeblack@google.com} // namespace sc_core 43012841Sgabeblack@google.com 43112841Sgabeblack@google.com#endif //__SYSTEMC_EXT_CHANNEL_SC_IN_HH__ 432