您当前的位置:五五电子网电子知识电子学习基础知识电脑-单片机-自动控制SystemC-sc_interface 正文
SystemC-sc_interface

SystemC-sc_interface

点击数:7968 次   录入时间:03-04 11:47:46   整理:http://www.55dianzi.com   电脑-单片机-自动控制

      类sc_interface是所有接口类的父类,所有其它类都直接或者间接的从类sc_interface继承而来。类sc_interface的部分源代码如下:

  1. //sc_interface.h  
  2. #ifndef SC_INTERFACE_H  
  3. #define SC_INTERFACE_H  
  4. class sc_interface  
  5. {  
  6. publIC:  
  7.     // register a port with this interface (does nothing by default)  
  8.     virtual void register_port( sc_port_base& port_,  
  9.     const char*    if_typename_ );  
  10.     // get the default event  
  11.     virtual const sc_event& default_event() const;  
  12.     // destructor (does nothing)  
  13.     virtual ~sc_interface();  
  14. protected:  
  15.     // constructor (does nothing)  
  16.     sc_interface();  
  17. private:  
  18.    // dISAbLED  
  19.     sc_interface( const sc_interface& );  
  20.     sc_interface& operator = ( const sc_interface& );  
  21. private:  
  22.     static sc_event m_never_notified;  
  23. };  
  24. #endif   
  25.  
  26. //sc_interface.h  
  27. include "systEMC/communication/sc_interface.h" 
  28. #include "systEMC/communication/sc_communication_ids.h"  
  29. #include "systemc/kernel/sc_event.h"   
  30.  
  31. // ----------------------------------------------------------------------------  
  32. //  CLASS : sc_interface  
  33. //  Abstract base class of all interface classes.  
  34. //  BEWARE: Direct inheritance from this class must be done virtual.  
  35. // ----------------------------------------------------------------------------   
  36.  
  37. // register a port with this interface (does nothing by default)  
  38. void sc_interface::register_port( sc_port_base&, const char* ){}  
  39. // get the default event  
  40. const sc_event&  
  41. sc_interface::default_event() const 
  42. {  
  43.     SC_REPORT_WARNING( SC_ID_NO_DEFAULT_EVENT_, 0 );  
  44.     return m_never_notified;  
  45. }  
  46. // destructor (does nothing)  
  47. sc_interface::~sc_interface(){}   
  48.  
  49. // constructor (does nothing)  
  50. sc_interface::sc_interface(){}   
  51.  
  52. 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