|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
照着书写的程序, 编译通不过 请教哪里有问题?//file: test.sv
import "DPI" function int fact(input int i);
program automatic test;
initial begin
for(int i=1; i<=10; i++)
$display("%0d! = %0d", i, fact(i));
end
endprogram
//file: test.cpp
#include "svdpi.h"
int fact(int i){
if(i<=1) return 1;
else return i*fact(i-1);
}
编译命令:
vcs -sverilog test.sv test.cc -CFLAGS "-I $VCS_HOME/linux/lib"
结果:
Parsing design file 'test.sv'
Top Level Modules:
test
No TimeScale specified
Starting vcs inline pass...
2 modules and 0 UDP read.
recompiling module test
All of 3 modules done
g++ -w -pipe -m32 -I /tool/cbar/apps/vcs/2009.12-3/linux/lib -O -I/tool/cbar/apps/vcs/2009.12-3/include -c ../test.cpp
if [ -x ../simv ]; then chmod -x ../simv; fi
g++ -o ../simv -melf_i386 -m32 test.o 5NrI_d.o 5NrIB_d.o jAci_1_d.o Yrj5_1_d.o gzYz_1_d.o SIM_l.o rmapats_mop.o rmapats.o /tool/cbar/apps/vcs/2009.12-3/linux/lib/libvirsim.a /tool/cbar/apps/vcs/2009.12-3/linux/lib/librterrorinf.so /tool/cbar/apps/vcs/2009.12-3/linux/lib/libsnpsmalloc.so /tool/cbar/apps/vcs/2009.12-3/linux/lib/libvcsnew.so /tool/cbar/apps/vcs/2009.12-3/linux/lib/vcs_save_restore_new.o /tool/cbar/apps/vcs/2009.12-3/linux/lib/ctype-stubs_32.a -ldl -lc -lm -lpthread -ldl
gzYz_1_d.o: In function `T_VCSgd_test_1_2_0':
(.text+0x12a): undefined reference to `fact' -------------------------------------------------> look at here!!!!
collect2: ld returned 1 exit status
make: *** [product_timestamp] Error 1
Make exited with status 2
CPU time: .134 seconds to compile + .054 seconds to elab + .523 seconds to link |
|