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 ハンドラー関数は、私のケースには当てはまらないように見えるか、またはそれらの使用方法を誤解しているに違いありません。