DPI layer

Verification environment written in SystemVerilog does not alow to call directly functions written in another language. Therefore, it is not possible to call functions providing communication with verification core written using libsze2 library in verification environment. However, SystemVerilog provides mechanism called Direct Programming Interface (DPI) which enables cooperation with foreign languages. Currently, however, it is only C language but it is absolutely sufficient for our needs.

For one thing, DPI allows natural isolation of SystemVerilog and for another, isolation of foreign language. Such separation is reached by using functions as natural encapsulation units in SystemVerilog. Hence, DPI supports direct inter-language function calls between the languages on both sides of the interface. As a result, it is even possible to call SystemVerilog functions in foreign language. Functions called in SystemVerilog and implemented in foreign language are called imported functions. Functions called from foreign code are specified as exported functions.

Passing the data between two domains is allowed through function arguments and results. SystemVerilog data types are the sole data types that can cross the boundary between SystemVerilog and foreign language in either direction.The foreign language layer of the interface specifies how actual arguments are passed, how they can be accessed from the foreign code, how SystemVerilog specifies data types are represented, and how they are translated to and from predefined foreign language types. Programmers are responsible for specifying the native types equivalent to the SystemVerilog types used in imported or exported declarations in their foreign code.