Here’s the prototype of my import function
import "DPI-C" function c_func_wrap(input byte unsigned inputVal[], input int sizeVal, output byte outVal[64], input int check);
In my systemverilog code here’s what I’m doing
byte data[];
int checkVal;
data = new[111];
for (int i=0; i<111; i++) data[i] = i;
for (int i=0; i<111; i++) `uvm_info("DEBUG", $sformatf("Debug array index %d val = 0x%0x", i, data[i]), UVM_LOW)
c_func_wrap(data, data.size(), outval, checkVal);
....
.....
The C-function
void c_func_wrap(const svOpenArrayHandle inputVal, int sizeVal, char *outVal, int check) {
printf("Size of input array : %0d\n"sizeVal);
}
The array printed out from SV(Debug array index …) has only 111 elements printed out.
The value printed by the C-function is “Size of input array : 112”
112 is wrong because from SV the size of the array is 111 (data.size())
Using Mentor Questa/UVM 1.1d
Any help is appreciated.