Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

Dynamic module instance creation

$
0
0

Hello everyone, 

 

I have a folder with many modules. I want to create a configuration file specifying which of those modules to use in my simulation. In the sc_main.cpp, before the simulation starts I would like to open my configuration file, read which modules I would like to open and then create instances, connect their ports etc

 

The configuration file contains all the necessary information as number of ports, type of each port , name of the module, name of the file etc. 

I can easily create the signals I need but I don't know how I can create the module instance. 

 

example of configuration file 

....

ex_name_module 

porta ; input ; double

portb ; output ; double 

......

In the sc_main I will read the file. I will create 2 signals of type double. But then i should do something like 

ex_name_module EX_NAME_MODULE("EX_NAME_MODULE");

EX_NAME_MODULE.input(sig1);

EX_NAME_MODULE.output(sig2);

 

One idea that I tried but it didn't work, was to create a .cpp file for each module. This file has a function containing the instance creation of the respective module. The arguments of the function were the signals created in sc_main.

 

So any ideas of how I can create such an instance? Thank you in advance


Viewing all articles
Browse latest Browse all 595

Trending Articles