Skip to content Skip to footer

Direct Programming Interface (DPI)

Direct Programming Interface (DPI) is a mechanism that allows System Verilog to call functions or tasks written in C/C++ and vice versa. DPI enables the integration of custom C/C++ code with System Verilog, facilitating advanced verification tasks that are difficult or inefficient to achieve purely in HDL.

Key Features

  • Lightweight interface.
  • No need for PLI/VPI (Programming Language Interface/Verilog Procedural Interface).
  • Simplified interaction between hardware design and software simulation environments.

Importance of DPI in ASIC Verification

  • Enhanced Verification Capabilities: DPI allows the use of existing C/C++ models or libraries for complex computations and data handling.
  • Performance Optimization: Enables faster execution of time-consuming algorithms compared to purely HDL-based implementations.
  • Interoperability: Facilitates seamless integration of software and hardware components, critical for co-simulation and hardware-software co-design.

Role of C/C++ in DPI

  • C/C++ Provides the computational power and flexibility for complex algorithms, data processing, and system-level functions that are difficult to implement in System Verilog.
  • Compiled into a shared object (Linux) or DLL (Windows) that can be called from System Verilog using DPI.

Role of System Verilog in DPI

  • System Verilog acts as the environment for hardware modeling and simulation, calling C/C++ functions via DPI to perform complex or time-consuming tasks.
  • Uses import (to call C/C++ functions) and export (to allow C/C++ to call System Verilog tasks or functions).

DPI Components

Export and Import Functions:

  • Import: System Verilog calls C/C++ functions.
  • Export: C/C++ calls System Verilog functions.

DPI Task vs. Function

  • Tasks can have multiple outputs and can block; functions are single-output and non-blocking.

DPI Contexts

  • How the execution context is managed between the System Verilog and C/C++ environments.

DPI Implementation Workflow

  • Step 1: Write C/C++ functions or tasks that need to be interfaced.
  • Step 2: Declare these functions in System Verilog using import or export keywords.
  • Step 3: Compile the C/C++ code into a shared object(.so file on Linux) or dynamic library(.dll file on Windows).
  • Step 4: Link the compiled object with the System Verilog simulator.
  • Step 5: Call the C/C++ functions from System Verilog or vice versa during simulation.

DPI in SoC Level Verification

Why Use DPI in SoC Verification?

  • Performance Optimization
  • Complex Protocol and Algorithm Modeling
  • Integration with Third-Party Tools and Libraries

Use Cases, Advantages And Best Practices

Use Cases of DPI in SoC Verification

  • Hardware-Software Co-Verification: Verification of Embedded SW
  • Simulation Acceleration: Offload computationally intensive parts to C/C++
  • Reference Model

Advantages of Using DPI in SoC Verification

  • Ease of integration
  • Flexible Verification Environment
  • Cross-Language Data Sharing

Best Practices for Using DPI in SoC Verification

  • Keep DPI Functions Simple
  • Use DPI for performance-critical parts
  • Testing & Validation

Conclusion

  • Maximize Verification Efficiency
  • Reduce Development Time
  • Enhance Verification Capabilities
  • Adapt to Complex SoC Designs

About Us

VeriFast is a semiconductor service and solution provider. We have good experience on working with SoC verification and DPI. Our team has worked on DPI based verification of complex SoC. If you are looking for engineering resources with SoC Verification expertise, do contact us.

Leave a comment