微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微电子和IC设计 > IC验证交流 > 求助:PLI使用中的报错

求助:PLI使用中的报错

时间:10-02 整理:3721RD 点击:
最近自学,在搞PLI,参考一些稀少的材料,做了个最简单的pli,可是还是报错……
废话说少,如下:
c代码hello.c
#include "veriuser.h"
static PLI_INT32 hello()
{
io_printf("Fuck PLI!\n");
return 0;
}
s_tfcell veriusertfs[]={
{usertask,0,0,0,hello,0,"$hello"},
{0}
};
v代码hello.v
module hello;
initial $hello;
endmodule
生成hello.dll文件copy到modelsim的win32文件夹下
modelsim下输入:vsim -c -pli hello.dll hello
报错:
# ** Error: (vsim-PLI-3001) Failed to find init_usertfs function or veriusertfs array or vlog_startup_routines array in PLI object file "C:\Modeltech_6.0\win32/hello.dll".
呼唤明白人解释,自己琢磨实在是没有头绪……唉……

小编这个问题解决了没呢?我也遇到了同样的问题

我也遇到这个问题,请问找到原因了吗?

如果使用的是vs的C++环境,可以在每个函数前面加:extern "C" __declspec(dllexport)
修改后的代码是:
extern "C" __declspec(dllexport)PLI_INT32 hello()
{
setbuf(stdout,(char*)(0));
printf("hello pli");
return 0;
}
extern "C" __declspec(dllexport)s_tfcell veriusertfs[] = {
{usertask, 0, 0, 0, hello, 0, "$hello"},
{0} /* last entry must be 0 */
};

不错的资料

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top