User`s manual

Using the Verilog PLI
ModelSim Xilinx Users Manual Verilog Simulation 5-83
PLI Application Requirements
PLI applications are dynamically loaded into VSIM. A PLI application can consist
of one or more dynamically loadable objects. Each of these objects must contain
an entry point named init_usertfs( ) and a local veriusertfs table of user tasks and
functions. There must be an entry in the table for each function in the object file
that can be called externally. The init_usertfs( ) function must call
mti_RegisterUserTF( ) for each entry in its local veriusertfs table.
PLI applications that use the TF functions should include the veriuser.h file.
Windows NT/95/98 platforms
Under Windows NT/95/98, VSIM loads a 32-bit dynamically linked library for
each PLI application. The following compile and link steps are used to create the
necessary.dll file (and other supporting files) using the Microsoft Visual C/C++
compiler.
cl -c -I<install_dir>\modeltech\include app.c
link -dll -export:<C_init_function> app.obj \
<install_dir>\modeltech\win32\mtipli.lib
Where <C_init_function> is the function name specified in the FOREIGN
attribute (for FLI).
Note: The PLI interface has been tested with DLLs built using Microsoft Visual C/C++ compiler version
4.1 or greater.
Specifying the PLI file to load
Once your C application has been compiled it is ready to be loaded by VSIM. The
name of the file to be loaded is specified in the modelsim.ini file by the Veriuser
entry. The Veriuser entry must be in the [vsim] section of the file.
For example,
[vsim]
.
.
.
Veriuser = pliapp.dll
The Veriuser entry also accepts a list of shared objects. Each shared object is an
independent PLI application that must contain an init_usertfs( ) entry point that
registers the applications tasks and callback functions. An example entry in the
modelsim.ini file is:
Veriuser = pliapp1.dll pliapp2.dll pliapp3.dll