quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../images/main/bullet_green_ball.gif Introduction

DPI is direct programming interface, this is far better than VPI and PLI, which needed lot of understanding of various PLI and VPI calls. It was like learning another programming language. VPI and PLI will remain for very long time due to power they offer. There are still applications which will need PLI and VPI. But then major of them won't need PLI and VPI kind of interface, but rather simple DPI should do the job.

   

space.gif

There two layers in DPI.

   

space.gif

  • SystemVerilog Language Layer
  • Foreign Language Layer
   

space.gif

Either language compiler need not compile or parse other language, DPI follows the principle of a black box: the specification and the implementation of a component are clearly separated, and the actual implementation is transparent to the rest of the system. Therefore, the actual programming language of the implementation is also transparent, although this standard defines only C linkage semantics. The separation between SystemVerilog code and the foreign language is based on using functions as the natural encapsulation unit in SystemVerilog. By and large, any function can be treated as a black box and implemented either in SystemVerilog or in the foreign language in a transparent way, without changing its calls.

   

space.gif

   

space.gif

  ../images/main/bulllet_4dots_orange.gif Example : Basic DPI SystemVerilog code
   

space.gif


  1 module top;
  2 
  3 // Declare the DPI import function
  4 import "DPI" function void hello(string str);
  5 
  6 initial begin
  7   hello("Hello SystemVerilog") ;
  8 end
  9 
 10 endmodule
You could download file basic_dpi.sv here
   

space.gif

  ../images/main/bulllet_4dots_orange.gif Example : Basic DPI C code
   

space.gif


 1 #include <stdio.h>
 2 #include "svdpi.h"
 3 
 4 void hello(char* str) { 
 5   printf ("%s\n", str) ;
 6 }
You could download file basic_dpi.c here
   

space.gif

  ../images/main/bullet_star_pink.gif Simulation : DPI
   

space.gif

   

space.gif

 Hello SystemVerilog
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com