将数组元素传递给vpi_handle_by_name

时间:2017-07-31 18:05:50

标签: c++ system-verilog vpi

我的test.sv代码包含interfacemodule,如下所示:

 interface Bus;
   logic [7:0] sig1;
   logic [15:0] sig2;
   logic sig3;
 endinterface

 module test();
   Bus inst();
   ...
 endmodule

我已将 vpiFullName test.inst.sig1提供给 vpi_handle_by_name

 vpiHandle it1, it2, it3;

 it1 = vpi_handle_by_name("test.inst.sig1", NULL);
 func(it1, vpiBit);
 it2 = vpi_handle_by_name("test.inst.sig2", NULL);
 func(it2, vpiBit);
 it3 = vpi_handle_by_name("test.inst.sig3", NULL);
 func(it3, vpiBit);

 static void
 func(vpiHandle net, PLI_INT32 nettype)
 {
    char *name = vpi_get_str(vpiFullName, net);

    auto size = vpi_get(vpiSize, net);
    ...
 }

但是我从文件中提取字符串(sig1sig2,...)并将其存储在数组arr中。我想以数组的形式将这些字符串传递给vpi_handle_by_name,如下所示:

 vector <std::string> arr;

 it1 = vpi_handle_by_name(arr[0], NULL);
 func(it1, vpiBit);
 it2 = vpi_handle_by_name(arr[1], NULL);
 func(it2, vpiBit);
 ...

是否可以这样做?

0 个答案:

没有答案
相关问题