Pass an array element to vpi_handle_by_name

569 Views Asked by At

My test.sv code contains interface and module as shown:

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

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

I have given the vpiFullName test.inst.sig1 to the 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);
    ...
 }

But I'm extracting the strings (sig1, sig2,...) from a file and storing it in an array arr. I want to pass these strings in the form of array to vpi_handle_by_name like this:

 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);
 ...

Is it possible to do this?

0

There are 0 best solutions below