我的test.sv
代码包含interface
和module
,如下所示:
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);
...
是否可以这样做?