SystemC Modules

 SystemC Modules 


Modules are the building blocks of SystemC, It is a container class that  may contain data members, channel members, processes, instance of other modules and ports for communication.

Modules are extended from sc_module, in other words modules are the child classes of sc_module Class.
Example:

class module_name : public sc_module {
 . . .
 };

Also module may be created with use of the SC_MODULE macro as follows,

Example:
SC_MODULE( module_name ) {
  ……
       };

Constructor

SC_CTOR macro declares the constructor, module must have SC_CTOR or it can have SC_HAS_PROCESS.(will see the SC_HAS_PROCESS in next chapters)

by default SC_CTOR macro has one argument which is the name of the module.

Example:
SC_MODULE( module_name ) {
  SC_CTOR(module_name){ }
       };

Constructor to initialize the module properties:


Module Instance:
Module instance can be created as below,
module_name instance_name(“instance_name”);


Example:
SC_MODULE( module_1 ) {

       };