ProgrammingLanguageInterface (PLI)
ProgrammingLanguageInterface (PLI)
Contents
PLI History Verilog PLI Overview Verilog VPI Routines Cadence VPI Environment Mentor Graphics VPI Environment References
Test Seminar
PLI History
1985 - The PLI was developed by Gateway Design Automation as part of the proprietary Verilog-XL simulator 1990 - The PLI standard was released to the public domain along with the Verilog HDL and Verilog SDF standards by Cadence Design System 1990 - Open Verilog International (OVI) owned the Verilog HDL, the OVI version of the PLI was called PLI 1.0 1993 - OVI released PLI 2.0, a completely new interface, intended to replace PLI 1.0 1993 - OVI submitted Verilog to the IEEE for standardization 1995 -The IEEE-1364-1995 Verilog PLI standard was released 2001 -The IEEE-1364-2001 Verilog HDL & PLI standard updated with many new language features many new language features
Test Seminar
Task/Function Routines (TF Routines, tf_) Access Routines (ACC Routines, acc_) Verilog Procedural Interface Routines (VPI Routines, vpi_)
Test Seminar
Memory Restriction
Test Seminar
Interface
Call-backs
vpi_register_cb()
Test Seminar
Call-backs
Simulation Call-backs
Simulation Action and Features Simulation Times Simulation Events
Time Queue
Test Seminar
Object Definition
Object Reference
Class Definition
Class Reference
Unnamed Class
Test Seminar
Test Seminar
itr = vpi_iterate (obj, ref_h); while (obj_h = vpi_scan (itr)) { process obj_h}
itr = vpi_iterate (Tag, ref_h); while (obj_h = vpi_scan (itr)) { process obj_h}
itr = vpi_iterate (obj, NULL); while (obj_h = vpi_scan (itr)) { process obj_h}
Test Seminar
10
Identified Routines
Test Seminar
11
Test Seminar
12
vpiHandle net, mod; net = vpiHandle_by_name (top.m1.w, NULL); mod = vpi_handle (vpiModule, net);
Test Seminar
13
vpiHandle itr; itr = vpi_iterate(vpiNet, mod); while (net = vpi_scan (itr)) vpi_printf(%s\n, vpi_get_str (vpiFullName, net));
Test Seminar
14
void traverseExpr (vpiHandle expr) { vpiHandle subExprI, subExprH; switch (vpi_get (vpiExpr, expr)) { case vpiOperation: subExprI = vpi_iterate (vpiOperand, expr); if (subExprI) while (subExprH = vpi_scan (subExprI)) traverseExpr (subExprH); default: break; }}
Test Seminar
15
Line Properties
Test Seminar
Test Seminar
17
Test Seminar
18
Test Seminar
19
Test Seminar
20
Test Seminar
21
Test Seminar
22
Test Seminar
23
vpi_get_time(): Find the current simulation time or the scheduled time of future events
Test Seminar
24
vpi_printf() vpi_vprintf() vpi_flush() vpi_mcd_open() vpi_mcd_close() vpi_mcd_printf() vpi_mcd_vprintf() vpi_mcd_flush() vpi_mcd_name() vpi_get_vlog_info() vpi_compare_objects() vpi_chk_error() vpi_free_object() vpi_put_data() vpi_get_data() vpi_put_userdata() vpi_get_userdata() vpi_sim_control()
Test Seminar
25
Test Seminar
26
Test Seminar
27
Test Seminar
28
Test Seminar
29
Creating a C Function
#include <stdio.h> #include vpi_user.h int hello_task () { vpi_printf (Hello from a new VPI task \n);}
extern C void ncmain (int, char **); main(argc, argv) int argc; char* argv[]; { ncmain(argc, argv); }
Test Seminar
30
void register_my_systfs () { s_vpi_systf_data task_data_s; p_vpi_systf_data task_data_p = &task_data_s; task_data_p->type = vpiSysTask; task_data_p->tfname = $hello ; task_data_p->calltf = (int(*)()) hello_task; task_data_p->compiletf = NULL; vpi_register_systf (task_data_p); }
Test Seminar
31
Test Seminar
32
Static/Dynamic
cc -KPIC -c ~/vpi_user.c -I<InstDir>/include cc -KPIC -c ~/hello.c -I<InstDir>/include ld -G vpi_user.o hello.o -o libvpi.so executable file
setenv LD_LIBRARY_PATH \ ~/<LibDir>:$LD_LIBRARY_PATH ncelab access+rwc worklib.top:v ncverilog +ncaccess+rwc +plinowarn hello.v
Test Seminar
33
Compiling C Files
Test Seminar
34
References
Cadence Design Systems, Inc., VPI User Guide and Reference, Product Version 3.2, Dec. 2000. Cadence Design Systems, Inc., NCVerilog Simulator Help, Product Version 3.2, Dec. 2000. Cadence Design Systems, Inc., Verilog-XL User Guide and Reference, Product Version 2.8, Aug. 1999. Mentor Graphics, ModelSim SE User's Manual, Version 5.7a, Jan. 2003 Stuart Sutherland, The Verilog PLI Handbook, Kluwer Academic Publishers, 2002. Swapnajit Mittra, Principles of Verilog PLI, Kluwer Academic Publishers, 1999.
Test Seminar
35