29#ifndef SC_SIGNAL_PORTS_H
30#define SC_SIGNAL_PORTS_H
39#if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN)
41#pragma warning(disable: 4251)
61 : tf( tf_ ), name( name_ )
77:
public sc_port<sc_signal_in_if<T>,1,SC_ONE_OR_MORE_BOUND>
155 delete m_change_finder_p;
165 { this->
bind(
const_cast<const in_if_type&
>( interface_ ) ); }
168 { this->
bind( interface_ ); }
177 { this->
bind( parent_ ); }
186 { this->
bind( parent_ ); }
194 {
return (*this)->default_event(); }
200 {
return (*this)->value_changed_event(); }
206 {
return (*this)->read(); }
209 {
return (*this)->read(); }
215 {
return (*this)->event(); }
233 virtual const char*
kind()
const
284 return os << a->
read();
297 if( m_traces != 0 ) {
298 for(
int i = 0; i < (int)m_traces->size(); ++ i ) {
317 if( m_traces == 0 ) {
331 add_trace_internal(tf_, name_);
339 if( m_traces != 0 ) {
340 for(
int i = (
int)m_traces->size() - 1; i >= 0; -- i ) {
341 delete (*m_traces)[i];
365 if( in_parent != 0 ) {
370 if( inout_parent != 0 ) {
389 public sc_port<sc_signal_in_if<bool>,1,SC_ONE_OR_MORE_BOUND>
412 :
base_type(), m_traces( 0 ), m_change_finder_p(0),
413 m_neg_finder_p(0), m_pos_finder_p(0)
417 :
base_type( name_ ), m_traces( 0 ), m_change_finder_p(0),
418 m_neg_finder_p(0), m_pos_finder_p(0)
423 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
428 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
433 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
437 :
base_type( name_, parent_ ), m_traces( 0 ),
438 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
443 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
448 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
453 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
457 sc_in(
const this_type& parent_ )
458 : base_type( *(in_if_type*)parent_.get_interface() ) , m_traces( 0 ),
459 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
464 :
base_type( name_, parent_ ), m_traces( 0 ),
465 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
474 delete m_change_finder_p;
475 delete m_neg_finder_p;
476 delete m_pos_finder_p;
486 { this->bind(
const_cast<const in_if_type&
>( interface_ ) ); }
489 { this->bind( interface_ ); }
498 { this->bind( parent_ ); }
507 { this->bind( parent_ ); }
515 {
return (*this)->default_event(); }
521 {
return (*this)->value_changed_event(); }
526 {
return (*this)->posedge_event(); }
531 {
return (*this)->negedge_event(); }
537 {
return (*this)->read(); }
540 {
return (*this)->read(); }
548 ( m_pos_finder_p, *
this, &in_if_type::posedge_event );
556 ( m_neg_finder_p, *
this, &in_if_type::negedge_event );
563 {
return (*this)->event(); }
568 {
return (*this)->posedge(); }
573 {
return (*this)->negedge(); }
580 ( m_change_finder_p, *
this, &in_if_type::value_changed_event );
590 virtual const char*
kind()
const
629 sc_in(
const this_type& );
631 this_type& operator = (
const this_type& );
638 static data_type dummy;
653:
public sc_port<sc_signal_in_if<sc_dt::sc_logic>,1,SC_ONE_OR_MORE_BOUND>
677 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
682 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
687 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
692 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
697 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
701 :
base_type( name_, parent_ ), m_traces( 0 ),
702 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
707 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
712 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
717 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
721 :
base_type( name_, parent_ ), m_traces( 0 ),
722 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
731 delete m_change_finder_p;
732 delete m_neg_finder_p;
733 delete m_pos_finder_p;
743 { this->bind(
const_cast<const in_if_type&
>( interface_ ) ); }
746 { this->bind( interface_ ); }
755 { this->bind( parent_ ); }
764 { this->bind( parent_ ); }
772 {
return (*this)->default_event(); }
778 {
return (*this)->value_changed_event(); }
783 {
return (*this)->posedge_event(); }
788 {
return (*this)->negedge_event(); }
794 {
return (*this)->read(); }
797 {
return (*this)->read(); }
805 ( m_pos_finder_p, *
this, &in_if_type::posedge_event );
813 ( m_neg_finder_p, *
this, &in_if_type::negedge_event );
820 {
return (*this)->event(); }
825 {
return (*this)->posedge(); }
830 {
return (*this)->negedge(); }
837 ( m_change_finder_p, *
this, &in_if_type::value_changed_event );
847 virtual const char*
kind()
const
884 sc_in(
const this_type& );
885 this_type& operator = (
const this_type& );
892 static data_type dummy;
905:
public sc_port<sc_signal_inout_if<T>,1,SC_ONE_OR_MORE_BOUND>
977 {
return (*this)->default_event(); }
983 {
return (*this)->value_changed_event(); }
989 {
return (*this)->read(); }
992 {
return (*this)->read(); }
998 {
return (*this)->event(); }
1004 { (*this)->write( value_ ); }
1007 {
write( value_ );
return *
this; }
1010 {
return *
this = interface_.
read(); }
1013 {
return *
this = port_->read(); }
1016 {
return *
this = port_->read(); }
1019 {
return *
this = port_->read(); }
1046 {
return "sc_inout"; }
1085 return os << a->
read();
1097 delete m_change_finder_p;
1112 iface->
write( value_ );
1114 if( m_init_val == 0 ) {
1117 *m_init_val = value_;
1129 if( m_init_val != 0 ) {
1130 write( *m_init_val );
1134 if( m_traces != 0 ) {
1135 for(
int i = 0; i < (int)m_traces->size(); ++ i ) {
1154 if( m_traces == 0 ) {
1167 add_trace_internal(tf_, name_);
1175 if( m_traces != 0 ) {
1176 for(
int i =
static_cast<int>(m_traces->size()) - 1; i >= 0; -- i ) {
1177 delete (*m_traces)[i];
1195 public sc_port<sc_signal_inout_if<bool>,1,SC_ONE_OR_MORE_BOUND>
1217 :
base_type(), m_init_val( 0 ), m_traces( 0 ),
1218 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1222 :
base_type( name_ ), m_init_val( 0 ), m_traces( 0 ),
1223 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1227 :
base_type( interface_ ), m_init_val( 0 ), m_traces( 0 ),
1228 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1232 :
base_type( name_, interface_ ), m_init_val( 0 ), m_traces( 0 ),
1233 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1237 :
base_type( parent_ ), m_init_val( 0 ), m_traces( 0 ),
1238 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1242 :
base_type( name_, parent_ ), m_init_val( 0 ), m_traces( 0 ),
1243 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1247 :
base_type( parent_ ), m_init_val( 0 ), m_traces( 0 ),
1248 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1252 :
base_type( name_, parent_ ), m_init_val( 0 ), m_traces( 0 ),
1253 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1267 {
return (*this)->default_event(); }
1273 {
return (*this)->value_changed_event(); }
1278 {
return (*this)->posedge_event(); }
1283 {
return (*this)->negedge_event(); }
1289 {
return (*this)->read(); }
1292 {
return (*this)->read(); }
1300 ( m_pos_finder_p, *
this, &in_if_type::posedge_event );
1308 ( m_neg_finder_p, *
this, &in_if_type::negedge_event );
1315 {
return (*this)->event(); }
1320 {
return (*this)->posedge(); }
1325 {
return (*this)->negedge(); }
1330 { (*this)->write( value_ ); }
1333 { write( value_ );
return *
this; }
1336 {
return *
this = interface_.
read(); }
1339 {
return *
this = port_->read(); }
1342 {
return *
this = port_->read(); }
1345 {
return *
this = port_->read(); }
1353 { initialize( interface_.
read() ); }
1368 ( m_change_finder_p, *
this, &in_if_type::value_changed_event );
1372 {
return "sc_inout"; }
1421:
public sc_port<sc_signal_inout_if<sc_dt::sc_logic>,1,SC_ONE_OR_MORE_BOUND>
1443 :
base_type(), m_init_val( 0 ), m_traces( 0 ),
1444 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1448 :
base_type( name_ ), m_init_val( 0 ), m_traces( 0 ),
1449 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1453 :
base_type( interface_ ), m_init_val( 0 ), m_traces( 0 ),
1454 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1458 :
base_type( name_, interface_ ), m_init_val( 0 ), m_traces( 0 ),
1459 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1463 :
base_type( parent_ ), m_init_val( 0 ), m_traces( 0 ),
1464 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1468 :
base_type( name_, parent_ ), m_init_val( 0 ), m_traces( 0 ),
1469 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1473 :
base_type( parent_ ), m_init_val( 0 ), m_traces( 0 ),
1474 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1478 :
base_type( name_, parent_ ), m_init_val( 0 ), m_traces( 0 ),
1479 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1493 {
return (*this)->default_event(); }
1499 {
return (*this)->value_changed_event(); }
1504 {
return (*this)->posedge_event(); }
1509 {
return (*this)->negedge_event(); }
1515 {
return (*this)->read(); }
1518 {
return (*this)->read(); }
1526 ( m_pos_finder_p, *
this, &in_if_type::posedge_event );
1534 ( m_neg_finder_p, *
this, &in_if_type::negedge_event );
1541 {
return (*this)->event(); }
1546 {
return (*this)->posedge(); }
1551 {
return (*this)->negedge(); }
1556 { (*this)->write( value_ ); }
1559 { write( value_ );
return *
this; }
1562 {
return *
this = interface_.
read(); }
1565 {
return *
this = port_->read(); }
1568 {
return *
this = port_->read(); }
1571 {
return *
this = port_->read(); }
1579 { initialize( interface_.
read() ); }
1594 ( m_change_finder_p, *
this, &in_if_type::value_changed_event );
1598 {
return "sc_inout"; }
1709 using base_type::operator=;
1714 {
return "sc_out"; }
1751 const std::string& name )
1767#if defined(_MSC_VER) && !defined(SC_WIN_DLL_WARN)
#define SC_API_TEMPLATE_DECL_
std::vector< sc_trace_params * > sc_trace_params_vec
inline::std::ostream & operator<<(::std::ostream &os, const sc_fifo< T > &a)
void sc_trace(sc_trace_file *tf, const sc_in< T > &port, const std::string &name)
sc_simcontext * sc_get_curr_simcontext()
SC_API void sc_deprecated_add_trace()
static sc_event_finder & cached_create(sc_event_finder *&cache_p, const sc_port_base &port_, const sc_event &(IF::*ef_p)() const)
void bind(sc_interface &interface_)
virtual int vbind(sc_interface &)
const IF * get_interface(int iface_i) const
virtual const sc_event & value_changed_event() const =0
virtual const T & read() const =0
virtual void write(const T &)=0
sc_trace_params(sc_trace_file *tf_, const std::string &name_)
virtual int vbind(sc_port_base &)
sc_in(this_type &parent_)
void remove_traces() const
void add_trace_internal(sc_trace_file *, const std::string &) const
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
const data_type & read() const
virtual void bind(inout_port_type &parent_)
base_type::port_type base_port_type
virtual int vbind(sc_interface &)
sc_signal_inout_if< data_type > inout_if_type
sc_in(const char *name_, inout_port_type &parent_)
void add_trace(sc_trace_file *, const std::string &) const
virtual const char * kind() const
virtual void bind(in_port_type &parent_)
sc_signal_in_if< data_type > if_type
virtual void bind(base_port_type &parent_)
sc_in(const in_if_type &interface_)
sc_in(in_port_type &parent_)
sc_in(const char *name_, this_type &parent_)
const sc_event & value_changed_event() const
sc_in< data_type > this_type
const sc_event & default_event() const
sc_in(const char *name_, const in_if_type &interface_)
void operator()(const in_if_type &interface_)
virtual void bind(const in_if_type &interface_)
sc_port< inout_if_type, 1, SC_ONE_OR_MORE_BOUND > inout_port_type
sc_in(const char *name_, in_port_type &parent_)
sc_trace_params_vec * m_traces
virtual void end_of_elaboration()
sc_in(inout_port_type &parent_)
virtual void bind(in_if_type &interface_)
sc_event_finder & value_changed() const
const sc_event & default_event() const
base_type::port_type base_port_type
const sc_event & posedge_event() const
virtual void bind(in_if_type &interface_)
virtual void end_of_elaboration()
virtual const char * kind() const
sc_event_finder & value_changed() const
virtual void bind(base_port_type &parent_)
sc_in(const in_if_type &interface_)
sc_in(const char *name_, this_type &parent_)
sc_in(const char *name_, const in_if_type &interface_)
sc_signal_inout_if< data_type > inout_if_type
virtual int vbind(sc_interface &)
const sc_event & value_changed_event() const
void add_trace_internal(sc_trace_file *, const std::string &) const
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
const sc_event & negedge_event() const
sc_in< data_type > this_type
void add_trace(sc_trace_file *, const std::string &) const
sc_in(const char *name_, in_port_type &parent_)
sc_trace_params_vec * m_traces
sc_port< inout_if_type, 1, SC_ONE_OR_MORE_BOUND > inout_port_type
sc_in(inout_port_type &parent_)
virtual void bind(const in_if_type &interface_)
sc_in(this_type &parent_)
sc_event_finder & pos() const
const data_type & read() const
virtual void bind(in_port_type &parent_)
sc_signal_in_if< data_type > if_type
sc_event_finder & neg() const
virtual int vbind(sc_port_base &)
virtual void bind(inout_port_type &parent_)
void remove_traces() const
sc_in(const char *name_, inout_port_type &parent_)
sc_in(in_port_type &parent_)
virtual void bind(in_port_type &parent_)
sc_signal_in_if< data_type > if_type
const sc_event & posedge_event() const
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
base_type::port_type base_port_type
sc_in(inout_port_type &parent_)
sc_in(in_port_type &parent_)
virtual void bind(in_if_type &interface_)
sc_in< data_type > this_type
virtual int vbind(sc_interface &)
sc_dt::sc_logic data_type
sc_in(const char *name_, const in_if_type &interface_)
virtual int vbind(sc_port_base &)
const sc_event & default_event() const
void add_trace(sc_trace_file *, const std::string &) const
const data_type & read() const
virtual const char * kind() const
sc_event_finder & value_changed() const
sc_signal_inout_if< data_type > inout_if_type
sc_trace_params_vec * m_traces
const sc_event & negedge_event() const
sc_in(this_type &parent_)
sc_port< inout_if_type, 1, SC_ONE_OR_MORE_BOUND > inout_port_type
virtual void bind(base_port_type &parent_)
sc_in(const char *name_, in_port_type &parent_)
sc_in(const char *name_, this_type &parent_)
sc_in(const in_if_type &interface_)
void remove_traces() const
sc_in(const char *name_, inout_port_type &parent_)
virtual void bind(inout_port_type &parent_)
void add_trace_internal(sc_trace_file *, const std::string &) const
virtual void end_of_elaboration()
const sc_event & value_changed_event() const
virtual void bind(const in_if_type &interface_)
sc_event_finder & pos() const
sc_event_finder & neg() const
virtual const char * kind() const
void remove_traces() const
const sc_event & value_changed_event() const
sc_signal_inout_if< data_type > if_type
sc_inout(const char *name_, this_type &parent_)
base_type inout_port_type
sc_port< in_if_type, 1, SC_ONE_OR_MORE_BOUND > in_port_type
void add_trace_internal(sc_trace_file *, const std::string &) const
sc_inout(inout_port_type &parent_)
sc_trace_params_vec * m_traces
sc_event_finder & value_changed() const
const data_type & read() const
sc_inout(this_type &parent_)
void add_trace(sc_trace_file *, const std::string &) const
const sc_event & default_event() const
sc_inout(inout_if_type &interface_)
void initialize(const in_if_type &interface_)
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_inout(const char *name_, inout_port_type &parent_)
void write(const data_type &value_)
virtual void end_of_elaboration()
sc_inout< data_type > this_type
sc_signal_in_if< data_type > in_if_type
sc_inout(const char *name_, inout_if_type &interface_)
this_type & operator=(const data_type &value_)
sc_inout(const char *name_)
void initialize(const data_type &value_)
sc_inout(this_type &parent_)
void write(const data_type &value_)
const sc_event & posedge_event() const
const sc_event & value_changed_event() const
sc_inout(const char *name_, inout_if_type &interface_)
sc_inout(const char *name_)
const sc_event & negedge_event() const
sc_inout(inout_port_type &parent_)
sc_port< in_if_type, 1, SC_ONE_OR_MORE_BOUND > in_port_type
sc_event_finder & neg() const
const sc_event & default_event() const
sc_signal_in_if< data_type > in_if_type
void add_trace(sc_trace_file *, const std::string &) const
sc_inout(inout_if_type &interface_)
sc_event_finder & pos() const
sc_event_finder & value_changed() const
void initialize(const in_if_type &interface_)
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_signal_inout_if< data_type > if_type
sc_inout(const char *name_, this_type &parent_)
const data_type & read() const
void remove_traces() const
virtual const char * kind() const
virtual void end_of_elaboration()
void initialize(const data_type &value_)
sc_inout< data_type > this_type
sc_inout(const char *name_, inout_port_type &parent_)
base_type inout_port_type
sc_trace_params_vec * m_traces
void add_trace_internal(sc_trace_file *, const std::string &) const
void remove_traces() const
sc_inout(this_type &parent_)
virtual const char * kind() const
sc_event_finder & neg() const
sc_inout(const char *name_)
sc_inout(const char *name_, inout_if_type &interface_)
sc_dt::sc_logic data_type
const sc_event & default_event() const
sc_signal_in_if< data_type > in_if_type
void write(const data_type &value_)
const data_type & read() const
virtual void end_of_elaboration()
sc_event_finder & value_changed() const
sc_inout(inout_port_type &parent_)
void initialize(const data_type &value_)
sc_port< in_if_type, 1, SC_ONE_OR_MORE_BOUND > in_port_type
sc_inout< data_type > this_type
const sc_event & value_changed_event() const
base_type inout_port_type
void add_trace_internal(sc_trace_file *, const std::string &) const
void initialize(const in_if_type &interface_)
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_trace_params_vec * m_traces
void add_trace(sc_trace_file *, const std::string &) const
sc_inout(inout_if_type &interface_)
sc_inout(const char *name_, inout_port_type &parent_)
sc_event_finder & pos() const
const sc_event & negedge_event() const
sc_signal_inout_if< data_type > if_type
sc_inout(const char *name_, this_type &parent_)
const sc_event & posedge_event() const
base_type::inout_port_type inout_port_type
sc_out(const char *name_, inout_if_type &interface_)
base_type::in_if_type in_if_type
sc_out< data_type > this_type
base_type::inout_if_type inout_if_type
sc_out(inout_port_type &parent_)
sc_out(inout_if_type &interface_)
base_type::in_port_type in_port_type
virtual const char * kind() const
sc_out(this_type &parent_)
this_type & operator=(const this_type &port_)
sc_out(const char *name_, inout_port_type &parent_)
sc_inout< data_type > base_type
sc_out(const char *name_, this_type &parent_)
sc_out(const char *name_)