Jump to content

Using a module inside another SC_MODULE


foobar42

Recommended Posts

Hi,

I'm new to SystemC and fail to use a SC_MODULE in another SC_MODULE.

My code looks somewhat like this:

SC_MODULE(module0) {

...

};

SC_MODULE(module1) {

module0 mod0("mod0");

...

};

When I want g++ to compile this, it bails out with the following error message:

sd_adder.h:19: error: expected identifier before string constant

sd_adder.h:19: error: expected ‘,’ or ‘...’ before string constant

Is it somehow possible to use modules in other modules?

Link to comment
Share on other sites

You need to instantiate the sub-module as a member in the parent module. Modules are just regular C++ classes, same rules apply.

SC_MODULE(module1) {

 SC_CTOR(module1)
   : mod0( "mod0" ) // initialise member in constructor
 {
   // ...
 }

private:
 // sub-module member declaration
 module0 mod0;
};

Greetings from Oldenburg,

Philipp

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...