第三部分 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例程详解

解锁Cherry Studio高阶玩法:用MCP实现自动化测试与数据爬取

本文深入探讨了如何利用MCP协议与Cherry Studio结合,实现自动化测试与数据爬取的高阶应用。通过Playwright等工具的MCP集成方案,详细解析了自动化测试流水线构建和智能爬虫系统开发的关键技术,显著提升工程效率和系统适应性。

defi6farmer的博客 275

Verilog PLI 简介

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

m0_57545130的博客 1075

【NLP】文献翻译4——CH-SIMS:中文多模态情感分析数据集与细粒度的模态注释

CH-SIMS: A Chinese Multimodal Sentiment Analysis Dataset with Fine-grained Annotations of Modality摘要1. 介绍2. 相关工作2.1 多模态数据集2.2 多模态情感分析2.3 多任务学习3. CH-SIMS 数据集3.1 数据获取3.2 标注3.3 特征提取4. 多模式多任务学习框架4.1 单模态子网4.2 特征融合网络4.3 优化目标5. 实验5.1 基准5.2 实验的细节5.3 结果和讨论5.3.1 与

YoungSeng's Blog 1万+

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

DDR的Controller、Channel、Chip、Rank、Bank、Row、Column、Sided、Dimm

DDR的Controller、Channel、Chip、Bank、Rank、Row、Column、Sided、Dimm

张飞online博客 2万+

Amazon SES 移出沙盒完整指南 & 高通过率模板

AWS SES沙盒模式转正式模式申请指南 申请正式模式需通过AWS审核,常见被拒原因包括邮件用途不清晰、缺少退订机制或发送量不合理。人工申诉需登录AWS Support Center提交服务限额提升请求,填写详细的公司信息、邮件用途及合规措施。 高通过率申诉模板需包含: 公司信息:名称、网址及与AWS的合作情况。 邮件规范:明确类型(交易/营销)、退订链接及退信处理机制。 发送计划:合理预估发送量,确保合规。 关键点:真实信息、用途清晰、退订机制完善、发送量合理。首次被拒可修改后重新提交。

xianyinsuifeng的博客 329

第二部分 编写PLI应用程序

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

1220

innovus中如何设置cts参数

上面是设置cts的一般设置,如果需要对某些skew group或者某些clock tree设置不一样的参数,如需要对clk1这个clock设置不一样的inverter,可以使用。需要查询已经设置过的ccopt参数,可以使用get_ccopt_property去查询,方法和set_ccopt_property一致。言归正传,cts的设置命令是set_ccopt_property,获取命令是get_ccopt_property。另外,set_ccopt_property提供一套命令查询方法。

芯冰乐 547

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

32、生物医学中的多模态拉曼散射成像技术

本文综述了多模态拉曼散射成像技术在生物医学领域的应用,重点探讨其在肿瘤研究、癌症无创诊断和组织功能分析中的前沿进展。通过结合自发拉曼、相干拉曼散射(CARS/SRS)、光学相干断层扫描(OCT)、荧光寿命成像(FLIM)及多光子显微技术(TPEF/SHG)等多种模态,实现了对细胞和组织的高特异性生化信息与高分辨率形态学特征的同步获取。文章还介绍了多模态SERS纳米探针的设计及其在靶向成像与治疗一体化中的潜力,并系统分析了不同成像方式的操作流程、优势互补性及临床应用场景。最后展望了该技术向小型化、智能化和个性

zzz56的博客 153

【OpenClaw】Edict 三省六部制部署与启动

文章摘要 本文聚焦Edict系统的本地部署与启动,提供三种安装方式:Docker快速体验、macOS/Linux原生安装和Windows生产仿真。核心目标是让用户能够独立完成系统启动和基础问题排查,确保看板、后端服务、同步脚本和网关正常运行。文章强调环境检查的重要性,并给出具体验收标准:浏览器能访问看板页面(http://127.0.0.1:7891)和接口返回JSON数据。同时提供一键启动/停止脚本和常见问题处理建议,帮助用户快速验证部署结果。配套系列教程涵盖部署启动、使用实战、二次开发和封装版本使用等内

Mr数据杨 2904

小姜的Verilog PLI Handbook学习笔记

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

Cloudriver_的博客 1393

论文阅读:Universal and Transferable Adversarial Attacks on Aligned Language Models. LLM Attacks

因为“即开即用”的大型语言模型能够生成大量令人反感的内容,近期的工作集中在对这些模型进行对齐,以防止不受欢迎的生成。尽管在规避这些措施方面取得了一些成功——即所谓的针对大型语言模型(LLMs)的“越狱”——这些攻击需要大量的人类智慧,并且在实践中很脆弱。自动对抗性提示生成的尝试也取得了有限的成功。在本文中,我们提出了一种简单有效的攻击方法,可以导致对齐的语言模型生成令人反感的行为。

CSPhD-winston的博客 1418

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

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

913

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

modelsim用PLI的方法

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

tommyjsj的专栏 1866

老版QQ原生表情gif动态

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

什么是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、付费专栏及课程。

余额充值