vsim command line PLI howto
1. insert register routine in PLI vpi_user.c file
void (*vlog_startup_routines[ ] ) () = {
RegisterMySystfs,
0 /* last entry must be 0 */
};
2. compile PLI c file
gcc -c -fPIC -I//modeltech/include app.c vpi_user.c
ld -shared -Bsymbolic -E --allow-shlib-undefined -o app.so app.o vpi_user.o
3. Creating Vsim logical library - vlib
$vlib work
4. compile Verilog
$vlog sample.v
Top level modules:
test
5. Run verilog in command line mode using top module name
$vsim -c -pli app.so test
$VSIM 1> run -all
6. Run Verilog in Batch Mode using a do file
6.1 create a do file, vsim.do
onerror {resume}
run -all
quit -f
6.2 run simulation using do file
$vsim -c -do vsim.do -pli app.so test
7. Create a shell program to run all
This is an example from modeltech/example/vpi/
# VPI Test Compilation and Execution Script for Linux
# NOTE: The environment variable MTI_HOME must be set to point to your
# modeltech installation directory before invoking this script.
# Example: setenv MTI_HOME /usr/local/modeltech
# GCC compilation (-g for debug symbols)
gcc -c -g -I$MTI_HOME/include vpi_test.c
ld -shared -o vpi_test.sl vpi_test.o
rm -rf work
vlib work
vlog prim.v dff.v top.v
vsim -c -do vsim.do top -pli vpi_test.sl
Last modified: Thu Aug 10 18:53:35 EDT 2006