我想在 SystemC 中使用数组创建实例

I want to make instance with array in SystemC

我想用 SystemC 中的数组创建实例。

我想这样写:

module name = new module[10];

for(int i = 0; i < 10; i++){
    module name[i]("any names")
}

然而,我这样做了,编译器说:

error: no matching function for call to 'module::module()'

请告诉我如何使用数组创建实例。

在 SystemC 中,您可以使用 sc_vector 而不是普通的 C 数组,参见

SC_MODULE(top)
{
  sc_vector<module> m; // e.g. class member

  SC_CTOR(top)
    : m("modules", 10) // constructor
  {}
};