27 #ifndef SC_SIGNAL_PORTS_H
28 #define SC_SIGNAL_PORTS_H
40 #if ! defined( SC_DISABLE_VIRTUAL_BIND )
41 # define SC_VIRTUAL_ virtual
81 :
public sc_port<sc_signal_in_if<T>,1,SC_ONE_OR_MORE_BOUND>
162 delete m_change_finder_p;
172 { this->
bind( CCAST<const in_if_type&>( interface_ ) ); }
175 { this->
bind( interface_ ); }
184 { this->
bind( parent_ ); }
193 { this->
bind( parent_ ); }
201 {
return (*this)->default_event(); }
207 {
return (*this)->value_changed_event(); }
213 {
return (*this)->read(); }
216 {
return (*this)->read(); }
222 {
return (*this)->event(); }
232 if ( !m_change_finder_p )
237 return *m_change_finder_p;
248 virtual const char*
kind()
const
303 ::std::ostream& operator << ( ::std::ostream& os, const sc_in<T>& a )
305 return os << a->read();
318 if( m_traces != 0 ) {
319 for(
int i = 0; i < (int)m_traces->size(); ++ i ) {
321 in_if_type* iface = DCAST<in_if_type*>( this->get_interface() );
338 if( m_traces == 0 ) {
352 add_trace_internal(tf_, name_);
360 if( m_traces != 0 ) {
361 for(
int i = (
int)m_traces->size() - 1; i >= 0; -- i ) {
362 delete (*m_traces)[i];
385 in_port_type* in_parent = DCAST<in_port_type*>( &parent_ );
386 if( in_parent != 0 ) {
391 if( inout_parent != 0 ) {
408 public sc_port<sc_signal_in_if<bool>,1,SC_ONE_OR_MORE_BOUND>
432 m_neg_finder_p(0), m_pos_finder_p(0)
437 m_neg_finder_p(0), m_pos_finder_p(0)
442 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
447 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
452 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
457 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
462 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
468 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
474 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
480 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
486 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
496 delete m_change_finder_p;
497 delete m_neg_finder_p;
498 delete m_pos_finder_p;
508 { this->
bind( CCAST<const in_if_type&>( interface_ ) ); }
511 { this->
bind( interface_ ); }
520 { this->
bind( parent_ ); }
529 { this->
bind( parent_ ); }
537 {
return (*this)->default_event(); }
543 {
return (*this)->value_changed_event(); }
548 {
return (*this)->posedge_event(); }
553 {
return (*this)->negedge_event(); }
559 {
return (*this)->read(); }
562 {
return (*this)->read(); }
572 if ( !m_pos_finder_p )
575 *
this, &in_if_type::posedge_event );
577 return *m_pos_finder_p;
588 if ( !m_neg_finder_p )
591 *
this, &in_if_type::negedge_event );
593 return *m_neg_finder_p;
601 {
return (*this)->event(); }
606 {
return (*this)->posedge(); }
611 {
return (*this)->negedge(); }
620 if ( !m_change_finder_p )
625 return *m_change_finder_p;
636 virtual const char*
kind()
const
703 :
public sc_port<sc_signal_in_if<sc_dt::sc_logic>,1,SC_ONE_OR_MORE_BOUND>
727 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
732 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
737 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
742 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
747 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
752 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
757 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
763 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
769 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
774 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
784 delete m_change_finder_p;
785 delete m_neg_finder_p;
786 delete m_pos_finder_p;
796 { this->
bind( CCAST<const in_if_type&>( interface_ ) ); }
799 { this->
bind( interface_ ); }
808 { this->
bind( parent_ ); }
817 { this->
bind( parent_ ); }
825 {
return (*this)->default_event(); }
831 {
return (*this)->value_changed_event(); }
836 {
return (*this)->posedge_event(); }
841 {
return (*this)->negedge_event(); }
847 {
return (*this)->read(); }
850 {
return (*this)->read(); }
860 if ( !m_pos_finder_p )
863 *
this, &in_if_type::posedge_event );
865 return *m_pos_finder_p;
876 if ( !m_neg_finder_p )
879 *
this, &in_if_type::negedge_event );
881 return *m_neg_finder_p;
889 {
return (*this)->event(); }
894 {
return (*this)->posedge(); }
899 {
return (*this)->negedge(); }
908 if ( !m_change_finder_p )
913 return *m_change_finder_p;
924 virtual const char*
kind()
const
988 :
public sc_port<sc_signal_inout_if<T>,1,SC_ONE_OR_MORE_BOUND>
1011 m_change_finder_p(0)
1016 m_change_finder_p(0)
1021 m_change_finder_p(0)
1026 m_change_finder_p(0)
1031 m_change_finder_p(0)
1036 m_change_finder_p(0)
1041 m_change_finder_p(0)
1046 m_change_finder_p(0)
1060 {
return (*this)->default_event(); }
1066 {
return (*this)->value_changed_event(); }
1072 {
return (*this)->read(); }
1075 {
return (*this)->read(); }
1081 {
return (*this)->event(); }
1087 { (*this)->write( value_ ); }
1090 { (*this)->
write( value_ );
return *
this; }
1093 { (*this)->
write( interface_.
read() );
return *
this; }
1096 { (*this)->
write( port_->read() );
return *
this; }
1099 { (*this)->
write( port_->read() );
return *
this; }
1102 { (*this)->
write( port_->read() );
return *
this; }
1127 if ( !m_change_finder_p )
1132 return *m_change_finder_p;
1137 {
return "sc_inout"; }
1179 template<
typename T>
1180 ::std::ostream& operator << ( ::std::ostream& os, const sc_inout<T>& a )
1182 return os << a->read();
1195 delete m_change_finder_p;
1208 inout_if_type* iface = DCAST<inout_if_type*>( this->get_interface() );
1210 iface->
write( value_ );
1212 if( m_init_val == 0 ) {
1215 *m_init_val = value_;
1227 if( m_init_val != 0 ) {
1228 write( *m_init_val );
1232 if( m_traces != 0 ) {
1233 for(
int i = 0; i < (int)m_traces->size(); ++ i ) {
1235 in_if_type* iface = DCAST<in_if_type*>( this->get_interface() );
1252 if( m_traces == 0 ) {
1265 add_trace_internal(tf_, name_);
1273 if( m_traces != 0 ) {
1274 for(
int i = m_traces->size() - 1; i >= 0; -- i ) {
1275 delete (*m_traces)[i];
1291 public sc_port<sc_signal_inout_if<bool>,1,SC_ONE_OR_MORE_BOUND>
1314 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1319 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1324 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1329 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1334 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1339 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1344 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1349 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1363 {
return (*this)->default_event(); }
1369 {
return (*this)->value_changed_event(); }
1374 {
return (*this)->posedge_event(); }
1379 {
return (*this)->negedge_event(); }
1385 {
return (*this)->read(); }
1388 {
return (*this)->read(); }
1398 if ( !m_pos_finder_p )
1401 *
this, &in_if_type::posedge_event );
1403 return *m_pos_finder_p;
1414 if ( !m_neg_finder_p )
1417 *
this, &in_if_type::negedge_event );
1419 return *m_neg_finder_p;
1427 {
return (*this)->event(); }
1432 {
return (*this)->posedge(); }
1437 {
return (*this)->negedge(); }
1442 { (*this)->write( value_ ); }
1445 { (*this)->
write( value_ );
return *
this; }
1448 { (*this)->
write( interface_.
read() );
return *
this; }
1451 { (*this)->
write( port_->read() );
return *
this; }
1454 { (*this)->
write( port_->read() );
return *
this; }
1457 { (*this)->
write( port_->read() );
return *
this; }
1482 if ( !m_change_finder_p )
1487 return *m_change_finder_p;
1492 {
return "sc_inout"; }
1545 :
public sc_port<sc_signal_inout_if<sc_dt::sc_logic>,1,SC_ONE_OR_MORE_BOUND>
1568 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1573 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1578 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1583 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1588 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1593 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1598 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1603 m_change_finder_p(0), m_neg_finder_p(0), m_pos_finder_p(0)
1617 {
return (*this)->default_event(); }
1623 {
return (*this)->value_changed_event(); }
1628 {
return (*this)->posedge_event(); }
1633 {
return (*this)->negedge_event(); }
1639 {
return (*this)->read(); }
1642 {
return (*this)->read(); }
1652 if ( !m_pos_finder_p )
1655 *
this, &in_if_type::posedge_event );
1657 return *m_pos_finder_p;
1668 if ( !m_neg_finder_p )
1671 *
this, &in_if_type::negedge_event );
1673 return *m_neg_finder_p;
1681 {
return (*this)->event(); }
1686 {
return (*this)->posedge(); }
1691 {
return (*this)->negedge(); }
1696 { (*this)->write( value_ ); }
1699 { (*this)->
write( value_ );
return *
this; }
1702 { (*this)->
write( interface_.
read() );
return *
this; }
1705 { (*this)->
write( port_->read() );
return *
this; }
1708 { (*this)->
write( port_->read() );
return *
this; }
1711 { (*this)->
write( port_->read() );
return *
this; }
1736 if ( !m_change_finder_p )
1741 return *m_change_finder_p;
1746 {
return "sc_inout"; }
1864 { (*this)->
write( value_ );
return *
this; }
1867 { (*this)->
write( interface_.
read() );
return *
this; }
1870 { (*this)->
write( port_->read() );
return *
this; }
1873 { (*this)->
write( port_->read() );
return *
this; }
1876 { (*this)->
write( port_->read() );
return *
this; }
1879 {
return "sc_out"; }
1903 iface = DCAST<const sc_signal_in_if<T>*>( port.get_interface() );
1907 sc_trace( tf, iface->read(), name );
1909 port.add_trace_internal( tf, name );
1916 const std::string& name )
1921 iface =DCAST<const sc_signal_in_if<T>*>( port.get_interface() );
1925 sc_trace( tf, iface->read(), name );
1927 port.add_trace_internal( tf, name );
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
virtual void end_of_elaboration()
void write(const data_type &value_)
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_trace_params(sc_trace_file *tf_, const std::string &name_)
SC_VIRTUAL_ void bind(const in_if_type &interface_)
sc_trace_params_vec * m_traces
sc_inout< data_type > this_type
sc_event_finder & value_changed() const
virtual int vbind(sc_interface &)
sc_event_finder & value_changed() const
SC_VIRTUAL_ void bind(in_if_type &interface_)
SC_VIRTUAL_ void bind(in_if_type &interface_)
sc_signal_inout_if< data_type > inout_if_type
SC_VIRTUAL_ void bind(inout_port_type &parent_)
sc_in(const char *name_, const in_if_type &interface_)
std::vector< sc_trace_params * > sc_trace_params_vec
sc_signal_inout_if< data_type > if_type
sc_in< data_type > this_type
sc_in(const char *name_, inout_port_type &parent_)
sc_out(inout_if_type &interface_)
const sc_event & posedge_event() const
sc_inout(this_type &parent_)
this_type & operator=(const data_type &value_)
sc_port< in_if_type, 1, SC_ONE_OR_MORE_BOUND > in_port_type
const data_type & read() const
this_type & operator=(const data_type &value_)
base_type inout_port_type
sc_event_finder & neg() const
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_out(const char *name_, this_type &parent_)
SC_VIRTUAL_ void bind(in_port_type &parent_)
sc_signal_in_if< data_type > if_type
void remove_traces() const
const sc_event & value_changed_event() const
void write(const data_type &value_)
base_type::port_type base_port_type
SC_VIRTUAL_ void bind(inout_port_type &parent_)
sc_out(this_type &parent_)
base_type inout_port_type
const data_type & read() const
sc_inout(const char *name_, inout_if_type &interface_)
sc_inout(inout_port_type &parent_)
sc_in(this_type &parent_)
sc_inout(const char *name_, this_type &parent_)
sc_out(const char *name_, inout_port_type &parent_)
sc_inout< data_type > this_type
sc_inout(const char *name_, inout_port_type &parent_)
const sc_event & default_event() const
sc_inout(inout_if_type &interface_)
sc_signal_in_if< data_type > if_type
sc_out(const char *name_, inout_if_type &interface_)
const sc_event & negedge_event() const
void add_trace(sc_trace_file *, const std::string &) const
sc_in(const char *name_, in_port_type &parent_)
sc_in(const char *name_, this_type &parent_)
sc_in(this_type &parent_)
Generic port class and base class for other port classes.
sc_in(const char *name_, this_type &parent_)
sc_event_finder & pos() const
sc_inout(const char *name_, inout_port_type &parent_)
sc_in(const char *name_, const in_if_type &interface_)
virtual const char * kind() const
const sc_event & negedge_event() const
base_type::port_type base_port_type
const sc_event & default_event() const
const sc_event & default_event() const
virtual const char * kind() const
sc_inout< data_type > base_type
const data_type & read() const
The sc_signal<T> input port class.
void initialize(const in_if_type &interface_)
sc_trace_params_vec * m_traces
base_type::port_type base_port_type
sc_port< inout_if_type, 1, SC_ONE_OR_MORE_BOUND > inout_port_type
virtual const sc_event & value_changed_event() const =0
virtual void end_of_elaboration()
sc_in(const in_if_type &interface_)
SC_VIRTUAL_ void bind(inout_port_type &parent_)
base_type inout_port_type
sc_inout(const char *name_, this_type &parent_)
const sc_event & value_changed_event() const
virtual const char * kind() const
const sc_event & default_event() const
sc_in< data_type > this_type
sc_inout(const char *name_, inout_port_type &parent_)
sc_inout(const char *name_)
SC_VIRTUAL_ void bind(in_port_type &parent_)
const sc_event & value_changed_event() const
sc_inout(this_type &parent_)
sc_inout(const char *name_, inout_if_type &interface_)
sc_inout(inout_if_type &interface_)
sc_inout(inout_port_type &parent_)
The sc_signal<T> input/output port class.
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_signal_inout_if< data_type > inout_if_type
base_type::in_port_type in_port_type
The sc_signal<T> input interface class.
const sc_event & posedge_event() const
sc_in(const in_if_type &interface_)
SC_VIRTUAL_ void bind(in_if_type &interface_)
sc_port< inout_if_type, 1, SC_ONE_OR_MORE_BOUND > inout_port_type
base_type::inout_if_type inout_if_type
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_port< in_if_type, 1, SC_ONE_OR_MORE_BOUND > in_port_type
sc_in(const in_if_type &interface_)
sc_signal_inout_if< data_type > if_type
sc_port< if_type, 1, SC_ONE_OR_MORE_BOUND > base_type
sc_in(const char *name_, this_type &parent_)
const data_type & read() const
sc_event_finder & pos() const
const sc_event & value_changed_event() const
sc_event_finder & value_changed() const
sc_event_finder & value_changed() const
sc_in(inout_port_type &parent_)
sc_in(const char *name_, const in_if_type &interface_)
sc_inout(inout_if_type &interface_)
const sc_event & value_changed_event() const
virtual int vbind(sc_interface &)
sc_inout(const char *name_, this_type &parent_)
const sc_event & value_changed_event() const
sc_inout< data_type > this_type
sc_out(const char *name_)
void add_trace_internal(sc_trace_file *, const std::string &) const
sc_dt::sc_logic data_type
sc_event_finder & pos() const
SC_VIRTUAL_ void bind(base_port_type &parent_)
sc_port< inout_if_type, 1, SC_ONE_OR_MORE_BOUND > inout_port_type
SC_VIRTUAL_ void bind(const in_if_type &interface_)
const data_type & read() const
sc_in(this_type &parent_)
Abstract base class of all interface classes.
#define CHNL_MTX_INIT_(Mutex)
sc_in(in_port_type &parent_)
sc_trace_params_vec * m_traces
const data_type & read() const
sc_in< data_type > this_type
sc_out< data_type > this_type
sc_dt::sc_logic data_type
void add_trace(sc_trace_file *, const std::string &) const
virtual sc_interface * get_interface()
SC_VIRTUAL_ void bind(const in_if_type &interface_)
const sc_event & posedge_event() const
sc_trace_params_vec * m_traces
sc_inout(inout_port_type &parent_)
Abstract base class for class sc_port_b.
#define CHNL_MTX_DESTROY_(Mutex)
void initialize(const in_if_type &interface_)
sc_in(in_port_type &parent_)
void operator()(const in_if_type &interface_)
virtual const char * kind() const
virtual const char * kind() const
sc_event_finder & value_changed() const
sc_event_finder & pos() const
sc_signal_in_if< data_type > in_if_type
const sc_event & default_event() const
sc_in(inout_port_type &parent_)
Struct for storing the trace file and object name of an sc_trace call.
void bind(sc_interface &interface_)
sc_in(in_port_type &parent_)
sc_in(const char *name_, inout_port_type &parent_)
void write(const data_type &value_)
const sc_event & negedge_event() const
const sc_event & posedge_event() const
sc_inout(this_type &parent_)
sc_in(const char *name_, inout_port_type &parent_)
const sc_event & negedge_event() const
sc_inout(const char *name_, inout_if_type &interface_)
void sc_deprecated_add_trace()
sc_simcontext * sc_get_curr_simcontext()
void initialize(const in_if_type &interface_)
base_type::in_if_type in_if_type
void add_trace_internal(sc_trace_file *, const std::string &) const
sc_event_finder & neg() const
sc_event_finder & neg() const
sc_trace_params_vec * m_traces
virtual const char * kind() const
sc_signal_inout_if< data_type > inout_if_type
sc_event_finder & neg() const
sc_out(inout_port_type &parent_)
sc_port< in_if_type, 1, SC_ONE_OR_MORE_BOUND > in_port_type
virtual const char * kind() const
void initialize(const data_type &value_)
void sc_trace(sc_trace_file *tf, const sc_in< T > &port, const std::string &name)
sc_trace_params_vec * m_traces
sc_signal_in_if< data_type > in_if_type
sc_inout(const char *name_)
base_type::inout_port_type inout_port_type
sc_signal_in_if< data_type > if_type
SC_VIRTUAL_ void bind(base_port_type &parent_)
sc_event_finder & value_changed() const
sc_inout(const char *name_)
sc_in(const char *name_, in_port_type &parent_)
The chnl_scoped_lock class to lock (and automatically release) a mutex.
sc_signal_inout_if< data_type > if_type
void remove_traces() const
virtual void write(const T &)=0
virtual const T & read() const =0
const sc_event & default_event() const
SC_VIRTUAL_ void bind(base_port_type &parent_)
SC_VIRTUAL_ void bind(in_port_type &parent_)
sc_in(const char *name_, in_port_type &parent_)
sc_in(inout_port_type &parent_)
sc_signal_in_if< data_type > in_if_type