2001-03-19 02:21:45 +01:00
|
|
|
#ifndef __vpi_user_H
|
|
|
|
|
#define __vpi_user_H
|
|
|
|
|
/*
|
2010-03-14 07:16:27 +01:00
|
|
|
* Copyright (c) 1999-2010 Stephen Williams (steve@icarus.com)
|
2001-03-19 02:21:45 +01:00
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2001-05-20 17:09:39 +02:00
|
|
|
#if defined(__MINGW32__) || defined (__CYGWIN32__)
|
2001-03-19 02:21:45 +01:00
|
|
|
# define DLLEXPORT __declspec(dllexport)
|
|
|
|
|
#else
|
|
|
|
|
# define DLLEXPORT
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
2001-04-25 06:45:52 +02:00
|
|
|
# define EXTERN_C_START extern "C" {
|
|
|
|
|
# define EXTERN_C_END }
|
|
|
|
|
#else
|
|
|
|
|
# define EXTERN_C_START
|
|
|
|
|
# define EXTERN_C_END
|
2001-03-19 02:21:45 +01:00
|
|
|
#endif
|
|
|
|
|
|
2002-05-24 21:05:30 +02:00
|
|
|
#ifndef __GNUC__
|
|
|
|
|
# undef __attribute__
|
|
|
|
|
# define __attribute__(x)
|
|
|
|
|
#endif
|
|
|
|
|
|
2001-04-25 06:45:52 +02:00
|
|
|
EXTERN_C_START
|
|
|
|
|
|
2002-05-23 05:34:46 +02:00
|
|
|
# include <stdarg.h>
|
2003-05-23 06:04:02 +02:00
|
|
|
# include <stdio.h>
|
2003-02-17 07:39:47 +01:00
|
|
|
# include "_pli_types.h"
|
2002-05-23 05:34:46 +02:00
|
|
|
|
2001-03-19 02:21:45 +01:00
|
|
|
typedef struct __vpiHandle *vpiHandle;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This structure is created by the VPI application to provide hooks
|
|
|
|
|
* into the application that the compiler/simulator can access.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct t_vpi_systf_data {
|
2003-03-13 19:26:12 +01:00
|
|
|
PLI_INT32 type;
|
2004-02-19 22:32:46 +01:00
|
|
|
PLI_INT32 sysfunctype;
|
2003-12-07 21:06:24 +01:00
|
|
|
const char *tfname;
|
2007-03-14 05:05:51 +01:00
|
|
|
PLI_INT32 (*calltf) (PLI_BYTE8*);
|
|
|
|
|
PLI_INT32 (*compiletf)(PLI_BYTE8*);
|
|
|
|
|
PLI_INT32 (*sizetf) (PLI_BYTE8*);
|
|
|
|
|
PLI_BYTE8 *user_data;
|
2001-03-19 02:21:45 +01:00
|
|
|
} s_vpi_systf_data, *p_vpi_systf_data;
|
|
|
|
|
|
|
|
|
|
/* The type in the above structure can have one of the following
|
|
|
|
|
values: */
|
|
|
|
|
#define vpiSysTask 1
|
|
|
|
|
#define vpiSysFunc 2
|
|
|
|
|
|
|
|
|
|
typedef struct t_vpi_vlog_info
|
|
|
|
|
{
|
2003-03-13 19:26:12 +01:00
|
|
|
PLI_INT32 argc;
|
|
|
|
|
char **argv;
|
|
|
|
|
char *product;
|
|
|
|
|
char *version;
|
2001-03-19 02:21:45 +01:00
|
|
|
} s_vpi_vlog_info, *p_vpi_vlog_info;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct t_vpi_time {
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
/*
|
|
|
|
|
Type can be :
|
|
|
|
|
|
|
|
|
|
vpiScaledRealTime == 1
|
|
|
|
|
vpiSimTime == 2
|
|
|
|
|
vpiSuppressTime == 3
|
|
|
|
|
*/
|
|
|
|
|
|
2003-03-13 19:26:12 +01:00
|
|
|
PLI_INT32 type;
|
|
|
|
|
PLI_UINT32 high;
|
|
|
|
|
PLI_UINT32 low;
|
2001-03-19 02:21:45 +01:00
|
|
|
double real;
|
|
|
|
|
} s_vpi_time, *p_vpi_time;
|
|
|
|
|
|
|
|
|
|
#define vpiScaledRealTime 1
|
|
|
|
|
#define vpiSimTime 2
|
|
|
|
|
#define vpiSuppressTime 3
|
|
|
|
|
|
|
|
|
|
typedef struct t_vpi_vecval {
|
2003-03-13 19:26:12 +01:00
|
|
|
PLI_INT32 aval, bval; /* ab encoding: 00=0, 10=1, 11=X, 01=Z */
|
2001-03-19 02:21:45 +01:00
|
|
|
} s_vpi_vecval, *p_vpi_vecval;
|
|
|
|
|
|
2001-05-10 02:16:00 +02:00
|
|
|
typedef struct t_vpi_strengthval {
|
2003-03-13 19:26:12 +01:00
|
|
|
PLI_INT32 logic;
|
|
|
|
|
PLI_INT32 s0, s1;
|
2001-05-10 02:16:00 +02:00
|
|
|
} s_vpi_strengthval, *p_vpi_strengthval;
|
|
|
|
|
|
2001-03-19 02:21:45 +01:00
|
|
|
/*
|
|
|
|
|
* This structure holds values that are passed back and forth between
|
|
|
|
|
* the simulator and the application.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct t_vpi_value {
|
2003-03-13 19:26:12 +01:00
|
|
|
PLI_INT32 format;
|
2001-03-19 02:21:45 +01:00
|
|
|
union {
|
2003-03-13 19:26:12 +01:00
|
|
|
char *str;
|
|
|
|
|
PLI_INT32 scalar;
|
|
|
|
|
PLI_INT32 integer;
|
2001-03-19 02:21:45 +01:00
|
|
|
double real;
|
|
|
|
|
struct t_vpi_time *time;
|
|
|
|
|
struct t_vpi_vecval *vector;
|
|
|
|
|
struct t_vpi_strengthval *strength;
|
2003-03-13 19:26:12 +01:00
|
|
|
char *misc;
|
2001-03-19 02:21:45 +01:00
|
|
|
} value;
|
|
|
|
|
} s_vpi_value, *p_vpi_value;
|
|
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
|
|
|
|
|
/*
|
2008-09-04 18:41:51 +02:00
|
|
|
|
|
|
|
|
Conform the IEEE 1364, We add the
|
|
|
|
|
Standard vpi_delay structure to
|
2007-09-11 00:30:00 +02:00
|
|
|
enable the modpath delay values
|
|
|
|
|
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
Conform IEEE 1364, Pg 670 :
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
The "da" field of the s_vpi_delay
|
|
|
|
|
structure shall be a user allocated
|
2008-01-01 18:45:02 +01:00
|
|
|
array of "s_vpi_time" structure
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2008-01-01 18:45:02 +01:00
|
|
|
The array shall store delay values returned
|
2007-09-11 00:30:00 +02:00
|
|
|
by vpi_get_delay(). The number of elements in
|
|
|
|
|
the array shall be determined by
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2008-01-01 18:45:02 +01:00
|
|
|
(1) The number of delays to be retrieved
|
2007-09-11 00:30:00 +02:00
|
|
|
( normally this is used in vpi_get_delays (..) )
|
2008-09-04 18:41:51 +02:00
|
|
|
{
|
2008-06-10 18:02:24 +02:00
|
|
|
(1.1) Set by "no_of_delays" field
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
(1.2) For the primitive_object, the no_of_delays
|
|
|
|
|
shall be 2 or 3
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
(1.3) For path_delay object the no_of_delays shall
|
|
|
|
|
be 1,2,3,6, 12
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
(1.4) For timing_check_object, the no_of_delays shall
|
2008-09-04 18:41:51 +02:00
|
|
|
be match the number of limits existing in the
|
2007-09-11 00:30:00 +02:00
|
|
|
Time Check
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
(1.5) For intermodule_path object, the no_of_delays shall
|
|
|
|
|
be 2 or 3
|
|
|
|
|
}
|
|
|
|
|
|
2008-09-04 18:41:51 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
(2) The "mtm_flag" && "pulsere_flag"
|
|
|
|
|
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
Normally, if you set mtm = X, pulsere = Y
|
|
|
|
|
then, you will need allocate (num * no_of_delay)
|
|
|
|
|
s_vpi_time elements for 'da' array before calling
|
|
|
|
|
the vpi_get/put_delays (..)
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
---------------------------------------------------------------------------
|
|
|
|
|
| | | |
|
|
|
|
|
| mtm_flag | No of s_vpi_time array | order in which delay |
|
|
|
|
|
| pulsere_flag | element required by the | elements shall be filed |
|
|
|
|
|
| | s_vpi_delay->da | |
|
|
|
|
|
| | | |
|
|
|
|
|
|----------------|-------------------------|------------------------------|
|
|
|
|
|
| | | 1o delay da[0]--> 1o delay |
|
|
|
|
|
| mtm = false | no_of_delay | 2o delay da[1]--> 2o delay |
|
|
|
|
|
| pulere = false | | |
|
|
|
|
|
| | | |
|
|
|
|
|
|----------------|-------------------------|------------------------------|
|
|
|
|
|
| | | 1o delay da[0]--> min delay |
|
|
|
|
|
| mtm = true | | da[1]--> typ delay |
|
|
|
|
|
| pulere = false | 3*no_of_delay | da[2]--> max delay |
|
|
|
|
|
| | | 2o delay da[3]--> min delay |
|
|
|
|
|
| | | da[4]--> typ delay |
|
|
|
|
|
| | | .... |
|
|
|
|
|
|----------------|-------------------------|------------------------------|
|
|
|
|
|
| | | 1o delay da[0]--> delay |
|
|
|
|
|
| mtm = false | | da[1]--> rej limit |
|
|
|
|
|
| pulere = true | 3*no_of_delay | da[2]--> err limit |
|
|
|
|
|
| | | 2o delay da[3]--> delay |
|
|
|
|
|
| | | da[4]--> rej limit |
|
|
|
|
|
| | | .... |
|
|
|
|
|
|----------------|-------------------------|------------------------------|
|
|
|
|
|
| | | 1o delay da[0]--> min delay |
|
2008-09-04 18:41:51 +02:00
|
|
|
| mtm = true | | da[1]--> typ delay |
|
2007-09-11 00:30:00 +02:00
|
|
|
| pulere = true | 9*no_of_delay | da[2]--> max delay |
|
|
|
|
|
| | | da[3]--> min delay |
|
|
|
|
|
| | | da[4]--> typ delay |
|
|
|
|
|
| | | da[5]--> max delay |
|
|
|
|
|
| | | da[6]--> min delay |
|
|
|
|
|
| | | da[7]--> typ delay |
|
|
|
|
|
| | | da[8]--> max delay |
|
|
|
|
|
| | | 2o delay da[9]--> min delay |
|
2008-09-04 18:41:51 +02:00
|
|
|
| | | .... |
|
2007-09-11 00:30:00 +02:00
|
|
|
-------------------------------------------------------------------------
|
2008-09-04 18:41:51 +02:00
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
IMPORTANT :
|
2008-09-04 18:41:51 +02:00
|
|
|
|
|
|
|
|
The delay Structure has to be allocated before passing a pointer to
|
|
|
|
|
"vpi_get_delays ( )".
|
|
|
|
|
|
2007-09-11 00:30:00 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct t_vpi_delay {
|
2008-02-16 00:05:39 +01:00
|
|
|
struct t_vpi_time *da; /* Array of delay data */
|
|
|
|
|
PLI_INT32 no_of_delays ;
|
|
|
|
|
PLI_INT32 time_type; /* vpiScaledRealTime, vpiSimTime */
|
|
|
|
|
PLI_INT32 mtm_flag;
|
|
|
|
|
PLI_INT32 append_flag;
|
|
|
|
|
PLI_INT32 plusere_flag;
|
2007-09-11 00:30:00 +02:00
|
|
|
} s_vpi_delay, *p_vpi_delay;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-03-19 02:21:45 +01:00
|
|
|
/* These are valid codes for the format of the t_vpi_value structure. */
|
|
|
|
|
#define vpiBinStrVal 1
|
|
|
|
|
#define vpiOctStrVal 2
|
|
|
|
|
#define vpiDecStrVal 3
|
|
|
|
|
#define vpiHexStrVal 4
|
|
|
|
|
#define vpiScalarVal 5
|
|
|
|
|
#define vpiIntVal 6
|
|
|
|
|
#define vpiRealVal 7
|
|
|
|
|
#define vpiStringVal 8
|
|
|
|
|
#define vpiVectorVal 9
|
|
|
|
|
#define vpiStrengthVal 10
|
|
|
|
|
#define vpiTimeVal 11
|
|
|
|
|
#define vpiObjTypeVal 12
|
|
|
|
|
#define vpiSuppressVal 13
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* SCALAR VALUES */
|
|
|
|
|
#define vpi0 0
|
|
|
|
|
#define vpi1 1
|
|
|
|
|
#define vpiZ 2
|
|
|
|
|
#define vpiX 3
|
|
|
|
|
#define vpiH 4
|
|
|
|
|
#define vpiL 5
|
|
|
|
|
#define vpiDontCare 6
|
|
|
|
|
|
2001-05-10 02:16:00 +02:00
|
|
|
/* STRENGTH VALUES */
|
|
|
|
|
#define vpiSupplyDrive 0x80
|
|
|
|
|
#define vpiStrongDrive 0x40
|
|
|
|
|
#define vpiPullDrive 0x20
|
|
|
|
|
#define vpiLargeCharge 0x10
|
|
|
|
|
#define vpiWeakDrive 0x08
|
|
|
|
|
#define vpiMediumCharge 0x04
|
|
|
|
|
#define vpiSmallCharge 0x02
|
|
|
|
|
#define vpiHiZ 0x01
|
2001-03-19 02:21:45 +01:00
|
|
|
|
|
|
|
|
/* OBJECT CODES */
|
|
|
|
|
#define vpiConstant 7
|
|
|
|
|
#define vpiFunction 20
|
2002-06-21 06:59:35 +02:00
|
|
|
#define vpiIntegerVar 25
|
2001-03-19 02:21:45 +01:00
|
|
|
#define vpiIterator 27
|
|
|
|
|
#define vpiMemory 29
|
|
|
|
|
#define vpiMemoryWord 30
|
2007-09-11 00:30:00 +02:00
|
|
|
#define vpiModPath 31
|
2001-03-19 02:21:45 +01:00
|
|
|
#define vpiModule 32
|
|
|
|
|
#define vpiNamedBegin 33
|
2002-05-18 04:34:11 +02:00
|
|
|
#define vpiNamedEvent 34
|
2001-03-19 02:21:45 +01:00
|
|
|
#define vpiNamedFork 35
|
|
|
|
|
#define vpiNet 36
|
2003-03-11 00:40:53 +01:00
|
|
|
#define vpiParameter 41
|
2008-05-27 23:29:08 +02:00
|
|
|
#define vpiPartSelect 42
|
2007-11-03 03:59:08 +01:00
|
|
|
#define vpiPathTerm 43
|
2003-01-26 22:15:58 +01:00
|
|
|
#define vpiRealVar 47
|
2001-03-19 02:21:45 +01:00
|
|
|
#define vpiReg 48
|
|
|
|
|
#define vpiSysFuncCall 56
|
|
|
|
|
#define vpiSysTaskCall 57
|
|
|
|
|
#define vpiTask 59
|
|
|
|
|
#define vpiTimeVar 63
|
2010-04-11 23:28:45 +02:00
|
|
|
#define vpiUserSystf 67
|
2009-02-27 21:34:48 +01:00
|
|
|
#define vpiNetArray 114
|
2002-05-17 18:13:08 +02:00
|
|
|
#define vpiIndex 78
|
2002-01-24 05:19:39 +01:00
|
|
|
#define vpiLeftRange 79
|
2007-12-03 18:44:31 +01:00
|
|
|
#define vpiParent 81
|
2002-01-24 05:19:39 +01:00
|
|
|
#define vpiRightRange 83
|
2001-03-19 02:21:45 +01:00
|
|
|
#define vpiScope 84
|
|
|
|
|
#define vpiSysTfCall 85
|
|
|
|
|
#define vpiArgument 89
|
|
|
|
|
#define vpiInternalScope 92
|
2007-09-11 00:30:00 +02:00
|
|
|
#define vpiModPathIn 95
|
2008-09-04 18:41:51 +02:00
|
|
|
#define vpiModPathOut 96
|
2004-10-04 03:10:51 +02:00
|
|
|
#define vpiVariables 100
|
2008-05-27 23:29:08 +02:00
|
|
|
#define vpiExpr 102
|
2001-03-19 02:21:45 +01:00
|
|
|
|
|
|
|
|
#define vpiCallback 1000
|
|
|
|
|
|
|
|
|
|
/* PROPERTIES */
|
2009-05-21 23:41:58 +02:00
|
|
|
#define vpiUndefined (-1)
|
|
|
|
|
#define vpiType 1
|
|
|
|
|
#define vpiName 2
|
|
|
|
|
#define vpiFullName 3
|
|
|
|
|
#define vpiSize 4
|
|
|
|
|
#define vpiFile 5
|
|
|
|
|
#define vpiLineNo 6
|
|
|
|
|
#define vpiTopModule 7
|
|
|
|
|
#define vpiCellInstance 8
|
|
|
|
|
#define vpiDefName 9
|
2001-03-19 02:21:45 +01:00
|
|
|
#define vpiTimeUnit 11
|
|
|
|
|
#define vpiTimePrecision 12
|
2009-05-21 23:41:58 +02:00
|
|
|
#define vpiDefFile 15
|
|
|
|
|
#define vpiDefLineNo 16
|
|
|
|
|
#define vpiNetType 22
|
|
|
|
|
# define vpiWire 1
|
2009-06-25 19:48:05 +02:00
|
|
|
# define vpiWand 2
|
|
|
|
|
# define vpiWor 3
|
|
|
|
|
# define vpiTri 4
|
|
|
|
|
# define vpiTri0 5
|
|
|
|
|
# define vpiTri1 6
|
|
|
|
|
# define vpiTriReg 7
|
|
|
|
|
# define vpiTriAnd 8
|
|
|
|
|
# define vpiTriOr 9
|
|
|
|
|
# define vpiSupply1 10
|
|
|
|
|
# define vpiSupply0 11
|
2009-05-21 23:41:58 +02:00
|
|
|
#define vpiArray 28
|
|
|
|
|
#define vpiEdge 36
|
|
|
|
|
# define vpiNoEdge 0x00 /* No edge */
|
|
|
|
|
# define vpiEdge01 0x01 /* 0 --> 1 */
|
|
|
|
|
# define vpiEdge10 0x02 /* 1 --> 0 */
|
|
|
|
|
# define vpiEdge0x 0x04 /* 0 --> x */
|
|
|
|
|
# define vpiEdgex1 0x08 /* x --> 1 */
|
|
|
|
|
# define vpiEdge1x 0x10 /* 1 --> x */
|
|
|
|
|
# define vpiEdgex0 0x20 /* x --> 0 */
|
|
|
|
|
# define vpiPosedge (vpiEdgex1|vpiEdge01|vpiEdge0x)
|
|
|
|
|
# define vpiNegedge (vpiEdgex0|vpiEdge10|vpiEdge1x)
|
|
|
|
|
# define vpiAnyEdge (vpiPosedge|vpiNegedge)
|
2004-01-13 03:55:50 +01:00
|
|
|
#define vpiConstType 40
|
2001-03-19 02:21:45 +01:00
|
|
|
# define vpiDecConst 1
|
|
|
|
|
# define vpiRealConst 2
|
|
|
|
|
# define vpiBinaryConst 3
|
|
|
|
|
# define vpiOctConst 4
|
|
|
|
|
# define vpiHexConst 5
|
|
|
|
|
# define vpiStringConst 6
|
2003-02-01 06:50:04 +01:00
|
|
|
#define vpiFuncType 44
|
|
|
|
|
# define vpiIntFunc 1
|
|
|
|
|
# define vpiRealFunc 2
|
|
|
|
|
# define vpiTimeFunc 3
|
2004-03-09 05:29:26 +01:00
|
|
|
# define vpiSizedFunc 4
|
|
|
|
|
# define vpiSizedSignedFunc 5
|
|
|
|
|
#define vpiSysFuncType vpiFuncType
|
|
|
|
|
# define vpiSysFuncInt vpiIntFunc
|
|
|
|
|
# define vpiSysFuncReal vpiRealFunc
|
|
|
|
|
# define vpiSysFuncTime vpiTimeFunc
|
|
|
|
|
# define vpiSysFuncSized vpiSizedFunc
|
2010-04-11 23:28:45 +02:00
|
|
|
#define vpiUserDefn 49
|
2008-10-28 18:52:39 +01:00
|
|
|
#define vpiAutomatic 50
|
2008-05-27 23:29:08 +02:00
|
|
|
#define vpiConstantSelect 53
|
|
|
|
|
#define vpiSigned 65
|
2009-01-30 03:17:09 +01:00
|
|
|
/* IVL private properties, also see vvp/vpi_priv.h for other properties */
|
2010-03-14 07:16:27 +01:00
|
|
|
#define _vpiNexusId 0x1000000
|
|
|
|
|
/* used in vvp/vpi_priv.h 0x1000001 */
|
|
|
|
|
#define _vpiDelaySelection 0x1000002
|
|
|
|
|
# define _vpiDelaySelMinimum 1
|
|
|
|
|
# define _vpiDelaySelTypical 2
|
|
|
|
|
# define _vpiDelaySelMaximum 3
|
2001-03-19 02:21:45 +01:00
|
|
|
|
|
|
|
|
/* DELAY MODES */
|
|
|
|
|
#define vpiNoDelay 1
|
|
|
|
|
#define vpiInertialDelay 2
|
|
|
|
|
#define vpiTransportDelay 3
|
|
|
|
|
#define vpiPureTransportDelay 4
|
|
|
|
|
|
|
|
|
|
#define vpiForceFlag 5
|
|
|
|
|
#define vpiReleaseFlag 6
|
2008-03-11 05:54:58 +01:00
|
|
|
#define vpiReturnEvent 0x1000
|
2001-03-19 02:21:45 +01:00
|
|
|
|
|
|
|
|
/* VPI FUNCTIONS */
|
2010-04-11 23:28:45 +02:00
|
|
|
extern vpiHandle vpi_register_systf(const struct t_vpi_systf_data*ss);
|
|
|
|
|
extern void vpi_get_systf_info(vpiHandle obj, p_vpi_systf_data data);
|
2001-03-19 02:21:45 +01:00
|
|
|
|
2003-05-15 18:51:08 +02:00
|
|
|
/* I/O routines */
|
|
|
|
|
extern PLI_UINT32 vpi_mcd_open(char *name);
|
|
|
|
|
extern PLI_UINT32 vpi_mcd_close(PLI_UINT32 mcd);
|
2003-03-13 19:26:12 +01:00
|
|
|
extern char *vpi_mcd_name(PLI_UINT32 mcd);
|
2003-05-15 18:51:08 +02:00
|
|
|
extern PLI_INT32 vpi_mcd_printf(PLI_UINT32 mcd, const char*fmt, ...)
|
2002-05-24 21:05:30 +02:00
|
|
|
__attribute__((format (printf,2,3)));
|
2003-05-15 18:51:08 +02:00
|
|
|
|
|
|
|
|
extern PLI_INT32 vpi_printf(const char*fmt, ...)
|
|
|
|
|
__attribute__((format (printf,1,2)));
|
|
|
|
|
|
|
|
|
|
extern PLI_INT32 vpi_vprintf(const char*fmt, va_list ap);
|
|
|
|
|
extern PLI_INT32 vpi_mcd_vprintf(PLI_UINT32 mcd, const char*fmt, va_list ap);
|
|
|
|
|
|
|
|
|
|
extern PLI_INT32 vpi_flush(void);
|
|
|
|
|
extern PLI_INT32 vpi_mcd_flush(PLI_UINT32 mcd);
|
|
|
|
|
|
2003-05-23 06:04:02 +02:00
|
|
|
/* proposed extensions */
|
2003-10-30 04:42:51 +01:00
|
|
|
/*
|
|
|
|
|
* These functions are proposed extensions to Verilog, and
|
|
|
|
|
* are described by the Verilog PLI task force as issue#347.
|
|
|
|
|
*
|
|
|
|
|
* The vpi_fopen() function is exactly the same as the $fopen system
|
|
|
|
|
* function. That is, it takes a path string and a mode string, and
|
|
|
|
|
* opens the file. The result is a 32bit value with bit 31 set, the
|
|
|
|
|
* remaining bits made up a small integer to represent the file.
|
|
|
|
|
*
|
|
|
|
|
* The vpi_get_file(fd) function takes as input a descriptor as
|
|
|
|
|
* returned by vpi_fopen or $fopen. Bit 31 must be set. The result
|
|
|
|
|
* is the C FILE* that represents the file.
|
|
|
|
|
*/
|
2003-05-23 06:04:02 +02:00
|
|
|
extern PLI_INT32 vpi_fopen(const char*name, const char*mode);
|
|
|
|
|
extern FILE *vpi_get_file(PLI_INT32 fd);
|
2001-03-19 02:21:45 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* support for VPI callback functions.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct t_cb_data {
|
2003-03-13 19:26:12 +01:00
|
|
|
PLI_INT32 reason;
|
|
|
|
|
PLI_INT32 (*cb_rtn)(struct t_cb_data*cb);
|
2001-03-19 02:21:45 +01:00
|
|
|
vpiHandle obj;
|
|
|
|
|
p_vpi_time time;
|
|
|
|
|
p_vpi_value value;
|
2003-03-13 19:26:12 +01:00
|
|
|
PLI_INT32 index;
|
|
|
|
|
char *user_data;
|
2001-03-19 02:21:45 +01:00
|
|
|
} s_cb_data, *p_cb_data;
|
|
|
|
|
|
|
|
|
|
#define cbValueChange 1
|
|
|
|
|
#define cbStmt 2
|
|
|
|
|
#define cbForce 3
|
|
|
|
|
#define cbRelease 4
|
|
|
|
|
#define cbAtStartOfSimTime 5
|
|
|
|
|
#define cbReadWriteSynch 6
|
|
|
|
|
#define cbReadOnlySynch 7
|
|
|
|
|
#define cbNextSimTime 8
|
|
|
|
|
#define cbAfterDelay 9
|
|
|
|
|
#define cbEndOfCompile 10
|
|
|
|
|
#define cbStartOfSimulation 11
|
|
|
|
|
#define cbEndOfSimulation 12
|
|
|
|
|
#define cbError 13
|
|
|
|
|
#define cbTchkViolation 14
|
|
|
|
|
#define cbStartOfSave 15
|
|
|
|
|
#define cbEndOfSave 16
|
|
|
|
|
#define cbStartOfRestart 17
|
|
|
|
|
#define cbEndOfRestart 18
|
|
|
|
|
#define cbStartOfReset 19
|
|
|
|
|
#define cbEndOfReset 20
|
|
|
|
|
#define cbEnterInteractive 21
|
|
|
|
|
#define cbExitInteractive 22
|
|
|
|
|
#define cbInteractiveScopeChange 23
|
|
|
|
|
#define cbUnresolvedSystf 24
|
|
|
|
|
|
|
|
|
|
extern vpiHandle vpi_register_cb(p_cb_data data);
|
2003-03-13 19:26:12 +01:00
|
|
|
extern PLI_INT32 vpi_remove_cb(vpiHandle ref);
|
2001-03-19 02:21:45 +01:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This function allows a vpi application to control the simulation
|
|
|
|
|
* engine. The operation parameter specifies the function to
|
|
|
|
|
* perform. The remaining parameters (if any) are interpreted by the
|
2007-07-20 00:04:33 +02:00
|
|
|
* operation. The vpi_sim_control definition (now named vpi_control)
|
|
|
|
|
* was added to P1364-2000 14 July 1999. See PLI Task Force ID: PTF-161
|
2001-03-19 02:21:45 +01:00
|
|
|
*
|
|
|
|
|
* vpiFinish - perform the $finish operation, as soon as the user
|
|
|
|
|
* function returns. This operation takes a single
|
|
|
|
|
* parameter, a diagnostic exit code.
|
|
|
|
|
*
|
|
|
|
|
* vpiStop -
|
|
|
|
|
* vpiReset -
|
|
|
|
|
* vpiSetInteractiveScope -
|
|
|
|
|
*/
|
2003-03-13 19:26:12 +01:00
|
|
|
extern void vpi_control(PLI_INT32 operation, ...);
|
2009-10-29 19:16:26 +01:00
|
|
|
/************* vpi_control() constants (added with 1364-2000) *************/
|
|
|
|
|
#define vpiStop 66 /* execute simulator's $stop */
|
|
|
|
|
#define vpiFinish 67 /* execute simulator's $finish */
|
|
|
|
|
#define vpiReset 68 /* execute simulator's $reset */
|
|
|
|
|
#define vpiSetInteractiveScope 69 /* set simulator's interactive scope */
|
|
|
|
|
#define __ivl_legacy_vpiStop 1
|
|
|
|
|
#define __ivl_legacy_vpiFinish 2
|
2001-03-19 02:21:45 +01:00
|
|
|
|
2002-07-19 03:57:26 +02:00
|
|
|
/* vpi_sim_control is the incorrect name for vpi_control. */
|
2003-03-13 19:26:12 +01:00
|
|
|
extern void vpi_sim_control(PLI_INT32 operation, ...);
|
2002-07-19 03:57:26 +02:00
|
|
|
|
2003-03-13 19:26:12 +01:00
|
|
|
extern vpiHandle vpi_handle(PLI_INT32 type, vpiHandle ref);
|
|
|
|
|
extern vpiHandle vpi_iterate(PLI_INT32 type, vpiHandle ref);
|
2001-03-19 02:21:45 +01:00
|
|
|
extern vpiHandle vpi_scan(vpiHandle iter);
|
2003-03-13 19:26:12 +01:00
|
|
|
extern vpiHandle vpi_handle_by_index(vpiHandle ref, PLI_INT32 index);
|
2003-03-13 05:34:18 +01:00
|
|
|
extern vpiHandle vpi_handle_by_name(const char*name, vpiHandle scope);
|
2001-03-19 02:21:45 +01:00
|
|
|
|
|
|
|
|
extern void vpi_get_time(vpiHandle obj, s_vpi_time*t);
|
2003-03-13 19:26:12 +01:00
|
|
|
extern PLI_INT32 vpi_get(int property, vpiHandle ref);
|
|
|
|
|
extern char *vpi_get_str(PLI_INT32 property, vpiHandle ref);
|
2001-03-19 02:21:45 +01:00
|
|
|
extern void vpi_get_value(vpiHandle expr, p_vpi_value value);
|
2001-04-25 06:45:52 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This function puts a value into the object referenced by the
|
|
|
|
|
* handle. This assumes that the value supports having its value
|
|
|
|
|
* written to. The time parameter specifies when the assignment is to
|
|
|
|
|
* take place. This allows you to schedule an assignment to happen in
|
|
|
|
|
* the future.
|
|
|
|
|
*
|
|
|
|
|
* The flags value specifies the delay model to use in assigning the
|
|
|
|
|
* value. This specifies how the time value is to be used.
|
|
|
|
|
*
|
|
|
|
|
* vpiNoDelay -- Set the value immediately. The p_vpi_time parameter
|
|
|
|
|
* may be NULL, in this case. This is like a blocking assignment
|
|
|
|
|
* in behavioral code.
|
|
|
|
|
*
|
|
|
|
|
* vpiInertialDelay -- Set the value using the transport delay. The
|
|
|
|
|
* p_vpi_time parameter is required and specifies when the
|
|
|
|
|
* assignment is to take place. This is like a non-blocking
|
|
|
|
|
* assignment in behavioral code.
|
|
|
|
|
*/
|
2001-03-19 02:21:45 +01:00
|
|
|
extern vpiHandle vpi_put_value(vpiHandle obj, p_vpi_value value,
|
2003-03-13 19:26:12 +01:00
|
|
|
p_vpi_time when, PLI_INT32 flags);
|
2001-03-19 02:21:45 +01:00
|
|
|
|
2003-03-13 19:26:12 +01:00
|
|
|
extern PLI_INT32 vpi_free_object(vpiHandle ref);
|
|
|
|
|
extern PLI_INT32 vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p);
|
2001-03-19 02:21:45 +01:00
|
|
|
|
2008-09-04 18:41:51 +02:00
|
|
|
/*
|
2007-09-11 00:30:00 +02:00
|
|
|
These Routines will enable the modpath vpiHandle
|
|
|
|
|
to read/write delay values
|
|
|
|
|
*/
|
|
|
|
|
extern void vpi_get_delays(vpiHandle expr, p_vpi_delay delays);
|
|
|
|
|
|
|
|
|
|
extern void vpi_put_delays(vpiHandle expr, p_vpi_delay delays);
|
|
|
|
|
|
|
|
|
|
|
2010-04-11 23:28:45 +02:00
|
|
|
/*
|
|
|
|
|
* Check to see if two handles point to the same object.
|
|
|
|
|
*/
|
|
|
|
|
extern PLI_INT32 vpi_compare_objects(vpiHandle obj1, vpiHandle obj2);
|
2007-09-11 00:30:00 +02:00
|
|
|
|
|
|
|
|
|
2003-01-09 05:09:44 +01:00
|
|
|
/*
|
|
|
|
|
* These functions support attaching user data to an instance of a
|
|
|
|
|
* system task or function. These functions only apply to
|
|
|
|
|
* vpiSysTaskCall or vpiSysFuncCall handles.
|
|
|
|
|
*/
|
2003-03-13 19:26:12 +01:00
|
|
|
extern PLI_INT32 vpi_put_userdata(vpiHandle obj, void*data);
|
2003-01-09 05:09:44 +01:00
|
|
|
extern void*vpi_get_userdata(vpiHandle obj);
|
2001-03-19 02:21:45 +01:00
|
|
|
|
2002-07-19 03:57:26 +02:00
|
|
|
/*
|
|
|
|
|
* Support for handling errors.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct t_vpi_error_info {
|
2003-03-13 19:26:12 +01:00
|
|
|
PLI_INT32 state;
|
|
|
|
|
PLI_INT32 level;
|
|
|
|
|
char *message;
|
|
|
|
|
char *product;
|
|
|
|
|
char *code;
|
|
|
|
|
char *file;
|
|
|
|
|
PLI_INT32 line;
|
2002-07-19 03:57:26 +02:00
|
|
|
} s_vpi_error_info, *p_vpi_error_info;
|
|
|
|
|
|
|
|
|
|
/* error_info states */
|
|
|
|
|
# define vpiCompile 1
|
|
|
|
|
# define vpiPLI 2
|
|
|
|
|
# define vpiRun 3
|
|
|
|
|
|
|
|
|
|
/* error_info levels */
|
|
|
|
|
# define vpiNotice 1
|
|
|
|
|
# define vpiWarning 2
|
|
|
|
|
# define vpiError 3
|
|
|
|
|
# define vpiSystem 4
|
|
|
|
|
# define vpiInternal 5
|
|
|
|
|
|
2003-03-13 19:26:12 +01:00
|
|
|
extern PLI_INT32 vpi_chk_error(p_vpi_error_info info);
|
2002-07-19 03:57:26 +02:00
|
|
|
|
|
|
|
|
|
2001-03-19 02:21:45 +01:00
|
|
|
/* This is the table of startup routines included in each module. */
|
|
|
|
|
extern DLLEXPORT void (*vlog_startup_routines[])();
|
|
|
|
|
|
2003-04-20 04:49:07 +02:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* ICARUS VERILOG EXTENSIONS
|
|
|
|
|
*
|
|
|
|
|
* The vpip_* functions are Icarus Verilog extensions. They are not
|
|
|
|
|
* standard VPI functions, so use these at your own risk.
|
|
|
|
|
*
|
|
|
|
|
* The vpip_format_* functions format values in string format in the
|
|
|
|
|
* manner of the $display system task.
|
|
|
|
|
*/
|
|
|
|
|
|
2003-07-15 05:49:22 +02:00
|
|
|
/* Format a scalar a la %v. The str points to a 4byte character
|
2003-04-20 04:49:07 +02:00
|
|
|
buffer. The value must be a vpiStrengthVal. */
|
2008-04-10 03:16:21 +02:00
|
|
|
extern void vpip_format_strength(char*str, s_vpi_value*value, unsigned bit);
|
2008-05-23 04:09:03 +02:00
|
|
|
extern void vpip_set_return_value(int value);
|
2008-08-16 04:28:11 +02:00
|
|
|
extern s_vpi_vecval vpip_calc_clog2(vpiHandle arg);
|
2010-04-12 08:39:08 +02:00
|
|
|
extern void vpip_make_systf_system_defined(vpiHandle ref);
|
2003-04-20 04:49:07 +02:00
|
|
|
|
2001-04-25 06:45:52 +02:00
|
|
|
EXTERN_C_END
|
2001-03-19 02:21:45 +01:00
|
|
|
|
|
|
|
|
#endif
|