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 部分选择 存储器 表达式