
Direct Programming Interface for SystemVerilog and C
SystemVerilog DPI connects SystemVerilog and C through lightweight imported and exported subroutines, covering data mapping, type compatibility, context and pure functions, compilation, linking, limitations, and disable handshake behavior for reliable cross-language simulation integration.
SystemVerilog DPI connects SystemVerilog and C through lightweight imported and exported subroutines, covering data mapping, type compatibility, context and pure functions, compilation, linking, limitations, and disable handshake behavior for reliable cross-language simulation integration.
This resource includes
Description
SystemVerilog DPI defines a practical foreign-function interface between SystemVerilog and C. It enables C routines to be imported as SystemVerilog tasks or functions, and enables selected SystemVerilog subroutines to be exported into the C global namespace. The result is a direct bidirectional call mechanism that feels like ordinary subroutine usage while allowing external C computation and SystemVerilog behavior to work together inside simulation. DPI is built around strict interface declarations. Imported routines require matching names, return types, argument types, and argument directions between the SystemVerilog declaration and the C implementation. Exported routines require the same kind of agreement between the SystemVerilog task or function and the C extern declaration. Since the C and SystemVerilog compilers do not fully communicate across the language boundary, correctness depends on accurate prototypes, compatible data types, and disciplined linkage naming. Data type handling is a major part of DPI integration. Simple SystemVerilog types map directly to corresponding C types, while scalar bit and logic values use DPI-defined representations from svdpi.h. Enumerations...
This resource includes
Description
SystemVerilog DPI defines a practical foreign-function interface between SystemVerilog and C. It enables C routines to be imported as SystemVerilog tasks or functions, and enables selected SystemVerilog subroutines to be exported into the C global namespace. The result is a direct bidirectional call mechanism that feels like ordinary subroutine usage while allowing external C computation and SystemVerilog behavior to work together inside simulation. DPI is built around strict interface declarations. Imported routines require matching names, return types, argument types, and argument directions between the SystemVerilog declaration and the C implementation. Exported routines require the same kind of agreement between the SystemVerilog task or function and the C extern declaration. Since the C and SystemVerilog compilers do not fully communicate across the language boundary, correctness depends on accurate prototypes, compatible data types, and disciplined linkage naming. Data type handling is a major part of DPI integration. Simple SystemVerilog types map directly to corresponding C types, while scalar bit and logic values use DPI-defined representations from svdpi.h. Enumerations...
Recommended

EDA Academy is a practical learning platform for engineers in the VLSI and semiconductor industry. We offer structured courses, technical resources, and career-focused training across all major areas of chip design and verification — from Verilog to Physical Design, from fundamentals to advanced topics. Learn at your own pace, explore member-exclusive content, or join as an instructor to share your expertise. Lear...
