Add PLI_TRACE tracing of PLI1 modules.

Add tf_isetdelay and friends, and add
 callback return values for acc_vcl support.
This commit is contained in:
steve 2003-05-18 00:16:35 +00:00
parent cd7a313f56
commit ea33862632
16 changed files with 520 additions and 30 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: acc_user.h,v 1.11 2003/04/24 18:57:05 steve Exp $"
#ident "$Id: acc_user.h,v 1.12 2003/05/18 00:16:35 steve Exp $"
#endif
/*
@ -84,11 +84,39 @@ typedef struct __vpiHandle *handle;
#define accStringVal 8
#define accVectorVal 9
/* Scalar values */
#define acc0 0
#define acc1 1
#define accX 2
#define accZ 3
/* type VALUES FOR t_acc_time STRUCTURE */
#define accTime 1
#define accSimTime 2
#define accRealTime 3
/* reason codes */
#define logic_value_change 1
#define strength_value_change 2
#define real_value_change 3
#define vector_value_change 4
#define event_value_change 5
#define integer_value_change 6
#define time_value_change 7
#define sregister_value_change 8
#define vregister_value_change 9
#define realtime_value_change 10
/* VCL strength values */
#define vclSupply 7
#define vclStrong 6
#define vclPull 5
#define vclLarge 4
#define vclWeak 3
#define vclMedium 2
#define vclSmall 1
#define vclHighZ 0
/* Constants used by acc_vcl_add */
#define vcl_verilog_logic 2
#define VCL_VERILOG_LOGIC vcl_verilog_logic
@ -141,6 +169,7 @@ typedef struct t_vc_record {
} out_value;
} s_vc_record, *p_vc_record;
typedef struct t_location {
PLI_INT32 line_no;
const char*filename;
@ -214,6 +243,12 @@ EXTERN_C_END
/*
* $Log: acc_user.h,v $
* Revision 1.12 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.11 2003/04/24 18:57:05 steve
* Add acc_fetch_fulltype function.
*

View File

@ -16,7 +16,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.22 2003/05/16 03:23:17 steve Exp $"
#ident "$Id: Makefile.in,v 1.23 2003/05/18 00:16:35 steve Exp $"
#
#
SHELL = /bin/sh
@ -51,7 +51,7 @@ a_fetch_type.o a_fetch_type_str.o a_fetch_value.o \
a_handle_object.o a_handle_parent.o a_handle_tfarg.o \
a_initialize.o a_next_topmod.o a_object_of_type.o a_product_version.o \
a_set_value.o a_vcl.o a_version.o
O = asynch.o finish.o getcstringp.o getinstance.o getlongp.o \
O = asynch.o delay.o finish.o getcstringp.o getinstance.o getlongp.o \
getp.o getsimtime.o io_print.o math.o mc_scan_plusargs.o nump.o putlongp.o \
putp.o spname.o typep.o workarea.o veriusertfs.o priv.o $A

View File

@ -17,15 +17,28 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_close.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#ident "$Id: a_close.c,v 1.3 2003/05/18 00:16:35 steve Exp $"
#endif
# include <acc_user.h>
# include "priv.h"
void acc_close(void) { }
void acc_close(void)
{
if (pli_trace) {
fprintf(pli_trace, "acc_close()\n");
fflush(pli_trace);
}
}
/*
* $Log: a_close.c,v $
* Revision 1.3 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*

View File

@ -17,11 +17,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_configure.c,v 1.1 2003/02/17 06:39:47 steve Exp $"
#ident "$Id: a_configure.c,v 1.2 2003/05/18 00:16:35 steve Exp $"
#endif
#include <acc_user.h>
#include <vpi_user.h>
#include "priv.h"
int acc_configure(PLI_INT32 config_param, const char*value)
{
@ -30,9 +31,23 @@ int acc_configure(PLI_INT32 config_param, const char*value)
case accDevelopmentVersion:
vpi_printf("Request PLI Development Version %s\n", value);
rc = 1;
if (pli_trace) {
fprintf(pli_trace,
"acc_configure(accDevelopmentVersion, %s)\n",
value);
fflush(pli_trace);
}
break;
default:
if (pli_trace) {
fprintf(pli_trace, "acc_configure(config=%d, %s)\n",
config_param, value);
fflush(pli_trace);
}
vpi_printf("XXXX acc_configure(%d, %s)\n", config_param, value);
rc = 0;
break;
@ -43,6 +58,12 @@ int acc_configure(PLI_INT32 config_param, const char*value)
/*
* $Log: a_configure.c,v $
* Revision 1.2 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.1 2003/02/17 06:39:47 steve
* Add at least minimal implementations for several
* acc_ functions. Add support for standard ACC

View File

@ -17,12 +17,13 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_fetch_param.c,v 1.2 2003/03/14 04:59:54 steve Exp $"
#ident "$Id: a_fetch_param.c,v 1.3 2003/05/18 00:16:35 steve Exp $"
#endif
#include <assert.h>
#include <vpi_user.h>
#include <acc_user.h>
#include "priv.h"
double acc_fetch_paramval(handle object)
{
@ -34,6 +35,11 @@ double acc_fetch_paramval(handle object)
switch (val.format) {
case vpiStringVal:
if (pli_trace) {
fprintf(pli_trace, "acc_fetch_paramval(%s) --> \"%s\"\n",
vpi_get_str(vpiName, object), val.value.str);
fflush(pli_trace);
}
return (double) (long)val.value.str;
default:
@ -46,6 +52,12 @@ double acc_fetch_paramval(handle object)
/*
* $Log: a_fetch_param.c,v $
* Revision 1.3 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.2 2003/03/14 04:59:54 steve
* Better message when asserting funky value type.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_fetch_tfarg.c,v 1.5 2003/03/14 04:58:50 steve Exp $"
#ident "$Id: a_fetch_tfarg.c,v 1.6 2003/05/18 00:16:35 steve Exp $"
#endif
#include <vpi_user.h>
@ -48,6 +48,13 @@ int acc_fetch_tfarg_int(int n)
rtn = 0;
}
if (pli_trace) {
fprintf(pli_trace, "%s: acc_fetch_tfarg_int(%d) --> %d\n",
vpi_get_str(vpiName, sys_h), n, rtn);
fflush(pli_trace);
}
return rtn;
}
@ -74,11 +81,23 @@ char *acc_fetch_tfarg_str(int n)
rtn = (char *) 0;
}
if (pli_trace) {
fprintf(pli_trace, "%s: acc_fetch_tfarg_str(%d) --> \"%s\"\n",
vpi_get_str(vpiName, sys_h), n, rtn? rtn : "");
fflush(pli_trace);
}
return rtn;
}
/*
* $Log: a_fetch_tfarg.c,v $
* Revision 1.6 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.5 2003/03/14 04:58:50 steve
* Free the iterator when Im done.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_fetch_value.c,v 1.3 2003/04/24 02:02:37 steve Exp $"
#ident "$Id: a_fetch_value.c,v 1.4 2003/05/18 00:16:35 steve Exp $"
#endif
# include <acc_user.h>
@ -35,19 +35,58 @@ static char* fetch_struct_value(handle obj, s_acc_value*value)
case accScalarVal:
val.format = vpiScalarVal;
vpi_get_value(obj, &val);
value->value.scalar = val.value.scalar;
switch (val.value.scalar) {
case vpi0:
value->value.scalar = acc0;
break;
case vpi1:
value->value.scalar = acc1;
break;
case vpiX:
value->value.scalar = accX;
break;
case vpiZ:
value->value.scalar = accZ;
break;
default:
assert(0);
}
if (pli_trace) {
fprintf(pli_trace, "acc_fetch_value(<%s>, "
"accScalarVal) --> %d\n",
vpi_get_str(vpiFullName,obj),
value->value.scalar);
fflush(pli_trace);
}
break;
case accIntVal:
val.format = vpiIntVal;
vpi_get_value(obj, &val);
value->value.integer = val.value.integer;
if (pli_trace) {
fprintf(pli_trace, "acc_fetch_value(<%s>, "
"accIntVal) --> %d\n",
vpi_get_str(vpiFullName,obj),
value->value.integer);
fflush(pli_trace);
}
break;
case accRealVal:
val.format = vpiRealVal;
vpi_get_value(obj, &val);
value->value.real = val.value.real;
if (pli_trace) {
fprintf(pli_trace, "acc_fetch_value(<%s>, "
"accRealVal) --> %g\n",
vpi_get_str(vpiFullName,obj),
value->value.real);
fflush(pli_trace);
}
break;
default:
@ -70,6 +109,12 @@ static char* fetch_strength_value(handle obj)
vpip_format_strength(str, &val);
if (pli_trace) {
fprintf(pli_trace, "acc_fetch_value(<%s>, \"%%v\") --> %s\n",
vpi_get_str(vpiFullName,obj), str);
fflush(pli_trace);
}
return __acc_newstring(str);
}
@ -88,6 +133,12 @@ char* acc_fetch_value(handle obj, const char*fmt, s_acc_value*value)
/*
* $Log: a_fetch_value.c,v $
* Revision 1.4 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.3 2003/04/24 02:02:37 steve
* Clean up some simple warnings.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_set_value.c,v 1.2 2002/08/12 01:35:02 steve Exp $"
#ident "$Id: a_set_value.c,v 1.3 2003/05/18 00:16:35 steve Exp $"
#endif
#include <assert.h>
@ -101,7 +101,11 @@ int acc_set_value(handle object, p_setval_value value, p_setval_delay delay)
val.format = vpiVectorVal;
val.value.vector = (p_vpi_vecval)value->value.vector;
break;
default: assert(0); break;
default:
vpi_printf("XXXX acc_set_value(value->format=%d)\n",
value->format);
assert(0);
break;
}
/* put value */
@ -112,6 +116,12 @@ int acc_set_value(handle object, p_setval_value value, p_setval_delay delay)
/*
* $Log: a_set_value.c,v $
* Revision 1.3 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.2 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: a_vcl.c,v 1.4 2003/04/30 01:09:29 steve Exp $"
#ident "$Id: a_vcl.c,v 1.5 2003/05/18 00:16:35 steve Exp $"
#endif
#include <vpi_user.h>
@ -27,11 +27,25 @@
#include <malloc.h>
#endif
#include "priv.h"
#include <assert.h>
/*
* This is the structure of a record that I use locally to hold the
* information about a VCL. This record includes a pointer to the vpi
* callback that is actually watching the value, and that callback has
* a pointer to this record in its user_data so that I can get to it
* when the value changes.
*
* Keep all these records in a vcl_list so that I can get access to
* them for the vcl_delete.
*/
struct vcl_record {
/* Object who's value I'm watching. */
vpiHandle obj;
/* User's callback routine. */
PLI_INT32(*consumer)(p_vc_record);
void*user_data;
PLI_INT32 vcl_flag;
vpiHandle callback;
@ -40,13 +54,109 @@ struct vcl_record {
static struct vcl_record*vcl_list = 0;
static int vpi_strength_to_vcl(int vs)
{
switch (vs) {
case vpiSupplyDrive:
return vclSupply;
case vpiStrongDrive:
return vclStrong;
case vpiPullDrive:
return vclPull;
case vpiLargeCharge:
return vclLarge;
case vpiWeakDrive:
return vclWeak;
case vpiMediumCharge:
return vclMedium;
case vpiSmallCharge:
return vclSmall;
case vpiHiZ:
return vclHighZ;
default:
return -1;
}
}
/*
* This is a VPI callback that notices the value change. This function
* further dispatches the information about the callback to the
* consumer function.
*/
static PLI_INT32 vcl_value_callback(struct t_cb_data*cb)
{
s_vpi_time sim_time;
s_vpi_value obj_value;
struct t_vc_record vcr;
struct vcl_record*cur = (struct vcl_record*)cb->user_data;
vpi_printf("XXXX Call vcl_callback(<type=%d>);\n",
vpi_get(vpiType, cur->obj));
sim_time.type = vpiSimTime;
vpi_get_time(cur->obj, &sim_time);
switch (cur->vcl_flag) {
case VCL_VERILOG_LOGIC:
vpi_printf("XXXX vcl_value_callback(%s=%d);\n",
vpi_get_str(vpiName, cur->obj), -1);
vcr.vc_reason = logic_value_change;
break;
case VCL_VERILOG_STRENGTH:
vcr.vc_reason = strength_value_change;
obj_value.format = vpiStrengthVal;
vpi_get_value(cur->obj, &obj_value);
assert(obj_value.format == vpiStrengthVal);
switch (obj_value.value.strength[0].logic) {
case vpi0:
vcr.out_value.strengths_s.logic_value = acc0;
vcr.out_value.strengths_s.strength1 =
vpi_strength_to_vcl(obj_value.value.strength[0].s0);
vcr.out_value.strengths_s.strength2 =
vpi_strength_to_vcl(obj_value.value.strength[0].s0);
break;
case vpi1:
vcr.out_value.strengths_s.logic_value = acc1;
vcr.out_value.strengths_s.strength1 =
vpi_strength_to_vcl(obj_value.value.strength[0].s1);
vcr.out_value.strengths_s.strength2 =
vpi_strength_to_vcl(obj_value.value.strength[0].s1);
break;
case vpiX:
vcr.out_value.strengths_s.logic_value = accX;
vcr.out_value.strengths_s.strength1 =
vpi_strength_to_vcl(obj_value.value.strength[0].s1);
vcr.out_value.strengths_s.strength2 =
vpi_strength_to_vcl(obj_value.value.strength[0].s0);
break;
case vpiZ:
vcr.out_value.strengths_s.logic_value = accZ;
vcr.out_value.strengths_s.strength1 = vclHighZ;
vcr.out_value.strengths_s.strength2 = vclHighZ;
break;
default:
assert(0);
}
if (pli_trace) {
fprintf(pli_trace,
"Call vcl_value_callback(%s=%d <s1=%d,s2=%d>)\n",
vpi_get_str(vpiFullName, cur->obj),
vcr.out_value.strengths_s.logic_value,
vcr.out_value.strengths_s.strength1,
vcr.out_value.strengths_s.strength2);
fflush(pli_trace);
}
break;
default:
assert(0);
}
vcr.vc_hightime = sim_time.high;
vcr.vc_lowtime = sim_time.low;
vcr.user_data = cur->user_data;
(cur->consumer) (&vcr);
return 0;
}
@ -69,12 +179,20 @@ void acc_vcl_add(handle obj, PLI_INT32(*consumer)(p_vc_record),
cb.reason = cbValueChange;
cb.cb_rtn = vcl_value_callback;
cb.obj = obj;
cb.time = 0;
cb.value = 0;
cb.user_data = (void*)cur;
cur->callback = vpi_register_cb(&cb);
if (pli_trace) {
fprintf(pli_trace, "acc_vcl_add(<%s>, ..., %p, %d)\n",
vpi_get_str(vpiFullName, obj), data, vcl_flag);
fflush(pli_trace);
}
break;
default:
vpi_printf("XXXX Call acc_vcl_add(<type=%d>, ..., %d);\n",
vpi_printf("XXXX acc_vcl_add(<type=%d>, ..., %d);\n",
vpi_get(vpiType, obj), vcl_flag);
break;
}
@ -84,12 +202,18 @@ void acc_vcl_add(handle obj, PLI_INT32(*consumer)(p_vc_record),
void acc_vcl_delete(handle obj, PLI_INT32(*consumer)(p_vc_record),
void*data, PLI_INT32 vcl_flag)
{
vpi_printf("XXXX Call acc_vcl_delete\n");
vpi_printf("XXXX acc_vcl_delete(...)\n");
}
/*
* $Log: a_vcl.c,v $
* Revision 1.5 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.4 2003/04/30 01:09:29 steve
* Conditionally include malloc.h
*

91
libveriuser/delay.c Normal file
View File

@ -0,0 +1,91 @@
/*
* Copyright (c) 2003 Stephen Williams (steve@icarus.com)
*
* 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
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: delay.c,v 1.1 2003/05/18 00:16:35 steve Exp $"
#endif
#include <veriuser.h>
#include <vpi_user.h>
#include "priv.h"
#include <assert.h>
static PLI_INT32 delay_callback(struct t_cb_data*cb)
{
vpi_printf("XXXX delay_callback called.\n");
}
int tf_isetdelay(PLI_INT32 delay, void*ss)
{
vpiHandle sys = (vpiHandle)ss;
int unit = vpi_get(vpiTimeUnit, sys);
int prec = vpi_get(vpiTimePrecision, 0);
struct t_cb_data cb;
struct t_vpi_time ct;
if (pli_trace) {
fprintf(pli_trace, "%s: tf_isetdelay(%d, ...)"
" <unit=%d, prec=%d>;\n",
vpi_get_str(vpiName, sys), delay, unit, prec);
fflush(pli_trace);
}
/* Convert the delay from the UNITS of the specified
task/function to the precision of the simulation. */
assert(unit >= prec);
while (unit > prec) {
PLI_INT32 tmp = delay * 10;
assert(tmp > delay);
delay = tmp;
unit -= 1;
}
/* Create a VPI callback to schedule the delay. */
ct.type = vpiSimTime;
ct.high = 0;
ct.low = delay;
cb.reason = cbAfterDelay;
cb.cb_rtn = delay_callback;
cb.obj = 0;
cb.time = &ct;
cb.value = 0;
cb.user_data = 0;
vpi_register_cb(&cb);
return 0;
}
int tf_setdelay(PLI_INT32 delay)
{
return tf_isetdelay(delay, tf_getinstance());
}
/*
* $Log: delay.c,v $
* Revision 1.1 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
*/

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: getinstance.c,v 1.3 2002/08/12 01:35:02 steve Exp $"
#ident "$Id: getinstance.c,v 1.4 2003/05/18 00:16:35 steve Exp $"
#endif
#include <veriuser.h>
@ -26,13 +26,19 @@
/*
* tf_getinstance implemented using VPI interface
*/
char *tf_getinstance(void)
PLI_BYTE8* tf_getinstance(void)
{
return (char *)vpi_handle(vpiSysTfCall, 0 /* NULL */);
}
/*
* $Log: getinstance.c,v $
* Revision 1.4 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.3 2002/08/12 01:35:02 steve
* conditional ident string using autoconfig.
*

View File

@ -17,13 +17,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: priv.c,v 1.2 2003/03/13 05:07:46 steve Exp $"
#ident "$Id: priv.c,v 1.3 2003/05/18 00:16:35 steve Exp $"
#endif
# include "priv.h"
# include <string.h>
# include <assert.h>
FILE* pli_trace = 0;
static char string_buffer[8192];
static unsigned string_fill = 0;
@ -56,6 +58,12 @@ char* __acc_newstring(const char*txt)
/*
* $Log: priv.c,v $
* Revision 1.3 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.2 2003/03/13 05:07:46 steve
* Declaration warnings.
*

View File

@ -19,9 +19,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: priv.h,v 1.1 2003/02/17 06:39:47 steve Exp $"
#ident "$Id: priv.h,v 1.2 2003/05/18 00:16:35 steve Exp $"
#endif
# include <stdio.h>
/*
* This function implements the acc_ string buffer, by adding the
* input string to the buffer, and returning a pointer to the first
@ -29,8 +31,19 @@
*/
extern char* __acc_newstring(const char*txt);
/*
* Trace file for loggint ACC and TF calls.
*/
FILE* pli_trace;
/*
* $Log: priv.h,v $
* Revision 1.2 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.1 2003/02/17 06:39:47 steve
* Add at least minimal implementations for several
* acc_ functions. Add support for standard ACC

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: spname.c,v 1.1 2003/03/13 04:35:09 steve Exp $"
#ident "$Id: spname.c,v 1.2 2003/05/18 00:16:35 steve Exp $"
#endif
#include <assert.h>
@ -27,14 +27,30 @@
char* tf_spname(void)
{
char*rtn;
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
vpiHandle scope = vpi_handle(vpiScope, sys);
return __acc_newstring(vpi_get_str(vpiFullName, scope));
rtn = __acc_newstring(vpi_get_str(vpiFullName, scope));
if (pli_trace) {
fprintf(pli_trace, "%s: tf_spname() --> %s\n",
vpi_get_str(vpiName,sys), rtn);
fflush(pli_trace);
}
return rtn;
}
/*
* $Log: spname.c,v $
* Revision 1.2 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.1 2003/03/13 04:35:09 steve
* Add a bunch of new acc_ and tf_ functions.
*

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: veriusertfs.c,v 1.7 2003/04/23 15:01:29 steve Exp $"
#ident "$Id: veriusertfs.c,v 1.8 2003/05/18 00:16:35 steve Exp $"
#endif
/*
@ -31,6 +31,7 @@
# include <assert.h>
# include "vpi_user.h"
# include "veriuser.h"
# include "priv.h"
/*
* local structure used to hold the persistent veriusertfs data
@ -51,10 +52,18 @@ static int callback(p_cb_data);
*/
void veriusertfs_register_table(p_tfcell vtable)
{
const char*path;
p_tfcell tf;
s_vpi_systf_data tf_data;
p_pli_data data;
if ((pli_trace == 0) && (path = getenv("PLI_TRACE"))) {
if (strcmp(path,"-") == 0)
pli_trace = stdout;
else
pli_trace = fopen(path, "w");
}
for (tf = vtable; tf; tf++) {
/* last element */
if (tf->type == 0) break;
@ -94,6 +103,14 @@ void veriusertfs_register_table(p_tfcell vtable)
tf_data.sizetf = tf->sizetf;
tf_data.user_data = (char *)data;
if (pli_trace) {
fprintf(pli_trace, "Registering system task/function\n");
fprintf(pli_trace, " tfname: %s\n", tf->tfname);
fprintf(pli_trace, " type: %d\n", tf->type);
fprintf(pli_trace, " data: %d\n", tf->data);
fflush(pli_trace);
}
/* register */
vpi_register_systf(&tf_data);
}
@ -162,8 +179,26 @@ static int compiletf(char *data)
* Since we are in compiletf, checktf and misctf need to
* be executed. Check runs first to match other simulators.
*/
rtn = (tf->checktf) ? tf->checktf(tf->data, reason_checktf) : 0;
if (tf->misctf) tf->misctf(tf->data, reason_endofcompile, 0);
if (tf->checktf) {
if (pli_trace) {
fprintf(pli_trace, "Call %s->checktf(reason_checktf)\n",
tf->tfname);
fflush(pli_trace);
}
rtn = tf->checktf(tf->data, reason_checktf);
}
if (tf->misctf) {
if (pli_trace) {
fprintf(pli_trace, "Call %s->misctf"
"(user_data=%d, reason=%d, paramvc=%d);\n",
tf->tfname, tf->data, reason_endofcompile, 0);
fflush(pli_trace);
}
tf->misctf(tf->data, reason_endofcompile, 0);
}
return rtn;
}
@ -182,8 +217,15 @@ static int calltf(char *data)
tf = pli->tf;
/* execute calltf */
if (tf->calltf)
if (tf->calltf) {
if (pli_trace) {
fprintf(pli_trace, "Call %s->calltf(%d, %d)\n",
tf->data, reason_calltf);
fflush(pli_trace);
}
rc = tf->calltf(tf->data, reason_calltf);
}
return rc;
}
@ -199,6 +241,7 @@ static int callback(p_cb_data data)
p_tfcell tf;
int reason;
int paramvc = 0;
int rc;
/* not enabled */
if (data->reason == cbValueChange && !async_misctf_enable)
@ -223,8 +266,17 @@ static int callback(p_cb_data data)
assert(0);
}
if (pli_trace) {
fprintf(pli_trace, "Call %s->misctf"
"(user_data=%d, reason=%d, paramvc=%d);\n",
tf->tfname, tf->data, reason, paramvc);
fflush(pli_trace);
}
/* execute misctf */
return (tf->misctf) ? tf->misctf(tf->data, reason, paramvc) : 0;
rc = (tf->misctf) ? tf->misctf(tf->data, reason, paramvc) : 0;
return rc;
}
PLI_INT32 tf_isynchronize(void*obj)
@ -253,6 +305,12 @@ PLI_INT32 tf_synchronize(void)
/*
* $Log: veriusertfs.c,v $
* Revision 1.8 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.7 2003/04/23 15:01:29 steve
* Add tf_synchronize and tf_multiply_long.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: veriuser.h,v 1.24 2003/04/23 15:01:29 steve Exp $"
#ident "$Id: veriuser.h,v 1.25 2003/05/18 00:16:35 steve Exp $"
#endif
/*
@ -245,7 +245,7 @@ extern void tf_error(const char*, ...)
extern char* tf_getcstringp(int nparam);
extern char* tf_getinstance(void);
extern PLI_BYTE8* tf_getinstance(void);
extern int tf_getlongp(int*aof_highvalue, int pnum);
@ -276,6 +276,13 @@ extern void tf_putlongp(int pnum, int lowvalue, int highvalue);
extern void tf_putp(int pnum, int value);
/* Activate the misctf function after a delay. The units are of the
current scope. The tf_isetdelay variant specifies a particular
system task instance to use as the context for the
units. tf_getinstance gets that value. */
extern int tf_setdelay(PLI_INT32 delay);
extern int tf_isetdelay(PLI_INT32 delay, void* sys);
/* IEEE1364 NOTE: tf_setworkarea is listed as taking a PLI_BYTE8*, but
that is silly, it really takes any kind of pointer. Taking void* is
compatible with those who pass a PLI_BYTE8*. */
@ -298,6 +305,12 @@ EXTERN_C_END
/*
* $Log: veriuser.h,v $
* Revision 1.25 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules.
*
* Add tf_isetdelay and friends, and add
* callback return values for acc_vcl support.
*
* Revision 1.24 2003/04/23 15:01:29 steve
* Add tf_synchronize and tf_multiply_long.
*