Skip to content

fix(xcelium): handling DPI libraries#549

Open
tymonx wants to merge 1 commit into
olofk:mainfrom
tymonx:fix/xcelium-dpi
Open

fix(xcelium): handling DPI libraries#549
tymonx wants to merge 1 commit into
olofk:mainfrom
tymonx:fix/xcelium-dpi

Conversation

@tymonx

@tymonx tymonx commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Closes #548

The xrun command is just a wrapper to invoke:

  • xmvhdl to compile VHDL source files
  • xmvlog to compile Verilog and SystemVerilog source files
  • xmelab to perform elaboration of HDL module
  • xmsim to run simulation

Handling DPI libraries is only done by the xmsim command (simulation runtime):

xmsim -help | grep -i dpi
        -DPI_STACK_INT_C                    -- Lists internal C stack frames called from import function
        -SV_LIB <arg>                       -- Dynamically load a DPI Library

The elaboration stage is only used to generate header files for export/import functions/tasks:

xmelab | grep -i dpi
        -DPI_VOID_TASK                          -- Return value of export and import tasks will be VOID. 
        -DPIHEADER <arg>                        -- generate the header file for export functions/tasks
        -DPIIMPHEADER <arg>                     -- generate the header file for import functions/tasks
        -GCC_VERS <arg>                         -- Pass gcc_vers switch for DPI file compilation

DPI libraries lib<name>.so can be passed only to the simulation runtime stage:

xmsim -sv_lib <dir>/lib<name>.so

Without it, xsim (or xrun -R) will raise an error NOFDPI:

xmsim: *F,NOFDPI (<file>.sv,<line>|<column>): Function <name> not found in any of the shared object specified with -SV_LIB switch. The corresponding import DPI declaration is done in file <file>.sv at line no. <line>.

About the raised error:

xmhelp xmsim NOFDPI

xmsim/NOFDPI =
        C function declared in import DPI declaration should be present in
        shared library. Specified function is not available in any of the
        provided shared objects or default "libdpi".
        (Default severity: 'F')

        See more info at: https://support.cadence.com/apex/Coveo_CommunitySearch#ph=Xcelium&t=PlatformProductPage&oMenu=Search&cadproduct=%22Xcelium%22&q=NOFDPI

This PR:

  • Fixed handling DPI libraries
  • DPI libraries are passed to the simulation runtime stage xrun -R (aka xmsim)
  • Removes DPI libraries from elaboration stage. They where ignored by the xrun elaboration stage
  • DPI libraries were composed as list of list (dpi_lib_cmd) and concatenated with xrun arguments generating invalid arguments at the end ['-sv_lib', 'libdpi.so']
  • Adds additional libdpi.so file for test fixture (and fixes legacy xcelium tests because of that...)
  • Extends test_tool_xcelium to check if the xrun -R simulation command contains DPI arguments -sv_dpi libdpi.so

@tymonx
tymonx marked this pull request as draft July 3, 2026 19:22
@tymonx
tymonx force-pushed the fix/xcelium-dpi branch from 4090b76 to 5294f56 Compare July 3, 2026 19:27
@tymonx
tymonx marked this pull request as ready for review July 3, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(xcelium): DPI libraries are added as a list of list to command arguments

1 participant