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

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

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 5792|回复: 13

[求助] 关于UVM导入C语言的问题

[复制链接]
发表于 2013-10-21 11:21:34 | 显示全部楼层 |阅读模式

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

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

x
最近遇到一个问题。求大侠们帮助。在reference model中,添加import "DPI-C" function void pass(output bit [47:0] out,input bit [47:0] in);(pass函数在UVM.cpp中定义)

import "DPI-C" function void pass(output bit [47:0] out,input bit [47:0] in);
class hello_model extends uvm_component;
...
endclass

function hello_model::new(string name,uvm_component parent);
    super.new(name,parent);
endfunction

function void hello_model::build_phase(uvm_phase phase);
    ......
endfunction

task hello_model::main_phase(uvm_phase phase);

.....输入vsim +UVM_TESTNAME=hello_case,提示有个warning:Warning: (vsim-3770) Failed to find user specified function 'pass' in DPI precompiled library search list "H:/software2/questasim10.1d/verilog_src/uvm-1.1d/lib/uvm_dpi.dll H:/software2/questasim10.1d/uvm-1.1c\win32\uvm_dpi.dll ".
这是怎么回事啊?thinks
发表于 2013-10-21 14:18:30 | 显示全部楼层
你VSIM中没有加载你的C代码编译生成的.dll文件...
比如说你的UVM代码中import了一个hello_printf()的一个函数,而这个函数是在hello.c文件中的,在你用vsim仿真该uvm工程之前,需要用gcc将hello.c编译成hello.dll文件,然后在vsim中用-sv_lib hello 将其加载进来,这样uvm才能在hello.dll中找到那个hello_printf()的函数....
 楼主| 发表于 2013-10-22 09:15:08 | 显示全部楼层
thanks,师兄能把“gcc将hello.c编译成hello.dll文件”的步奏和命令分享一下吗?谢谢!
发表于 2013-10-22 09:24:14 | 显示全部楼层
太好了,谢谢分享!
 楼主| 发表于 2013-10-22 16:16:49 | 显示全部楼层
thanks,师兄能把“gcc将hello.c编译成hello.dll文件”的步奏和命令分享一下吗?谢谢!
发表于 2013-10-22 21:01:38 | 显示全部楼层
本帖最后由 guolehaohao 于 2013-10-23 08:49 编辑

回复 5# 白兴金
vlog E:/questasim-project/hello_tb_top.sv -dpiheader dpi_types.h
先用vlog通过检查hello_tb_top.sv中import命令生成.h文件,.h文件是C函数和SV函数的桥梁。然后用gcc -I C:/questa_sim_10.0c/include -shared -g -o foreign.dll foreign.c -lmtipli -L C:/questa_sim_10.0c/win32
就可以生成foreign.dll了
建议你看看这个资料 questa_sim_user.pdf (9.57 MB, 下载次数: 88 ) Appendix E Verilog Interfaces to C这一节
或者看这个资料 questa_sim_tut.pdf (2.43 MB, 下载次数: 92 ) 的Chapter 16 Using the SystemVerilog DPI
发表于 2016-1-11 10:33:04 | 显示全部楼层
谢谢 最近正在怎么导入C语言模型
发表于 2016-1-13 09:24:40 | 显示全部楼层
回复 7# onedie
      我个人认为主要是三种,一种是直接导入c,第二种利用dpi,第三种就是pli包括vpi。三种方法各有秋千,我个人比较推荐dpi
发表于 2016-2-28 15:31:09 | 显示全部楼层
thanks !!!!!!!!!!!!!!!!!
发表于 2016-6-27 14:42:26 | 显示全部楼层
回复 8# gogosese

导入c后能用vcs编译吗?我用vcs编译怎么报c的语法错误import前得include c程序吧?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

×

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

GMT+8, 2024-4-26 05:13 , Processed in 0.044795 second(s), 11 queries , Gzip On, Redis On.

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