022天津同城交友网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 交友 人才 房产
查看: 827|回复: 1
打印 上一主题 下一主题

modelsim10.0d 混合編译syetem verilog和c代码时错误更正

[复制链接]
跳转到指定楼层
楼主
发表于 2020-4-7 18:48:04 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    文章简介:今天试图搞清楚systemverilog中的DPI的用法,使用questH:\modelsim-project\data_passing>gccforeign.c:5:warning:incompatibleimplforeign.c:12:warning:incompatibleimph:/questa_sim_10.0c/bin/../libexec/gH:\modelsim-project\data_passing>vsi后面在编辑该bat文件的时候突然想起来昨天在搭建uvm验证环境的时候提示H:\modelsim-project\data_passing>gccforeign.c:5:warning:incompatibleimplforeign.c:12:warning:incompatibleimpH:\modelsim-project\data_passing>vsi今天得到一个不算是经验的经验,就是解铃还需系铃人,其实是questaSi



今天试图搞清楚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  
下载积分: 资产 -2 信元, 下载支出 2 信元
,里面的第17章详细讲述了Using SystemVerilog DPI for Data Passing...
问题总算解决了...不过这个gcc也该支持64位系统了...期待更新...
我的邮箱guolehaohao@163.com,欢迎交流...

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享
回复

使用道具 举报

沙发
发表于 2020-4-7 18:48:07 | 只看该作者
谢谢楼主真诚的分享啊
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|联系我们|022天津同城交友网

GMT+8, 2024-5-5 18:31 , Processed in 1.343750 second(s), 16 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表