首先,设置
系统环境 LD_LIBRARY_PATH ,使得simv能找到你的共享对象。
引用:
setenv LD_LIBRARY_PATH 'pwd'
LD_LIBRARY_PATH
然后, 编译PLI为共享目标文件。如何编译跟编译器和系统相关。在linux可以:
引用:
gcc -shared -o pli.so -I$VCS_HOME/include pli.c
对于Solaris操作系统可以用:
引用:
cc -G -o pli.so -I$VCS_HOME/include pli.c
用VCS编译,确保在命令行上:
引用:
vcs -P pli.tab top.v pli.so
现在,如果你仅仅改变PLI,只需要重新编译C文件,然后重新运行simv(你不用重新编译simv甚至不用运行VCS脚本)。
One interesting caveat. If you are using incremental compile (-M), the
Makefile links in "../pli.so", as seen from the point-of-view of the csrc
directory. When you do to run the simv, it will search for "../pli.so"
which most likely does not exist. To get around that, you could use the
full path name of the shared object on the command line, thus:
vcs -Mupdate -P pli.tab top.v 'pwd'/pli.so
Of course, if you do that, then the LD_LIBRARY_PATH is not needed but the
simv will always look for the PLI object in one particular place. You can
always run the simulation from a sub-directory or link the shared object
to the parent directory.