DPI-C consists of two separate layers: the SystemVerilog layer and a foreign language layer. The SystemVerilog layer does not depend on which programming language is actually used as the foreign language. Although different programming languages can be supported and used with the intact SystemVerilog layer, SystemVerilog defines a foreign language layer only for the C programming language. Nevertheless, SystemVerilog code shall look identical and its semantics shall be unchanged for any foreign language layer.
Dpi-C Systemverilog Layer
The SystemVerilog side of DPI-C does not depend on the foreign programming language. In particular, the actual function call protocol and argument passing mechanisms used in the foreign language are transparent and irrelevant to SystemVerilog. SystemVerilog code shall look identical regardless of what code the foreign side of the interface is using. The semantics of the SystemVerilog side of the interface is independent from the foreign side of the interface.
The SystemVerilog DPI-C allows direct inter-language function calls between SystemVerilog and any foreign programming language with a C function call protocol and linking model:
Functions implemented in C and given import declarations in SystemVerilog can be called from SystemVerilog; such functions are referred to as imported functions.
Functions implemented in SystemVerilog and specified in export declarations can be called from C; such functions are referred to as exported functions.
Tasks implemented in SystemVerilog and specified in export declarations can be called from C; such functions are referred to as exported tasks.
Functions implemented in C that can be called from SystemVerilog and can in turn call exported tasks; such functions are referred to as imported tasks.
Dpi-C Foreign Language Layer
The foreign language layer of the interface (which is transparent to SystemVerilog) shall specify how actual arguments are passed, how they can be accessed from the foreign code, how SystemVerilog-specific data types (such as logic and packed) are represented, and how they are translated to and from some predefined C-like types.