第三部分 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

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

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

verilog PLI简介

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

weixin_34037515的博客 1043

解决VMware与Hyper-V/Device Guard冲突的实用指南

本文详细解析了VMware与Hyper-V/Device Guard冲突的根源,并提供了三种实用的解决方案:彻底关闭相关功能、通过启动配置实现选择性引导,以及使用VMware Workstation Pro的Hyper-V兼容模式。指南包含清晰的诊断步骤、操作命令和避坑建议,帮助用户根据自身需求灵活选择,实现虚拟化环境的稳定运行或高效共存。

weixin_29306317的博客 687

强化学习-----DQN(Deep Q-network)

DQN(Deep Q-Network)是一种基于深度学习和强化学习的算法,由DeepMind提出,用于解决离散动作空间下的马尔科夫决策过程(MDP)问题。它是首个成功将深度学习应用于解决强化学习任务的算法之一。DQN,即深度Q网络(Deep Q-network),是指基于深度学习的Q-Learing算法。那什么是Q-leaning?可以看上一篇文章Q-learning是一种经典的强化学习算法,用于解决马尔可夫决策过程(Markov Decision Process,MDP)中的控制问题。

qq_74722169的博客 2万+

三、13【Verilog HDL】编程语言接口(PLI)-自定义系统任务

用户自定义系统任务(PLI)

ARM_qiao的博客 1852

【Cubietruck】Qt5.8.0 x64、x86、armhf三个版本的编译安装

一、       Preparation 以下环境配置支持虚拟机和实体机,但是实体机生产效率会相对高一点,实体机编译Qt的速度是虚拟机两倍以上。 若使用虚拟机,推荐使用VirtualBox,开源免费,尽量不要使用Vmware破解版。   Download List   名称 链接 下载项目 OS https://mirro

beatfan的博客 3658

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

搞定安卓11+抓包难题:用Kitsune Mask、magic_overlayfs和LSPosed三件套绕过SSL Pinning(保姆级教程)

本文详细解析了安卓11+系统中抓包面临的核心挑战,包括SSL Pinning和Root检测机制,并提供了使用Kitsune Mask、magic_overlayfs和LSPosed三件套的完整解决方案。通过动态分区技术解析和工具链配置,帮助开发者绕过安全限制,实现高效抓包分析。

weixin_42665255的博客 445

MeloTTS 生成 RKNN 模型

摘要: 本方案基于RK3588平台,利用RKNN工具链实现高效语音合成(TTS)。采用MeloTTS开源模型,支持中英文混合语音生成。部署流程包括:1) 导出ONNX模型;2) 转换为RKNN格式;3) 在RK3588开发板运行。关键步骤包含环境配置(RKNN Toolkit2≥1.4.0)、模型转换(非量化处理)及音频处理实现。方案充分发挥RK3588的NPU加速能力,适用于边缘设备语音合成场景

J。 353

Verilog PLI 简介

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

m0_57545130的博客 1075

基于 高斯过程回归(Gaussian Process Regression, GPR) 的 时间序列区间预测 的 MATLAB 示例代码

基于 高斯过程回归(Gaussian Process Regression, GPR) 的 时间序列区间预测 的 MATLAB 示例代码

算法如诗的博客 156

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

DRM遇到的实际问题及领悟(3)

DRM遇到的实际问题及领悟(3)

phmatthaus的专栏 639

Statistics and Machine Learning Toolbox

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

第二部分 编写PLI应用程序

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

1220

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

小姜的Verilog PLI Handbook学习笔记

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

Cloudriver_的博客 1393

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

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

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

913

modelsim用PLI的方法

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

tommyjsj的专栏 1866

什么是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

WEBRTC 的RTP/RTCP的 NACK, PLI,SLI,FIR

在网络环境不是太好的情况下,比如网络拥塞比较严重,丢包率可能比较高,简单实用NACK重传的机制,这样就会有大量的RTCP NACK报文,发送端收到相应的报文,又会发送大量指定的RTP报文,反而会增加网络的拥塞程度,可能导致更高的丢包率,导致接收端解码失败,导致花屏等马赛克现象。

thehunters的专栏 1762
上一篇: 第二部分 编写PLI应用程序(续)
下一篇: 第三部分 PLI 程序
study16
博客等级 码龄18年 18粉丝 55原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值