1

我的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);
    ...
 }

但我正在从文件中提取字符串 ( sig1, sig2,...) 并将其存储在数组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);
 ...

是否有可能做到这一点?

4

0 回答 0