📄 sc_indexed_port_impl.h
字号:
public virtual sc_port< sc_indexed_inoutmaster_if<T> >{public: typedef sc_indexed_master_base<N > base_type; typedef sc_indexed_inoutmaster_port_impl<T,N> this_type; typedef sc_indexed_inoutmaster_if<T> if_type; void bind( if_type& link ) { sc_port_base::bind( static_cast<sc_interface&>( link ) ); } void bind( this_type& other ) { sc_port_base::bind( static_cast<sc_port_base&>( other ) ); } void operator( ) ( if_type& link ) { bind( link); } void operator( ) ( this_type& other ) { bind( other); } const T& read( ) { if_type* link = get_ms_interface( ); return link->read_inoutmaster( ); } void write( const T& data ) { if_type* link = get_ms_interface( ); link->write_inoutmaster( data ); } operator const T& ( ) { return read( ); }; this_type& operator [ ] (uint64 i ) { // used by indexed ports set_address( i ); return *this; } this_type& operator = ( const T& data ) { write( data ); return *this; }public: uint64 get_address( ) { return get_ms_interface( )->get_address( ); } virtual void set_address( uint64 i ) { check_address( i ); get_ms_interface( )->set_address( i ); }public: if_type* get_ms_interface( ) { return (*this).operator->( ); }protected: virtual const char* get_name( ) { return name( ); }};////////////////////////////////////////////////////////////////////// slave port interface//------------------------------------------------------------------template<class T, uint64 N> class sc_indexed_slave_port_impl : public virtual sc_indexed_slave_base<N >, public virtual sc_port< sc_indexed_slave_if<T> >{public: typedef sc_indexed_slave_port_impl<T,N> this_type; typedef sc_indexed_slave_if<T> if_type; void bind( if_type& link ) { sc_port_base::bind( static_cast<sc_interface&>( link ) ); } void bind( this_type& other ) { sc_port_base::bind( static_cast<sc_port_base&>( other ) ); } void operator( ) ( if_type& link ) { bind( link); } void operator( ) ( this_type& other ) { bind( other); } virtual void end_of_elaboration( ) { if_type* alink = get_ms_interface( ); alink->add_slave_proc ( m_slave_procs ); }public: uint64 get_address( ) { return get_ms_interface( )->get_address( ); } virtual void set_address( uint64 i ) { check_address( i ); get_ms_interface( )->set_address( i ); }public: if_type* get_ms_interface( ) { return (*this).operator->( ); }protected: virtual const char* get_name( ) { return name( ); }};//------------------------------------------------------------------template<class T, uint64 N> class sc_indexed_inslave_port_impl : public virtual sc_indexed_slave_base<N >, public virtual sc_master_slave_read_if< T >, public virtual sc_port< sc_indexed_inslave_if<T> >{public: typedef sc_indexed_inslave_port_impl<T,N> this_type; typedef sc_indexed_inslave_if<T> if_type; void bind( if_type& link ) { sc_port_base::bind( static_cast<sc_interface&>( link ) ); } void bind( this_type& other ) { sc_port_base::bind( static_cast<sc_port_base&>( other ) ); } virtual void bind( sc_indexed_inoutslave_port_impl<T,N>& other ) { sc_port_base::bind( static_cast<sc_port_base&>( other ) ); } void operator( ) ( if_type& link ) { bind( link); } void operator( ) ( this_type& other ) { bind( other); } void operator( ) ( sc_indexed_outslave_port_impl<T,N>& other ) { bind( other ); } virtual void end_of_elaboration( ) { if_type* alink = get_ms_interface( ); alink->add_inslave_proc ( m_slave_procs ); } const T& read( ) { if_type* link = get_ms_interface( ); return link->read( ); } operator const T& ( ) { return read( ); };public: uint64 get_address( ) { return get_ms_interface( )->get_address( ); } virtual void set_address( uint64 i ) { check_address( i ); get_ms_interface( )->set_address( i ); }public: if_type* get_ms_interface( ) { return (*this).operator->( ); }protected: virtual const char* get_name( ) { return name( ); }};//------------------------------------------------------------------template<class T, uint64 N> class sc_indexed_outslave_port_impl : public sc_indexed_slave_base<N >, public virtual sc_master_slave_write_if< T >, public virtual sc_port< sc_indexed_outslave_if<T> >{public: typedef sc_indexed_outslave_port_impl<T,N> this_type; typedef sc_indexed_outslave_if<T> if_type; void bind( if_type& link ) { sc_port_base::bind( static_cast<sc_interface&>( link ) ); } void bind( this_type& other ) { sc_port_base::bind( static_cast<sc_port_base&>( other ) ); } virtual void bind( sc_indexed_inoutslave_port_impl<T,N>& other ) { sc_port_base::bind( static_cast<sc_port_base&>( other ) ); } void operator( ) ( if_type& link ) { bind( link); } void operator( ) ( this_type& other ) { bind( other); } void operator( ) ( sc_indexed_inoutslave_port_impl<T,N>& other ) { bind( other ); } virtual void end_of_elaboration( ) { if_type* alink = get_ms_interface( ); alink->add_outslave_proc ( m_slave_procs ); } void write( const T& data ) { if_type* link = get_ms_interface( ); link->write( data ); }public: uint64 get_address( ) { return get_ms_interface( )->get_address( ); } virtual void set_address( uint64 i ) { check_address( i ); get_ms_interface( )->set_address( i ); }public: if_type* get_ms_interface( ) { return (*this).operator->( ); }protected: virtual const char* get_name( ) { return name( ); }};//------------------------------------------------------------------template<class T, uint64 N> class sc_indexed_inoutslave_port_impl : public virtual sc_indexed_slave_base<N >, public virtual sc_master_slave_read_write_if< T >, public virtual sc_port< sc_indexed_inoutslave_if<T> >{public: typedef sc_indexed_inoutslave_port_impl<T,N> this_type; typedef sc_indexed_inoutslave_if<T> if_type; void bind( if_type& link ) { sc_port_base::bind( static_cast<sc_interface&>( link ) ); } void bind( this_type& other ) { sc_port_base::bind( static_cast<sc_port_base&>( other ) ); } void operator( ) ( if_type& link ) { bind( link); } void operator( ) ( this_type& other ) { bind( other); } virtual void end_of_elaboration( ) { if_type* alink = get_ms_interface( ); alink->add_inoutslave_proc( m_slave_procs ); } const T& read( ) { if_type* link = get_ms_interface( ); return link->read( ); } void write( const T& data ) { if_type* link = get_ms_interface( ); link->write( data ); } operator const T& ( ) { return read( ); }; bool input( ) { return get_ms_interface( )->input( ); }public: uint64 get_address( ) { return get_ms_interface( )->get_address( ); } virtual void set_address( uint64 i ) { check_address( i ); get_ms_interface( )->set_address( i ); }public: if_type* get_ms_interface( ) { return (*this).operator->( ); }protected: virtual const char* get_name( ) { return name( ); }};#endif // SC_INDEXED_IF_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -