Le 2015-10-27 23:32, René Doß a écrit :
Hallo,

I write on a cosimulation with the vhpi interface to C.

Now I need a vhdl procedure that get from the C code some datas and also
a flag.

[vhdl]

   procedure vhpi_emu ( value: out integer; value_valid: out integer;
solved_back: in integer);

  attribute foreign of vhpi_emu :
    procedure is "VHPIDIRECT vhpi_emu";

[\vhdl]


How looks the c code for this procedure?
In C I have only return with one value.


How can connect a C function to this VHDL procedure?

From my dim memories, VHDL should send a sort of record as inout,
because VHDL must allocate itself the memory on its stack for the return data.
Otherwise it's a huge can of worms (and you have had a taste already).

I don't know the exact syntax however but my idea is :
make a "out_record", send it to the C function
which should receive it as a pointer to this record.
that's a first thing to check ;-)
C reads and writes it, then returns...
C should not allocate memory (that is shared with GHDL),
or in an extremely precise manner and for certain purposes.

good luck,
yg

_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to