Sunday, 25 August 2013

System Verilog DPI - unknown array size

System Verilog DPI - unknown array size

I have the following code:
file.sv
module svtest();
import "DPI-C" function void my_func(output bit [31:0] id, input bit
[31:0] size)
bit [31:0] my_id; bit [31:0] my_size;
initial
begin
my_size = 1 << 30;
my_func(my_id, my_size);
$finish();
end
endmodule
filc.c
void my_func(svBitVecVal* id, svBitVecVal* size) { . . . . . }
The problam i have: I want to bit vector of "size" not to be a const
length (32 bit), i want an undefined bit vector to be passed to c file. I
saw the type "svOpenArrayHandle" - looks good, but i cant figure out how
to declare it on the DPI import:
import "DPI-C" function void my_func(output bit [31:0] id, input bit
size[]) -> raise error :-(
Any advice ?
Thanks.

No comments:

Post a Comment