PLI, DPI, DirectC,TLI

本文详细介绍了Verilog PLI的VPI接口,包括创建VPI应用的步骤、VPI的分类和特殊数据类型。此外,还提到了DPI在SystemVerilog中的角色,以及VCS中的DirectC和TLI功能组件。PLI的VPI库被分为五组基本例程,与之相关的是一对一、一对多和多对一的关系。VPI允许对Verilog模块进行更深入的操作。

本文说的PLI,特指PLI 2, VPI。DPI是SV标准中组成,而DirectC和TLI是VCS中的功能组件。

关于PLI的文献只有Verilog PLI Handbook这本书。并且Verilog PLI是一本相对成熟的技术。PLI有三个libraries, TF(task/function) interface, ACC(access) interface, 以及VPI(Verilog Procedural Interface),连同DPI,四者的时间先后顺序是1985-1989-1995-2003。而前面两个已经在IEEE 1364-2005(IEEE 1364就是verilog std)中被删除。所以重要的就是VPI和DPI。

part 1 VPI

Handbook一书中part 1的7章介绍了VPI的构建及应用。

1. 创建VPI应用。共分为四步($hello system task为例)。

 先是在Verilog module中引用,即调用$hello()或者$hello;

》》然后是编写一个calltf routine for $hello,这个routine 是VPI和C mixed,其中需要include "vpi_user.h"包含VPI的数据结构,也可以调用C std libraries 来使用C语言的相应函数。

》》注册编写的VPI 函数,因为是calltf routine,调用s_vpi_systf_data(s_vpi_systf_data,以s_开头的为struct结构体,以t_开头的表示数据类型,以p_开头的表示指针指向struct结构体)结构,并做好相应的注册。

》》Compiling and linking $hello system task。

2a. VPI的分类 

calltf routines, ---The calltf routine is executed when simulation is running

compiletf routines, --- The compiletf routine should only be used for syntax checking, routine called before simulation time 0

sizetf routines ---  A sizetf routine is called one time, before simulation time 0.

sizetf的作用:The intent of the sizetf routine is to notify the simulator compiler or elaborator of the return size for system functions 

注: even if a system function used multiple times in verilog code, sizetf routine is only called once.

simulation callback routines 

typedef struct t_cb_data
{
 PLI_INT32   &nbs
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值