第三部分 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的博客 2688

#PLI# Verilog PLI 简介(一)

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

那么菜的博客 3761

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

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

liuhongxian的专栏 4978

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例程详解

Streamlit安装避坑指南:从零到一键启动你的第一个数据可视化应用

本文提供了一份详尽的Streamlit安装避坑指南,帮助用户从零开始快速启动第一个数据可视化应用。文章深入剖析了安装过程中常见的网络超时、依赖冲突、环境变量缺失等核心问题,并给出了使用虚拟环境、配置国内镜像源、利用.whl文件离线安装等多种经过验证的解决方案,确保安装过程顺畅无阻。

weixin_29065015的博客 616

Verilog PLI 简介

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

m0_57545130的博客 1075

Qt5.14.2+VS2017开发环境搭建全流程(含插件配置与项目测试)

本文详细介绍了Qt5.14.2与VS2017开发环境的完整搭建流程,包括软件安装、插件配置、环境变量设置以及项目测试。特别针对实际开发中常见的配置问题提供解决方案,帮助C++开发者快速搭建高效的Qt开发环境。

weixin_28419039的博客 217

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的博客 2243

完整的申请邓白氏编码的流程(手把手教你申请邓白氏编码)

申请公司的苹果开发者账号和企业级的苹果开发者账号时,都会用到邓白氏编码,也就是我们申请苹果开发者账号时需要填写的D-U-N-S Number。     申请这个邓白氏编码是免费的,但是从像华夏邓白氏公司提交申请到可以申请苹果开发者账号来用这个9位的D-U-N-S Number,需要一段时间,我申请得到D-U-N-S Number,用了8个工作日(不算周末哦)

wxw2011014003的博客 9万+

VS2022+Qt6保姆级配置指南:从插件安装到项目互通全流程(附常见错误解决)

本文提供了一份详细的Visual Studio 2022与Qt6集成开发环境配置指南。从插件安装、环境搭建到项目创建与互通,涵盖了全流程操作步骤,并针对常见的配置错误和调试问题提供了实用的解决方案,帮助开发者高效构建企业级桌面应用。

nginx7reverse的博客 1208

第二部分 编写PLI应用程序

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

1220

数据中心——Vxlan基本概念1

东西流量指的就是横向流量-------例如:服务器与服务器之间交换流量南北流量指的就是纵向流量-------例如:客户端和服务器之间的流量以下主要是讲解业务平面的网络架构(一般业务平面就需要用到专用的数据中心交换机)

m0_49864110的博客 1万+

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的博客 4415

Apache Doris集群IP变更急救指南:用Docker容器+priority_networks快速恢复FE/BE节点

本文详细介绍了Apache Doris集群在IP变更情况下的应急处理方案,通过Docker容器和priority_networks配置快速恢复FE/BE节点。文章提供了从容器化环境构建、元数据迁移到生产环境切换的全流程指南,帮助运维团队在30分钟内完成集群恢复,显著减少停机时间。

pink7的博客 116

Vue3 - [最强] 超详细 Element Plus 组件库主题颜色进行 “统一全局“ 替换,将默认的蓝色主题色更换为其他自定义颜色,覆盖原来的主题色改为自己的颜色(完美解决主题色不生效、没反应)

elementplus修改主题色,vue3+element-plus主题色更换,vue3vite如何修改扩展elementplus主题色样式,全局设置elementplus主题色,有什么办法可以直接全局修改主题色,对elementplus默认蓝色不满意怎么替换更改其他颜色,elementplus覆盖默认主题色,elementplus主题色官方文档,vue3中修改elementplus主题色,elementplus修改主题色不生效怎么办,elementplus如何修改主题颜色,eleme

🏆 前端领域优质创作者 1万+

小姜的Verilog PLI Handbook学习笔记

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

Cloudriver_的博客 1393

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

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

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

913

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

modelsim用PLI的方法

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

tommyjsj的专栏 1866

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

什么是PLI?

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

weixin_33943347的博客 2631

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的博客 665

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

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

baijiwei的博客 1558

基于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 5311

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

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值