SystemC-sc_interface
类sc_interface是所有接口类的父类,所有其它类都直接或者间接的从类sc_interface继承而来。类sc_interface的部分源代码如下:
- //sc_interface.h
- #ifndef SC_INTERFACE_H
- #define SC_INTERFACE_H
- class sc_interface
- {
- publ:
- // register a port with this interface (does nothing by default)
- virtual void register_port( sc_port_base& port_,
- const char* if_typename_ );
- // get the default event
- virtual const sc_event& default_event() const;
- // destructor (does nothing)
- virtual ~sc_interface();
- protected:
- // constructor (does nothing)
- sc_interface();
- private:
- // db
- sc_interface( const sc_interface& );
- sc_interface& operator = ( const sc_interface& );
- private:
- static sc_event m_never_notified;
- };
- #endif
- //sc_interface.h
- include "syst/communication/sc_interface.h"
- #include "syst/communication/sc_communication_ids.h"
- #include "systemc/kernel/sc_event.h"
- // ----------------------------------------------------------------------------
- // CLASS : sc_interface
- // Abstract base class of all interface classes.
- // BEWARE: Direct inheritance from this class must be done virtual.
- // ----------------------------------------------------------------------------
- // register a port with this interface (does nothing by default)
- void sc_interface::register_port( sc_port_base&, const char* ){}
- // get the default event
- const sc_event&
- sc_interface::default_event() const
- {
- SC_REPORT_WARNING( SC_ID_NO_DEFAULT_EVENT_, 0 );
- return m_never_notified;
- }
- // destructor (does nothing)
- sc_interface::~sc_interface(){}
- // constructor (does nothing)
- sc_interface::sc_interface(){}
- sc_event sc_interface::m_never_notified;
方法register_port( sc_port_base& port_, const char* if_typename_ )完成通道绑定(Bind)时的静态规则检查。port_是接口所连接的端口名,if_typename_是接口名。缺省的情况下这个函数不做任何事情。
通道可以使用default_event()来返回静态敏感表的缺省事件。default_event()中调用的
SC_REPORT_WARNING( SC_ID_NO_DEFAULT_EVENT_, 0 )用于产生警告信息。
- 上一篇:SystemC-sc_port
- 下一篇:SystemC-存储器接口实例