Services and Modeling for Embedded Software Development
Embecosm divider strip
Prev  Next

4.3.1.  Headers and Macros

All the definitions required are obtained from the definition file:

#include "Or1ksimSC.h"
	  

The implementation of a C++ class that is a SystemC module with SystemC threads (SC_THREAD), methods (SC_METHOD) or clocked threads (SC_CTHREAD) requires a number of definitions for that class to be set up using the SC_HAS_PROCESS macro.

SC_HAS_PROCESS( Or1ksimSC );
	  
[Caution]Caution

The SC_HAS_PROCESS macro is a common cause of confusion with new users to SystemC. It doesn't appear in the user guide and tutorial examples. The reason is that those examples use the SC_CTOR macro to define the constructor for the class, which provides the same definitions as the SC_HAS_PROCESS macro.

The SC_CTOR macro can only be used where the constructor's implementation is given within the class definition. As explained in Section 3.2.3, this application note follows the standard C++ practice of separating the class definition from its implementation, with the constructor implemented separately from the class definition.

In cases such as this, where the constructor implementation is separate from the definition, SystemC requires that the SC_HAS_PROCESS macro is used before the code of any class functions. The macro is only required if the constructor uses SC_METHOD, SC_THREAD or SC_CTHREAD to associate a process with the module class.

Embecosm divider strip