微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微电子和IC设计 > IC验证交流 > 关于对cadence 的dpi例子的运行问题

关于对cadence 的dpi例子的运行问题

时间:10-02 整理:3721RD 点击:
大家好
我在运行cadence自带的dpi的实例时,有问题
Unable to load the default library libdpi.
./libdpi.so: cannot open shared object file:No such file or directory
我已经在当前目录下生成了该libdpi.so文件,为什么会有这个问题呢?
谢谢大家指点。

哪个例子,什么命令啊?

/opt/cadence/IUS56/doc/dpiEngrNtbk
里面的simple_ad
很简单的程序
但是我按照他的要求进行操作:
To run this example using NC-Verilog:

1) Compile the design using the following command:

ncvlog -messages -sv top.v

2) Elaborate the design using the following command:

ncelab -messages -access +RWC worklib.top

3) In the current directory, create a shared object library called libdpi.so (for Solaris, Linux,
or AIX), or libdpi.sl (for HP-UX).

For example, using a gcc compiler:

gcc -fPIC -shared -o libdpi.so adder.c -I$CDS_INST_DIR/tools/inca/include

For example, using a cc compiler:

cc -KPIC -G -o libdpi.so -I$CDS_INST_DIR/tools/inca/include adder.c

where $CDS_INST_DIR points to the installation.

4) Simulate the design using the following command:

ncsim -messages worklib.top
但是到了最后就会出现:说找不到libdpi.so,但是这个文件已经生成了呀?奇怪!

哦 没用过
$CDS_INST_DIR这是你的安装目录么?

问题解决了,
谢谢大家,
我的问题不具备通用性,但可以给遇到类似问题的人们一些提示:
我的服务器是64位的,因此我用gcc编译出来的.so共享库也是64位的,而
dpi这个程序本身是32位的。因此程序运行后找不到.so
只要在gcc的参数加上 -m32即可,gcc会生成32位的程序。
gcc -m32 -fPIC -shared -o libdpi.so adder.c -I$CDS_INST_DIR/tools/inca/include
谢谢大家!

Great。

xuexiliao

你好 ,我最近也在弄DPI ,也用到CANDENCE的DPI例子, 后来又自己弄了例子想实践一把,但是遇到了问题。想向您请教,这个问题我发了几天帖子了,无人问津啊,于是毫不容易找到了你弄过这个。
DPI接口使用
下面是需要导入的C函数
#include “stdio.h”
#include “svdpi.h”
int addr2(svBitBecValw[255])
{unsigned char z=0;
int i;
(for i=0;i<255;i=i++)
{ z+=w;
io_printf(“z: %d” ,z);
}
return z;
}
下面是top.v文件的部分程序
top;
import "DPI-C" function int adder2(input bit [0:0] w[255]);
reg[254:0] data_in;//(这个是verilog的输入,我要输入给C函数,必须转换为数组的形式 ,
//所以下面就通过bit[0:0]a [255];转化一下)
bit[0:0]a [255];
int i;
for(for i=0;i<255;i=i++)
begin
data_in=1;
a=data_in;
end
$display ("%d", adder2(a) );
最后仿真打印出的数据正常,结果为 255。

但是我想把这个C函数wrapper起来,变成一个具有verilog接口的.V文件。主要是想直接接到[254:0] data_in的接口上,于是我在wrapper文件中做了这样的处理
运用了verilog函数
wrapper(
data_in;
data_out;
)
import "DPI-C" function int adder2(input bit [0:0] w[255]);
input [254:0] data_in;
output [7:0] data_out;
function [7:0] result;
input [254:0] data_in;
bit [0:0] a [255];
integer i;
for(for i=0;i<255;i=i+1)
a=data_in;
result=addr2(a);
endfunction
assgin data_out =result(data_in);
整个过程相对之前只是把C函数需要的入口为数组的转换由原来的顶层文件放在了这个wrapper文件中,
但是在最后我仿真时却发现结果不对。
原来C语言打印出来的Z的结果是很规律的 1,2,3.。一直到255
现在我看C打印出来Z的结果很乱 一开始就是145,。毫无规律。最后算出的结果居然是241。
麻烦您帮我看看啊, 实在是找不出问题出在哪里了

可能是你用的盗版软件打 patch的时候误伤了cadence 的动态链接库.so文件

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

网站地图

Top