On 28/10/15 19:45, René Doß wrote:
Hallo,

a record in the VHDL code and a struct in the C code.
I think inout is not nesesary. Both out parameter can be combined.

record  <-----return struct


This can work. Now is the question, how is the correct syntax?

Yes, that's the best option: use a record and pass it as an inout parameter.
Such a record is passed by reference, so you just have to declare the corresponding C struct.

Tristan.



René



Am 27.10.2015 um 23:32 schrieb [email protected]:
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


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



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

Reply via email to