在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 4160|回复: 3

[原创] modelsim10.0d 混合编译syetem verilog和c代码时错误更正

[复制链接]
发表于 2013-8-19 18:18:45 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

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,欢迎交流...
发表于 2015-3-6 22:40:09 | 显示全部楼层
谢谢楼主真诚的分享啊
发表于 2017-7-14 19:20:23 | 显示全部楼层
回复 1# guolehaohao


   666666666666666666
发表于 2017-7-17 21:42:19 | 显示全部楼层
thank a lot your sharing
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

×

小黑屋| 手机版| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-11-15 10:41 , Processed in 0.020348 second(s), 10 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表