User guide

24-251
SystemVerilog Testbench Constructs
The Direct Programming Interface (DPI)
The Direct Programming Interface (DPI) is a Limited Customer
availability (LCA) feature in NTB (SV) and requires a separate license.
Please contact your Synopsys AC for a license key.
The DPI is an interface between SystemVerilog and another
language such as C. Using DPI you can directly call a function in the
other language.
Note:
Currently DPI is implemented only for the C/C++ languages.
Import Functions - SystemVerilog calling C/C++
The import task/functions are C/C++ functions that can be called
from the SystemVerilog code. You must declare them before you
can use them. After you declare an import function, you can call it
like any procedural statement in your SystemVerilog code.
Import tasks and functions can have 0 or more formal input, output,
and inout arguments. Import functions can either return a value or be
defined as void, while import tasks never return a value.
Import functions can have the properties context or pure while the
import tasks can have the property context only.
Syntax:
Declaration :
import "DPI" [cname =] [pure] function type name (args);
import "DPI" [cname =] [pure][context] task name (args);