Verilog PLI Setup - HACKT PRSIM Manual
Description: HACKT PRSIM Manual

Next: VPI Basics, Up: Co-simulation

### 6.1 Verilog PLI Setup

Popular commercial tools sometimes provide an interface for mixing simulators. In this section, we describe how hacprsim can be integrated with Synopsys' VCS Verilog Simulator. The interface they provide is called VPI for Verilog PLI (Programming Language Interface).

All of the functionality of the hacprsim is provided in the libhacktsim.la library. If you've built the HAC tools with shared libraries, then all the necessary libraries should already be available in your installation path.

The first step is to enable support for building a plug-in to be loaded into the VPI. During the configure step, pass the option: `–with-vpi=`/path/to/vpi/development-files

         ./configure --with-vpi=/usr/local/cad/synopsys/vcs

The path should point to one directory up from where the C headers reside. (Basically exclude the `/include` from the path argument, as it is automatically appended.) `configure` checks for vpi_user.h in the given path. If it is found, then compilation will create a module for VCS's VPI, vpihacprsim.la (which is installed with the actual `.so/dll/dylib` shared library). This configuration check also looks for vcs in the path; vcs is used to compile Verilog into a simulation executable.

Disclaimer: the following instructions are taken from the author's trials, and do not necessary reflect the actual documented use. Consult the vendor's VPI documentation for more information.

To enable VPI in the VCS compiler, pass +vpi to the vcs command.

To specify the prsim module, pass: -use_vpiobj /prefix/lib/hackt/vpihacprsim.so and -L/prefix/lib/hackt. The -L flag is forwarded to the linker used by VCS in the final stage of compilation, and is also required at run-time for finding dependent shared libraries. The method described here uses a dynamic library (plug-in module), however a static library could also suffice, as long as all symbols were resolved at link time. Dependent libraries should be linked with the -l option which is forwarded to the linker.

VCS produces an executable, say simv, which is dynamically linked to vpihacprsim.so. If the HAC libraries do not already reside in one of the default run-time library search paths (searched by ld.so), then you must help simv find dependent libraries by passing the same linker flags through `LD_LIBRARY_PATH`.

         sh$ LD_LIBRARY_PATH=/prefix/lib/hackt:$LD_LIBRARY_PATH ./simv

         csh% env sh$ LD_LIBRARY_PATH=/prefix/lib/hackt:$LD_LIBRARY_PATH ./simv