With the MyHDL release 0.6 VHDL conversion is supported. At the time of the release it was not known if there was an open-source VHDL simulator that supported foreign interface for Cosimulation. This page was created to capture information needed to implemented the foreign interface for GHDL.
The first item that needs to be determined is which foreign interface to use VPI or VHPI.
This is an ongoing investigation below is essentially a log of recent information.
VPI is part of the Verilog PLI standard and a subset of VPI has been added to GHDL to support IVI. According to a newsgroup post VPI might not be the best option because VPI has not been maintained in many years. But on the GHDL website there are some examples of the VPI interface available. And using the examples as a template the cver VPI implementation can be compiled and loaded into GHDL. Nothing interesting was done with the interface other than compiling and loading in a GHDL simulation.
At this point it is unclear which interface to use. More information will be posted to this page as it is available.
The following is a table of the VPI functions used as part of the cver implementation and the known status in GHDL.
|VPI Function||GHDL Status||MyHDL Usage||Comment|
|vpi_printf||supported||Demonstrated in vpi1.c example|
|vpi_handle||supported||Demonstrated in vpi1.c example|
|vpi_iterate||supported||Demonstrated in vpi1.c example|
|vpi_get||supported||Demonstrated in vpi1.c example|
|vpi_get_str||supported||Demonstrated in vpi1.c example|
|vpi_scan||supported||Demonstrated in vpi1.c example|
|vpi_register_cb||supported||Demonstrated in vpi1.c example|
If the VHPI was to be used a new set of C code will need to be implemented. VHPI would be the secondary choice and only used if VPI support was too minimal and required adding VPI to GHLD. If that were the case VHPI would be used.
Quote from the GHDL manual:
5.9 Interfacing to other languages Interfacing with foreign languages is possible only on GNU/Linux systems. You can define a subprogram in a foreign language (such as C or Ada) and import it in a VHDL design. 5.9.1 Foreign declarations Only subprograms (functions or procedures) can be imported, using the foreign attribute. In this example, the sin function is imported: package math is function sin (v : real) return real; attribute foreign of sin : function is "VHPIDIRECT sin"; end math; package body math is function sin (v : real) return real is begin assert false severity failure; end sin; end math;
The VHPI seems too limiting at this point in time.
No conclusion yet!