SystemVerilog DPI-C problem

G

GaLaKtIkUs™

Guest
Hi everybody,
I'm trying to pass a dynamic array as an output to a DPI-C function.
The simulator returns a runtime error at the line where the DPI-C
function is called.

# ** Fatal: (vsim-2211) A dynamic array cannot be passed as an
argument to a
# DPI import function if the formal is an unsized output.

The simplified code follows:
test.c:
void test_c ( const svOpenArrayHandle in, svOpenArrayHandle out )
{
/*CODE*/
return;
}

test.sv:
import "DPI-C" context function void test_c ( input bit [63:0] in[],
output bit [63:0] out[]);
program test_sv;
bit [63:0] in[],out[];
initial begin
in=new[1];
out=new[1];
in="THIS IS!";
test_c(in,out);
end
endprogram

Thanks in advance for help!
 
On Jan 15, 11:42 am, GaLaKtIkUs™ <taileb.me...@gmail.com> wrote:
Hi everybody,
I'm trying to pass a dynamic array as an output to a DPI-C function.
The simulator returns a runtime error at the line where the DPI-C
function is called.

# ** Fatal: (vsim-2211) A dynamic array cannot be passed as an
argument to a
# DPI import function if the formal is an unsized output.

The simplified code follows:
test.c:
void test_c ( const svOpenArrayHandle in, svOpenArrayHandle out )
{
  /*CODE*/
  return;

}

test.sv:
import "DPI-C" context function void test_c ( input bit [63:0] in[],
output bit [63:0] out[]);
program test_sv;
  bit [63:0] in[],out[];
  initial begin
    in=new[1];
    out=new[1];
    in="THIS IS!";
    test_c(in,out);
  end
endprogram

Thanks in advance for help!
Hi again!
I found the answer in LRM. 5.8 "An import DPI function that accepts a
one-dimensional array can be passed a dynamic array of a compatible
type and of any size if formal is unsized and of the same size if
formal is sized. However, a dynamic array cannot be passed as an
argument if formal is an unsized output.
Cheers!
 

Welcome to EDABoard.com

Sponsor

Back
Top