PySlint - DPI, beware of old style DPI import/export

 SystemVerilog is a vast language with long history. With any history, you have the problem of legacy - sometimes bad too, unfortunately. One such bad legacy is the use of "DPI" as spec-string in SystemVerilog Direct Programming Interface (DPI) code, used to interface C with SystemVerilog. It is a very commonly used feature in certain classes of systems as it allows reuse of reference models as-is in Design Verification. Jumping straight into a potential compatibility issue with DPI, historically Accellera SV (3.1a) allowed the following code:

import "DPI" function int c_sum (int f1, f2); 



 

 However, as LRM matured and became an IEEE 1800 version, the above got refined to be "DPI-C". This is often referred to as "spec-string". Now, what's the big deal - one may ask, well below is a quote from IEEE 1800 LRM:


So, if your old SV code was using "DPI" as spec-string, potentially:

  • You have confusing 2-state, 4-state value passing across the interface.
  • Code is likely to break/not compile in newer versions of your favorite EDA tools.
  • Integrating with newer DPI-C code is likely to further amplify the 2-state/4-state packed array passing. 
So, get that fixed - it is literally a 2-character edit, problem is - who will find it and flag it for you - well, PySlint can do it for free using opensource slang/Pyslang. 



Comments

Popular posts from this blog

Don't go "wild" with Associative arrays in SystemVerilog - PySlint it!

Porting a complete UVC to Verilator + UVM - an anecdote!

Opensource testbench generator for VHDL designs, OSVVM included!