第三部分 PLI 程序

Verilog PLI教程 第一部分 介绍2007-09-24 来源:数字集成电路设计者 作者:5lifeVerilog PLI(可编程语言接口)是在Verilog代码中运行C或者C++的一种机制。用C/C++写函数编译代码并产生共享库(windows下是*.dll文件,Unix下是*.so文件)。VCS这样的仿真工具也允许静态链接。在verilog代码中调用这些函数…Verilog PLI(可编程语言接口)是在Verilog代码中运行C或者C++的一种机制。 系统调用是指在verilog代码中调用的函数。一个例子:内置系统任务$di 阅读详情

PLI提供两种类型的程序:Access程序;任务和函数程序。Access 程序是能访问verilog内部的信息的C编程语言……

PLI提供两种类型的程序,他们是

  • access程序
  • 任务和函数程序

PLI2.0把access程序和tf程序整合为VPI函数,也澄清了PLI中的一些confusion。

Access 程序
Access 
程序是能访问verilog内部的信息的C编程语言。access程序能执行两个操作:

读取操作: 直接从内部数据结构中读取特定对象的数据。access程序可以读取以下对象的信息:

  •   例化模块
  •   模块端口
  •   模块通路
  •   内部模块通路 
  •   顶层模块
  •   例化primitive
  •   Primitive terminals
  •   线网
  •   寄存器
  •   参数
  •   时序检查
  •   named events
  •   整型,实数和时间变量

写操作:向内部数据结构写入有关对象的新信息。

  •   模块内部通路
  •   模块通路
  •   例化primitives
  •   时序检验
  •   寄存器逻辑值
  •   sequential UDP逻辑值

根据access的操作,可以分为六类:

  •    Fetch: 返回设计层次中不同对象信息
  •    Handle: 返回设计层次中的句柄
  •    Modify: 修改设计层次中各种对象的值
  •    Next:   当在循环结构时,next程序寻找每个符合给定类型的对象
  •    Utility: 执行许多操作,比如初始化和配置access程序环境
  •    VCL: VCL允许PLI 应用程序监测选定对象的值的改变

Access 函数参考

Routine

Description

acc_handle_scope()

This function returns the handle to the scope of an object. The scope can be either a module, task, function, named parallel block, or named sequential block.

acc_handle_by_name()

This routine returns the handle to a Verilog-HDL object based on the specified name and scope.

acc_handle_parent()

This function returns handle for the parent primitive instance or module instance of an object

acc_handle_port()

This function returns handle for a module port

acc_handle_hiconn()

This function returns the hierarchically higher net connection to a scalar module port or a bit of a vector port

acc_handle_loconn()

This function returns the hierarchically lower net connection to a scalar module port or a bit of a vector port.

acc_handle_path()

This function returns a handle to an inter-module path that represents the connection from an output port to an input port

acc_handle_modpath()

This function returns handle to the path of a module

acc_handle_datapath()

This function returns a handle to a datapath for a module instance for the specified edge-sensitive module path

acc_handle_pathin()

This function returns handle for the first net connected to a module path source

acc_handle_pathout()

This function returns handle for the first net connected to a module path destination

acc_handle_condition()

This function returns a handle to the conditional expression for the specified path

acc_handle_tchk()

This function returns handle for the specified timing check of a module (or cell)

acc_handle_tchkarg1()

This function returns handle for the net connected to the first argument of a timing check

acc_handle_tchkarg2()

This function returns handle for the net connected to the second argument of a timing check

acc_handle_simulated_net()

This function returns the simulated net associated with the collapsed net passed as an argument

acc_handle_terminal()

This function returns handle for a primitive_terminal

acc_handle_conn()

This function returns handle to the net connected to a primitive terminal

acc_handle_tfarg()

This function returns handle for the specified argument of the system task or function associated (through the PLI mechanism) with your C-language routine`

acc_fetch_attribute()

This function returns the value of a parameter or specparam named as an attribute in your source description

acc_fetch_paramtype()

This function returns the data type of a parameter as one of three predefined integer constants.

acc_fetch_paramval()

This function returns the value of a parameter or specparam

acc_fetch_defname()

This function returns a pointer to the defining name of a module instance or primitive instance

acc_fetch_fullname()

This function returns a pointer to the full hierarchical name of any named object or module path

acc_fetch_name()

This function returns a pointer to the instance name of any named object or module path

acc_fetch_delays()

This function fetches different delay values for different objects

acc_fetch_size()

This function returns the bit size of a net, register, or port.

acc_fetch_range()

This function retrieves the most significant bit and least significant bit range values for a vector.

acc_fetch_tfarg()

This function returns value of the specified argument of the system task or function associated (through the PLI mechanism) with your C-language routine

acc_fetch_direction()

This function returns the direction of a port or terminal as one of three predefined integer constants.

acc_fetch_index()

This function returns a zero-based integer index for a port or terminal

acc_fetch_edge()

This function returns the edge specifier (type) of a path input or output terminal as one of these predefined integer constants.

acc_set_value()

This function returns a pointer to a character string indicating the logic or strength value of a net, register or variable.

acc_initialize()

This function initializes the environment for access routines

acc_close()

This function frees internal memory used by access routines; resets all configuration parameters to default values

acc_configure()

This function sets parameters that control the operation of various access routines

acc_product_version()

This function returns a pointer to a character string that indicates what version of a Verilog simulator is linked to the access routines

acc_version()

This function returns a pointer to a character string that indicates version number of your access routine software

acc_count()

This function returns an integer count of the number of objects related to a particular reference object

acc_collect()

This function returns a pointer to an array that contains handles for all objects related to a particular reference object

acc_free()

This function frees memory allocated by acc_collect

acc_compare_handles()

This function returns true if the two input handles refer to the same object

acc_object_in_typelist()

This function determines whether an object fits a type or fulltype or exhibits a property specified in an input array

acc_object_of_type()

This function determines whether an object fits a specified type or fulltype, or exhibits a specified property

acc_next_cell()

This function returns the next cell instance within the region that includes the entire hierarchy below a module

acc_next_child()

This function returns the next child of a module

acc_next_modpath()

This function returns the next path of a module

acc_next_net()

This function returns the next net of a module

acc_next_parameter()

This function returns the next parameter within a module

acc_next_port()

This function returns the next input, output or inout port of a module in the order specified by the port list

acc_next_portout()

This function returns the next output or inout port of a module in the order specified by the port list

acc_next_primitive()

This function returns the next gate, switch or user-defined primitive (UDP) within a module

acc_next_specparam()

This function returns the next specparam within a module

acc_next_tchk()

This function returns the next timing check within a module

acc_next_terminal()

This function returns the next terminal of a gate, switch or user-defined primitive (UDP)

acc_next()

This function within a scope, returns the next object of each type specified in object_type_array

acc_next_topmod()

This function returns the next top-level module

acc_next_cell_load()

This function returns the next load on a net inside a cell

acc_next_load()

This function returns the next primitive terminal driven by a net

acc_next_driver()

This function returns the next primitive terminal that drives a net

acc_next_hiconn()

This function returns the next hierarchically higher net connection to a port of a module

acc_next_loconn()

This function returns the next hierarchically lower net connection to a port of a module

acc_next_bit()

This function returns the handles of each bit in an expanded vector port or expanded vector net

acc_next_input()

This function returns a handle to the next input path terminal of the specified module path or datapath

acc_next_output()

This function returns a handle to the next output path terminal of the specified module path or datapath

 

 

 

 

使用access程序流程
就像在前面例子里看见的一样,在我们写用户应用程序的之前,要执行一系列步骤,如下:

1

#include <acc_user.h>

2

 

3

void pli_func() {

4

 

acc_initialize();

5

 

// Main body: Insert the user application code here

6

 

acc_close();

7

}

  • acc_user.h: 所有有关access程序的数据结构
  • acc_initialize(): 初始化变量和建立环境
  • 主体: 用户定义应用
  • acc-close(): 取消acc-initialize执行的操作

对象的句柄
句柄是预定义的数据类型,类似于C中的指针,用来指向设计数据库中的对象和指向任何类型的对象。句柄是access程序的支柱,PLI1.0中引入的最重要的新概念。

申明:

  • handle my_handle;
  • handle clock;
  • handle reset;

VCL(Value change link)
VCL
是一个PLI应用程序来监测被选定对象值的改变

  •    事件
  •    标量和矢量寄存器
  •    标量线网
  •    扩展的矢量线网的位选
  •    未扩展的矢量线网

VCL不能提取有关下面对象的信息:

  •    Bit-selects of unexpanded vector nets or registers
  •    部分选择
  •    存储器
  •    表达式

Verilog ACC 子程序列表 阅读详情

相关推荐

八 WebRTC 关键帧请求PLI与FIR

目录 一 关键帧请求场景 二 PLI与FIR 前言: IDR Request 关键帧也叫做即时刷新帧,简称IDR帧。对视频来说,IDR帧的解码无需参考之前的帧,因此在丢包严重时可以通过发送关键帧请求进行画面的恢复。关键帧的请求方式分为三种:RTCP FIR反馈(Full intra frame request)、RTCP PLI 反馈(Picture Loss Indictor)或SIP Info消息,具体使用哪种可通过协商确定. 一 关键帧请求场景 1.1 H264解码无sps,pps信息 .

zrjliming的博客 2691

#PLI# Verilog PLI 简介(一)

编程语言接口(PLI, Program Language Interface)提供了一套接口子程序,用于访问设计内部的数据结构,并可以提取仿真环境信息。用户可以调用这些子程序,自定义系统任务和系统函数,与设计内部数据以及 Verilog 仿真器环境进行交互。

那么菜的博客 3764

webrtc分析四(关键帧请求,FIR /PLI区别)

webrtc 关键帧请求分PLI,SLI,FIR。但是有何区别? PLI 是Picture Loss Indication 图片丢失提示消息表明突发性的丢包影响到了一个或多个帧中的多个包。发送方可以通过重传这些包或者生成一个新的I帧以作出回应。但一般来说,PLI同时表现得像一个NACK和一个FIR,因此,通过使用PLI,接收端为发送端如何对该请求作出响应提供了更大的灵活度 SLI 是Slice Loss Indication。 切片丢失提示消息表明该包丢失影响到单个帧的部分(即,多个macroblock)。

liuhongxian的专栏 4994

verilog PLI简介

0.简介 Verilog PLI(Programming Language Interface )是一种Verilog代码调用C/C++函数的机制。它能让Verilog像调用一些系统调用(如$display/$stop/$random)一样调用用户编写的C/C++函数。PLI可以完成如下功能: 功耗分析 代码覆盖率工具 修改Verilog仿真数据结构(如修改为更精确的延时,即sdf反标...

weixin_34037515的博客 1043

verilog_PLI参考手册_tf和acc例程详解

verilog_PLI参考手册_tf和acc例程详解

提示deepseek生成完整的json用于对接外部API

通过精准的提示词设计(字段过滤、格式约束)、动态验证机制(自检与修正)和官方模板参考,可有效确保DeepSeek生成的JSON纯净无冗余。

神棍之路 2335

Verilog PLI 简介

Verilog PLI(编程语言接口)是Verilog HDL提供的C/C++交互机制,用于扩展仿真功能。它通过系统任务/函数访问仿真数据,支持信号监控、层次遍历和外部工具集成。PLI包含TF、ACC和VPI三种接口,仅用于仿真不可综合。典型应用包括测试平台开发、调试工具和实时数据交互。使用时需注册PLI任务并链接C代码,注意仿真器依赖性和性能优化。文中通过一个信号打印示例演示了PLI的基本用法,并指出SystemVerilog DPI是现代替代方案。

m0_57545130的博客 1078

ZynqMP双核通信避坑指南:Linux驱动+裸机固件协同开发实录

本文详细解析了Xilinx ZynqMP芯片中APU与RPU双核通信的技术实现,重点介绍了通过IPI中断实现Linux驱动与裸机固件协同开发的实战经验。内容涵盖硬件寄存器配置、Linux驱动开发、RPU裸机程序编写以及双核调试技巧,为开发者提供了一套完整的工程化解决方案,帮助规避常见开发陷阱。

weixin_29168153的博客 133

Verilog PLI介绍及运行NC的三种方法

1. PLI 功能介绍 Verilog PLI(Programming Language Interface )是一种Verilog代码调用C/C++函数的机制。它能让Verilog像调用一些系统调用(如$display/$stop/$random)一样调用用户编写的C/C++函数,这样我们可以用C/C++语言开始自己的system ta...

weixin_34110749的博客 2245

EDA公司(一):Synopsys-- 主要 EDA 工具及其简介

Synopsys 是一家领先的电子设计自动化(EDA)软件公司,提供了一系列全面的产品和服务,旨在支持从概念设计到大规模生产的各个阶段。Synopsys 的 EDA 工具覆盖了芯片设计的各个方面,包括但不限于逻辑综合、静态时序分析、功能验证、物理实现、形式验证、测试插入、电源分析、信号完整性分析等。

MHD0815的博客 3329

华为OD机试真题 新系统 - 计算数列位置N的值 (Java/Py/C/C++/Js/Go)

本文整理华为 OD 机试新系统机考真题库,涵盖高频考点精析与完整题目内容,提供 C 语言、Java、C++、Python、Go、JavaScript 多语言源码实现,搭配详细解题思路讲解,并支持在线 OJ 刷题练习,助力高效备考华为 OD 机试新系统。

算法大师! 2046

第二部分 编写PLI应用程序

 先前我们所看的例子太基础也没有实际用途。让我们看计数器的例子,写一个DUT的参考模型以及用C写的Checker程序,并把它链入到Verilog的Testbench。首先列出我们要用PLI写C模型的要求。  调用C模型的方法,当输入信号有任何变化时;  获得verilog代码中改变了的信号值或者任何C代码内部的信号的方法  通过C代码驱动Verilog内部值VerilogPLI提供一系列满足以上要求的程序(函数)。PLI 应用的SPEC我们定义使用PLI的计数器testbench的要求。 该PLI函数我们称

1220

Python爬虫实战:利用Requests-HTML与异步技术高效爬取B站视频信息及弹幕数据分析

B站的弹幕,远非简单的评论功能,它是一种独特的、实时互动的社交方式,是观众情感的集体宣泄和共鸣。无论是用于内容创作者优化视频结构,还是用于社会学、传播学的研究,亦或是简单的个人兴趣分析,都具备极高的价值。stop_words = {'的', '了', '是', '我', '你', '他', '她', '它', '在', '有', '不', '吗', '吧', '啊', '这', '那'}本文不仅是代码的堆砌,更注重原理的剖析、反爬策略的应对以及工程化的思考,旨在为读者提供一份紧跟技术前沿的实战指南。

2201_76125261的博客 394

Verilog PLI已死( 可能), SystemVerilog DPI当立

Verilog PLI已死( 可能), SystemVerilog DPI当立 SNUG San Jose 2004 作者: Stuart Sutherland 译者: 韦和民 摘要 在古老的英格兰, 当一个君主死掉以后, 一个继承者会立即得到王位. 因此就有了这样的歌谣, “ The king is dead— long live the king!” . 随着新的SystemVerilog 直接编程接口(DPI)的出现, Verilog编 程 语 言 接 口 (PLI)看来也有 了继承者。 那么是不是老

Holden_Liu的博客 4421

Python爬虫实战:实时爬取东方财富网股票行情

东方财富网实时行情(价格、涨跌幅、成交量等)K线图、分时图、技术指标市盈率、换手率、总市值等指标相比某些收费API,东方财富网页端接口不需要登录、免费、响应快、封装清晰,适合爬虫实践。东方财富网股票数据接口分析实时数据抓取与字段提取数据结构化处理自动化批量抓取多线程加速采集数据可视化展示支持存储为CSV/Excel/数据库。

2201_76125261的博客 1万+

【系统分析师】高分论文:论软件需求验证方法及应用

本文以某清算平台建设项目为例,探讨了软件需求验证方法的应用。该项目旨在隔离银行与支付公司的直接通信,满足央行监管要求。作为系统分析师,作者通过需求测试和需求评审两种方法确保需求质量。需求测试采用概念测试用例提前发现问题;需求评审通过正式与非正式形式多方确认需求。项目结合邮件评审、专家会议等方式,最终形成完善的需求文档。平台上线后运行良好,验证了需求管理的重要性。该案例表明,科学的需求验证是项目成功的关键保障。

数据知道的博客 8136

小姜的Verilog PLI Handbook学习笔记

在routines之间分享数据;仿真行为发生;特定的仿真时间;逻辑值发生变化;程序执行语句。

Cloudriver_的博客 1393

YOLOv8 + FireNet 火焰与烟雾检测系统开发指南:算法实现与前端 UI 展示详解

的FireNet火焰与烟雾检测系统,会是你毕设的“王牌项目”。它能实时检测视频流中的火焰与烟雾,还能实现图形界面可视化,从技术深度到成果展示都能让你在答辩中脱颖而出。界面会调用摄像头实时检测火焰与烟雾,检测结果会以带边界框的形式展示,同时给出“检测到火焰/烟雾!无论是学术创新性,还是在工业安防、建筑消防等场景的应用潜力,它都能让你的毕设极具说服力。传统人工监控效率低、易漏检,而基于YOLOv8的自动检测系统能实时识别火焰、烟雾,为火灾预警争取宝贵时间。火灾预防与应急响应是安全领域的核心需求,

know_F0727的博客 78

第二部分 编写PLI应用程序(续)

<br /><br /> 先前我们所看的例子太基础也没有实际用途。让我们看计数器的例子,写一个DUT的参考模型以及用C写的Checker程序,并把它链入到Verilog的Testbench。首先列出我们要用PLI写C模型的要求。  调用C模型的方法,当输入信号有任何变化时;  获得verilog代码中改变了的信号值或者任何C代码内部的信号的方法  通过C代码驱动Verilog内部值<br />VerilogPLI提供一系列满足以上要求的程序(函数)。<br />PLI 应用的SPEC<br />我们定义使用

913

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

modelsim用PLI的方法

modelsim用PLI的方法 本文简要说明windows下面的modelsim,如何调用PLI。 工具: 1.modelsim,我是6.5版 2.MinWG去官网下载 原理: verilog提供的库非常有限,经常需要自己添加一些常用的“库函数”,而这些库函数,反映出来就是一些task,PLI的task。所谓PLI,就是programing language  interfac

tommyjsj的专栏 1867

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

什么是PLI?

首先,什么是PLI? 本部分设定了隐藏,您已回复过了,以下是隐藏的内容 PLI 就是product liability insurance 的简写,中文可以翻译成“产品责任险”说白了,就是你的产品如果出现问题造成事故了,又第三方保险公司负责赔偿。 转载于:https://www.cnblogs.com/pingshuixiangfeng/p/9894081.html...

weixin_33943347的博客 2632

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

PLI, DPI, DirectC,TLI

本文说的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 Pro...

weixin_30471561的博客 666

IVerilog 源码分析 --PLI框架简介

PLI 基础 Verilog 提供了PLI(Programming Language Interface)机制, 用来进行硬件设计和软件设计者进行交互。 它可以在Verilog的设计之中加入用户自定义的系统函数,这些系统函数是通过C语言软件的方式实现, 这可以理解为, 通过插件的方式, 来扩充硬件设计语言的功能。 PLI常见的功能如下: C语言bus函数建模; 访问C语言代码库函数; 延时计算功能; 自定义输出显示; 联合仿真; 设计的debug功能; 仿真结果分析; 我们比较感兴趣的是访问C语言代码库

baijiwei的博客 1565

基于VCS使用VPI+PLI/DPI在verilog中调用C程序进行cover property驱动的仿真控制

本文介绍一种在verilog中,运用PLI机制调用C程序的方法,其中的C程序,可以接受传参,且可以有返回值,仿真器选择的VCS。 编写C程序 #include <stdio.h> //#include "vpi_user.h" //使用PLI有两种机制:TF/ACC机制,或者VPI机制 void hello_calltf(int user_data, int reason) { int var,result; var = tf_getp(1);//取$hello调用时的第

253765952 5321

python verilog 自动化工具,Verilog PLI介绍及运行NC的三种方法

1. PLI 功能介绍Verilog PLI(Programming Language Interface )是一种Verilog代码调用C/C++函数的机制。它能让Verilog像调用一些系统调用(如$display/$stop/$random)一样调用用户编写的C/C++函数,这样我们可以用C/C++语言开始自己的system task/function, 来实现用verilog不太方便的功能...

weixin_35012566的博客 1301
上一篇: 第三部分 PLI 程序
下一篇: verilog语法学习心得
study16
博客等级 码龄18年 18粉丝 55原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址