User guide

17-3
Using the PLI
Using VPI Routines
Writing Your Own main() Routine
Writing a PLI Application
When writing a PLI application, you need to do the following:
1. Write the C/C++ functions of the application calling the TF and
ACC routines that Synopsys has implemented to access data
inside VCS.
2. Associate user-defined system tasks and system functions with
the C/C++ functions in your application. VCS will call these
functions when it compiles or executes these system tasks or
system functions in the Verilog source code. In VCS, associate
the user-defined system tasks and system functions with the C/
C++ functions in your application using a PLI table file (see "The
PLI Table File" on page 17-6). In this file you can also limit the
scope and operations of the ACC routines for faster performance.
3. Enter the user-defined system tasks and functions in the Verilog
source code.
4. Compile and simulate your design, specifying the table file and
including the C/C++ source files (or compiled object files or
libraries) so that the application is linked with VCS in the simv
executable. If you include object files, use the -cc and -ld
options to specify the compiler and linker that generated them.
Linker errors occur if you include a C/C++ funtion in the PLI table
file but omit the source code for this function at compile-time.