数字集成电路设计15 DPI(续)
发布时间
阅读量:
阅读量
引言
在SV中,不论是生成测试激励,还是模拟硬件的并行操作,DPI都提供了极大的便利性。此前我们已讲解了在SV中利用“import”关键字引入并调用C语言函数的方法。
本部分内容将通过一个简单的实例,阐述C语言函数如何实现对SV中task和function的调用过程。
1,SV部分
/* * test.v Rill create for dpi test at 2014-10-20
*/
`timescale 1ns/1ns
module tb;
import "DPI-C" context function int c_func(input int num);// or import "DPI-C" context task c_display(input int num);
reg tmp;
initial begin
#10
tmp = c_func(1);
end
m1 M1();
m2 M2();
endmo
全部评论 (0)
还没有任何评论哟~
