我希望来自 SystemVerilog 的数据数组具有来自 C/C++ 端数组的完整数据副本:
C/C++ 代码:
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 代码:
module tb_top;
int results[100];
import "DPI-C" function myCfunc(output int results[]);
...
initial begin
myCfunc(results);
end
endmodule : tb_top
我的问题是我每次都不知道源数组的确切大小。此外,即使每次都是固定大小,我会想象对于大型数组来说,拥有一长串索引参数将是多余的。其他 SV-DPI 处理程序函数似乎不适用于我的案例,或者我一定误解了它们的使用方式。