SystemC-sc_interface
点击数:7968 次 录入时间:03-04 11:47:46 整理:http://www.55dianzi.com 电脑-单片机-自动控制
类sc_interface是所有接口类的父类,所有其它类都直接或者间接的从类sc_interface继承而来。类sc_interface的部分源代码如下:
- //sc_interface.h
- #ifndef SC_INTERFACE_H
- #define SC_INTERFACE_H
- class sc_interface
- {
- publIC:
- // 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:
- // dISAbLED
- sc_interface( const sc_interface& );
- sc_interface& operator = ( const sc_interface& );
- private:
- static sc_event m_never_notified;
- };
- #endif
-
- //sc_interface.h
- include "systEMC/communication/sc_interface.h"
- #include "systEMC/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 )用于产生警告信息。
本文关键字:暂无联系方式电脑-单片机-自动控制,电子学习 - 基础知识 - 电脑-单片机-自动控制