I would like my array of data from SystemVerilog have the entire copy of data from the array on the C/C++ side:
C/C++ code:
void myCfunc(svOpenArrayHandle results) {
int randomsize;
...
uint32_t myArray[randomsize];
...
svPutBitArrElemVecVal(results, myArray, 1); // copies only the first element
//svPutBitArrElemVecVal(results, myArray, 1, 2, 3); // still only copies the first element for some reason
// svCopyArr(results, myArray); // this isn't a DPI function, but I would like do to something like this.
// Copy the whole array, not just the an element
}
SV code:
module tb_top;
int results[100];
import "DPI-C" function myCfunc(output int results[]);
...
initial begin
myCfunc(results);
end
endmodule : tb_top
My issue is that I don't know the exact size of the source array each time. Also, even if it was a fixed size every time, I would imagine having a long list of index arguments would be excessive for a large array. The other SV-DPI handler functions either don't seem to apply to my case or I must be misunderstanding how they are to be used.