1

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.

Greg
  • 18,111
  • 5
  • 46
  • 68
  • 2
    I use INCISIV 12.1 and the DPI declaration is OK. Using `svOpenArrayHandle` and `svHigh()`, `svLow()` to get the range of array is ok, too. – jclin Aug 26 '13 at 01:50

1 Answers1

-1

An un-sized array cannot be passed to a C function that takes us a pointer. You are going to synthesize the hardware and it cannot be variable. It cannot grow or shrink in size as per your requirements.

LearningToCode
  • 631
  • 1
  • 12
  • 23