|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
今天试图搞清楚system verilog 中的DPI的用法,使用questa Sim10.0c自带的例子(我的例子目录为:H:\questa_sim_10.0c\examples\tutorials\systemverilog,用的例子是data_passing),但是在具体编译的过程中老是编译不过去,运行自带的windows.bat之后提示如下:
H:\modelsim-project\data_passing>vlib work
** Warning: (vlib-34) Library already exists at "work".
H:\modelsim-project\data_passing>vlog test.sv -dpiheader dpi_types.h
QuestaSim vlog 10.0c Compiler 2011.07 Jul 21 2011
-- Compiling module test
Top level modules:
test
H:\modelsim-project\data_passing>vopt +acc test -o opt_test
QuestaSim vopt 10.0c Compiler 2011.07 Jul 21 2011
Top level modules:
test
Analyzing design...
-- Loading module test
Incremental compilation check found no design-units have changed.
Optimized design name is opt_test
H:\modelsim-project\data_passing>gcc -I H:\questa_sim_10.0c;\include -shared -g
-o foreign.dll foreign.c -lmtipli -L H:\questa_sim_10.0c;\win32
foreign.c: In function 'print_int':
foreign.c:5: warning: incompatible implicit declaration of built-in function 'pr
intf'
foreign.c: In function 'print_logic':
foreign.c:12: warning: incompatible implicit declaration of built-in function 'p
rintf'
h:/questa_sim_10.0c/bin/../libexec/gcc/mingw32/4.2.1/ld.exe: cannot find -lmtipl
i
collect2: ld returned 1 exit status
H:\modelsim-project\data_passing>vsim -i opt_test -sv_lib foreign -do "view sour
ce"
Reading H:/questa_sim_10.0c/tcl/vsim/pref.tcl
尤其是下划线的那里,提示cannot find -lmtipl 在网上找了很多方法,都说是缺少那个库文件...然后我在网上找库文件...都找不到。
后面在编辑该bat文件的时候突然想起来昨天在搭建uvm验证环境的时候提示gcc-4.21不支持64位操作系统,具体表现在不支持系统环境变量。因此我想是不是批处理文件中环境变量不能识别的的问题...因此将windows.bat中的 %QUESTA_HOME%更换成H:\questa_sim_10.0c
,然后再编译,就能通过,最终执行结果如下:
H:\modelsim-project\data_passing>vlib work
** Warning: (vlib-34) Library already exists at "work".
H:\modelsim-project\data_passing>vlog test.sv -dpiheader dpi_types.h
QuestaSim vlog 10.0c Compiler 2011.07 Jul 21 2011
-- Compiling module test
Top level modules:
test
H:\modelsim-project\data_passing>vopt +acc test -o opt_test
QuestaSim vopt 10.0c Compiler 2011.07 Jul 21 2011
Top level modules:
test
Analyzing design...
-- Loading module test
Incremental compilation check found no design-units have changed.
Optimized design name is opt_test
H:\modelsim-project\data_passing>gcc -I H:\questa_sim_10.0c\include -shared -g -
o foreign.dll foreign.c -lmtipli -L H:\questa_sim_10.0c\win32
foreign.c: In function 'print_int':
foreign.c:5: warning: incompatible implicit declaration of built-in function 'pr
intf'
foreign.c: In function 'print_logic':
foreign.c:12: warning: incompatible implicit declaration of built-in function 'p
rintf'
H:\modelsim-project\data_passing>vsim -i opt_test -sv_lib foreign -do "view sour
ce"
Reading H:/questa_sim_10.0c/tcl/vsim/pref.tcl
在questa Sim中点击run后,得到如下结果:
# // Questa Sim
# // Version 10.0c win32 Jul 21 2011
# //
# // Copyright 1991-2011 Mentor Graphics Corporation
# // All Rights Reserved.
# //
# // THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION
# // WHICH IS THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS
# // LICENSORS AND IS SUBJECT TO LICENSE TERMS.
# //
# vsim -do {view source} -i -sv_lib foreign opt_test
# Loading sv_std.std
# Loading work.test(fast)
# Loading .\foreign.dll
# view source
# .main_pane.source.interior.cs.body.editor
#
run
# Just received a value of 0.
# Just received a value of 1.
# Just received a value of -12.
# Just received a value of 0.
# Just received a value of 1.
# Just received a value of 0.
# Just received a value of 1.
# Just received a value of 0.
# Just received a value of logic X.
# Just received a value of logic Z.
# Just received a value of logic 0.
今天搞这个折腾了一天时间...有时候一个很小的问题导致进展很缓慢...
今天得到一个不算是经验的经验,就是解铃还需系铃人,其实是questa Sim出的问题,因此还得从questa Sim查找原因...今天能很快找到问题的一个主要原因是参考了questa Sim的用户手册
questa_sim_tut.pdf
(3.09 MB, 下载次数: 42 )
,里面的第17章详细讲述了Using SystemVerilog DPI for Data Passing...
问题总算解决了...不过这个gcc也该支持64位系统了...期待更新...
我的邮箱guolehaohao@163.com,欢迎交流... |
|