You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/index.rst
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,21 +27,32 @@ who are new to either `GHDL` or `VHDL` to first read the :ref:`USING:QuickStart`
27
27
Three main approaches are used to co-simulate (co-execute) VHDL sources along with software applications written in a
28
28
language other than VHDL (typically C/C++/SystemC):
29
29
30
-
* Verilog Procedural Interface (VPI), also known as Program Language Interface (PLI) 2.0.
30
+
* `Verilog Procedural Interface <https://en.wikipedia.org/wiki/Verilog_Procedural_Interface>`_ (VPI), also known as
31
+
Program Language Interface (PLI) 2.0.
31
32
32
-
* VHDL Procedural Interface (VHPI), or specific implementations, such as Foreign Language Interface (FLI).
33
+
* `VHDL Programming Interface <https://ieeexplore.ieee.org/document/4299594>`_ (VHPI), or specific implementations,
34
+
such as Foreign Language Interface (FLI).
33
35
34
36
* Generation of C/C++ models/sources through a transpiler.
35
37
36
38
VPI and VHPI are complex APIs which allow to inspect the hierarchy, set callbacks and/or assign signals. Because
37
39
provided features are similar, GHDL supports VPI only. Furthermore, as an easier to use alternative, GHDL features a
38
-
custom coexecution procedure named VHPIDIRECT, similar to SystemVerilog's Direct Programming Interface (DPI).
39
-
As of today, generation of C++/SystemC models à la Verilator is not supported. However, a *vhdlator*/*ghdlator* might
40
-
be available in the future.
40
+
custom coexecution procedure named VHPIDIRECT, similar to SystemVerilog's DPI (`Direct Programming Interface <https://en.wikipedia.org/wiki/SystemVerilog_DPI>`_).
41
+
As of today, generation of C++/SystemC models à la `Verilator <https://www.veripool.org/wiki/verilator>`_ is not
42
+
supported. However, a *vhdlator*/*ghdlator* might be available in the future.
43
+
44
+
:ref:`VHPIDIRECT <COSIM:VHPIDIRECT:Intro>` is easier to use than :ref:`VPI <COSIM:VPI:Intro>`/:ref:`VHPI <COSIM:VHPI:Intro>`
45
+
because, as the name suggests, it is a direct interface. However, on the one hand VHPIDIRECT requires modification of
46
+
VHDL sources, which might not be possible or desirable in certain contexts. On the other hand, VPI/VHPI allow use cases
47
+
which are not yet possible with VHPIDIRECT, such as controlling execution time steps. It is suggested to read the quick
48
+
start examples of both interfacing mechanisms, in order to get a feel of the differences.
49
+
41
50
42
51
.. toctree::
43
52
:caption:VHPIDIRECT
53
+
:hidden:
44
54
55
+
vhpidirect/index
45
56
vhpidirect/declarations
46
57
vhpidirect/wrapping
47
58
vhpidirect/linking
@@ -50,28 +61,17 @@ be available in the future.
50
61
vhpidirect/examples/index
51
62
vhpidirect/mistakes
52
63
53
-
Interfacing with foreign languages through VHPIDIRECT is possible on any platform.
54
-
You can define a subprogram in a foreign language (such as `C` or
55
-
`Ada`) and import it into a VHDL design.
56
-
57
-
.. NOTE::
58
-
GHDL supports different backends, and not all of them generate binary artifacts. Precisely, ``mcode`` is an in-memory
59
-
backend. Hence, the examples need to be built/executed with either LLVM or GCC backends. A few of them, the ones that
60
-
do not require linking object files, can be used with mcode.
61
-
62
-
.. ATTENTION::
63
-
As a consequence of the runtime copyright, you are not allowed to distribute an
64
-
executable produced by GHDL without allowing access to the VHDL sources. See
65
-
:ref:`INTRO:Copyrights`.
66
-
67
-
.. TIP::
68
-
See :ghdlsharp:`1053` for on-going work with regard to VHPIDIRECT.
Since VPI and VHPI provide very similar features, and because VPI is already supported in GHDL, VHPI is not available (yet).
10
+
Hence, the information in this section is provided for completeness only.
11
+
12
+
VHDL Programming Interface (VHPI) was introduced in 2007, as an ammendment to IEEE Std 1076-2002: `1076c-2007 - IEEE Standard VHDL Language Reference Manual - Procedural Language Application Interface <https://ieeexplore.ieee.org/document/4299594>`_.
13
+
In the 2009, the programming interface was published as part of `1076-2008 - IEEE Standard VHDL Language Reference Manual <https://ieeexplore.ieee.org/document/4772740>`_.
14
+
The latest version was published in 2019: `1076-2019 - IEEE Standard for VHDL Language Reference Manual <https://ieeexplore.ieee.org/document/8938196>`_.
15
+
16
+
Some vendors support C programming interfaces similar to VHPI. For example, Mentor Graphics' ModelSim/QuestaSim supports a
17
+
Foreign Language Interface (FLI) that provides functions to have procedural access to information within the simulator, ``vsim``. These allow to traverse the hierarchy, get/set values and control a simulation run. See `Using ModelSim Foreign Language Interface for c – VHDL CoSimulation and for Simulator Control on Linux x86 Platform <https://opencores.org/usercontent/doc/1380917197>`_ and `github.com/andrepool/fli <https://github.com/andrepool/fli>`_.
Verilog Procedural Interface (VPI) is part of the IEEE Std 1364: `1364-2005 - IEEE Standard for Verilog Hardware Description Language <https://ieeexplore.ieee.org/document/1620780>`_.
8
+
It allows Verilog code to invoke C functions, and C functions to invoke Verilog system tasks. VPI is sometimes referred to
9
+
as PLI 2, because it replaced the deprecated Program Language Interface (PLI).
10
+
11
+
VPI provides advanced features, at the cost of having to learn the API. Since this is the user and reference manual for GHDL,
12
+
an introduction to VPI is not included. Thus, the reader should have at least a basic knowledge of the interface. A good knowledge of the reference manual.
13
+
14
+
Unlike VHPIDIRECT, which allows and requires the user to define a custom API between VHDL and C, VPI is itself a pre-defined
15
+
API. Hence, all VPI modules need to include a standard header file, ``vpi_user.h``. At the same time, VPI modules need to be
16
+
built as shared libraries, and they are dynamically loaded at runtime. This is similar to example :ref:`COSIM:VHPIDIRECT:Examples:shared:shlib`.
17
+
However, when using VPI, VHDL sources are agnostic to the existence of C sources.
18
+
19
+
Information about GHDL's commands related to VPI is available at :ref:`VPI_build_commands` and :option:`--vpi`.
0 commit comments