1) Adds configure logic to clean up compiler warnings

2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
   tf_isetrealdelay, acc_handle_scope
3) makes acc_next reentrant
4) adds basic vpiWire type support
5) fills in some acc_object_of_type() and acc_fetch_{full}type()
6) add vpiLeftRange/RigthRange to signals
This commit is contained in:
steve 2003-06-04 01:56:20 +00:00
parent d3daa997b5
commit 1c65ea08e8
16 changed files with 432 additions and 100 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.16 2003/05/30 04:18:31 steve Exp $"
#ident "$Id: acc_user.h,v 1.17 2003/06/04 01:56:20 steve Exp $"
#endif
/*
@ -57,14 +57,21 @@ typedef struct __vpiHandle *handle;
#define accScope 21
#define accNet 25
#define accReg 30
#define accIntegerParam 200
#define accRealParam 202
#define accStringParam 204
#define accParameter 220
#define accTopModule 224
#define accModuleInstance 226
#define accWire 260
#define accNamedEvent 280
#define accIntegerVar 281
#define accIntVar 281
#define accRealVar 282
#define accTimeVar 283
#define accIntVar accIntegerVar
#define accScalar 300
#define accVector 302
#define accUnknown 412
#define accConstant 600
/* type VALUES FOR t_setval_delay STRUCTURE */
@ -215,6 +222,7 @@ extern PLI_INT32 acc_fetch_size(handle obj);
extern PLI_INT32 acc_fetch_type(handle obj);
extern PLI_INT32 acc_fetch_fulltype(handle obj);
extern PLI_INT32 acc_fetch_range(handle object, int *msb, int *lsb);
extern char* acc_fetch_type_str(PLI_INT32 type);
extern char* acc_fetch_value(handle obj, const char*fmt, s_acc_value*value);
@ -222,11 +230,15 @@ extern char* acc_fetch_value(handle obj, const char*fmt, s_acc_value*value);
extern handle acc_handle_by_name(const char*name, handle scope);
extern handle acc_handle_object(const char*name);
extern handle acc_handle_parent(handle obj);
extern handle acc_handle_scope(handle obj);
extern handle acc_handle_tfarg(int n);
extern handle acc_handle_tfinst(void);
extern PLI_INT32 acc_compare_handles(handle, handle);
extern handle acc_next(PLI_INT32 *, handle, handle);
extern handle acc_next_scope(handle, handle);
extern handle acc_next_topmod(handle prev_topmod);
extern int acc_object_in_typelist(handle object, PLI_INT32*typelist);
@ -248,6 +260,15 @@ EXTERN_C_END
/*
* $Log: acc_user.h,v $
* Revision 1.17 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.16 2003/05/30 04:18:31 steve
* Add acc_next function.
*

View File

@ -16,7 +16,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.25 2003/05/30 04:18:31 steve Exp $"
#ident "$Id: Makefile.in,v 1.26 2003/06/04 01:56:20 steve Exp $"
#
#
SHELL = /bin/sh
@ -45,13 +45,14 @@ LDFLAGS = @LDFLAGS@
STRIP = @STRIP@
RANLIB = @RANLIB@
A = a_close.o a_configure.o a_fetch_argc.o a_fetch_argv.o a_fetch_fullname.o \
a_fetch_location.o a_fetch_param.o a_fetch_tfarg.o a_fetch_time.o \
a_fetch_type.o a_fetch_type_str.o a_fetch_value.o \
a_handle_by_name.o a_handle_object.o a_handle_parent.o a_handle_tfarg.o \
a_initialize.o a_next.o a_next_topmod.o a_object_of_type.o \
a_product_version.o \
A = a_close.o a_compare_handles.o a_configure.o a_fetch_argc.o \
a_fetch_argv.o a_fetch_fullname.o a_fetch_location.o \
a_fetch_param.o a_fetch_range.o a_fetch_tfarg.o a_fetch_time.o \
a_fetch_type.o a_fetch_type_str.o a_fetch_value.o a_handle_by_name.o \
a_handle_object.o a_handle_parent.o a_handle_tfarg.o a_initialize.o \
a_next.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 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

@ -0,0 +1,42 @@
/* vi:sw=6
* Copyright (c) 2003 Michael Ruff (mruff at chiaro.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
*/
#if !defined(WINNT)
#ident "$Id: a_compare_handles.c,v 1.1 2003/06/04 01:56:20 steve Exp $"
#endif
# include <vpi_user.h>
# include <acc_user.h>
int acc_compare_handles(handle handle1, handle handle2)
{
return handle1 == handle2;
}
/*
* $Log: a_compare_handles.c,v $
* Revision 1.1 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
*/

View File

@ -0,0 +1,47 @@
/* vi:sw=6
* Copyright (c) 2003 Michael Ruff (mruff at chiaro.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: a_fetch_range.c,v 1.1 2003/06/04 01:56:20 steve Exp $"
#endif
#include <vpi_user.h>
#include <acc_user.h>
/*
* acc_fetch_range implemented using VPI interface
*/
PLI_INT32 acc_fetch_range(handle object, PLI_INT32 *msb, PLI_INT32 *lsb)
{
*msb = vpi_get(vpiLeftRange, object);
*lsb = vpi_get(vpiRightRange, object);
return 0;
}
/*
* $Log: a_fetch_range.c,v $
* Revision 1.1 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
*/

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_type.c,v 1.6 2003/05/30 04:18:31 steve Exp $"
#ident "$Id: a_fetch_type.c,v 1.7 2003/06/04 01:56:20 steve Exp $"
#endif
# include <acc_user.h>
@ -42,6 +42,9 @@ PLI_INT32 acc_fetch_type(handle obj)
else
return accConstant;
case vpiNamedEvent:
return accNamedEvent;
case vpiNet:
return accNet;
@ -60,7 +63,7 @@ PLI_INT32 acc_fetch_type(handle obj)
default:
vpi_printf("acc_fetch_type: vpiType %d is what accType?\n",
vpi_get(vpiType, obj));
return 0;
return accUnknown;
}
return 0;
@ -68,7 +71,20 @@ PLI_INT32 acc_fetch_type(handle obj)
PLI_INT32 acc_fetch_fulltype(handle obj)
{
switch (vpi_get(vpiType, obj)) {
int type = vpi_get(vpiType, obj);
switch (type) {
case vpiNet: {
type = vpi_get(vpiNetType, obj);
switch(type) {
case vpiWire: return accWire;
default:
vpi_printf("acc_fetch_fulltype: vpiNetType %d unknown?\n",
type);
return accUnknown;
}
}
case vpiConstant:
/* see acc_fetch_type */
if (vpi_get(vpiConstType, obj) == vpiStringConst)
@ -76,8 +92,7 @@ PLI_INT32 acc_fetch_fulltype(handle obj)
else
return accConstant;
case vpiIntegerVar:
return accIntegerVar;
case vpiIntegerVar: return accIntegerVar;
case vpiModule:
if (!vpi_handle(vpiScope, obj))
@ -86,18 +101,35 @@ PLI_INT32 acc_fetch_fulltype(handle obj)
return accModuleInstance;
// FIXME accCellInstance
case vpiReg:
return accReg;
case vpiNamedEvent: return accNamedEvent;
case vpiParameter:
switch(vpi_get(vpiConstType, obj)) {
case vpiRealConst: return accRealParam;
case vpiStringConst: return accStringParam;
default: return accIntegerParam;
}
case vpiReg: return accReg;
default:
vpi_printf("acc_fetch_fulltype: vpiType %d is what accType?\n",
vpi_get(vpiType, obj));
return 0;
vpi_printf("acc_fetch_fulltype: vpiType %d unknown?\n",
type);
return accUnknown;
}
}
/*
* $Log: a_fetch_type.c,v $
* Revision 1.7 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.6 2003/05/30 04:18:31 steve
* Add acc_next function.
*

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_handle_parent.c,v 1.1 2003/03/13 04:35:09 steve Exp $"
#ident "$Id: a_handle_parent.c,v 1.2 2003/06/04 01:56:20 steve Exp $"
#endif
#include <vpi_user.h>
@ -34,8 +34,23 @@ handle acc_handle_parent(handle obj)
return scope;
}
handle acc_handle_scope(handle obj)
{
return vpi_handle(vpiScope, obj);
}
/*
* $Log: a_handle_parent.c,v $
* Revision 1.2 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.1 2003/03/13 04:35:09 steve
* Add a bunch of new acc_ and tf_ functions.
*

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_next.c,v 1.1 2003/05/30 04:18:31 steve Exp $"
#ident "$Id: a_next.c,v 1.2 2003/06/04 01:56:20 steve Exp $"
#endif
#include <stdio.h>
@ -30,12 +30,7 @@
*/
handle acc_next(PLI_INT32 *type, handle scope, handle prev)
{
vpiHandle hand;
/* preserved state */
static vpiHandle pscope = 0;
static vpiHandle iter = 0;
static vpiHandle rtn = 0;
vpiHandle iter, hand = 0;
/* trace */
if (pli_trace) {
@ -55,49 +50,59 @@ handle acc_next(PLI_INT32 *type, handle scope, handle prev)
fflush(pli_trace);
}
/* initialize or reset if detect user dain bramaged */
if (!prev || !*type || scope != pscope || prev != rtn) {
/* if iterator still valid, free it */
if (iter) vpi_free_object(iter);
/* iterate across all things in specified scope */
if (!*type) {
pscope = iter = rtn = 0;
goto err;
} else {
pscope = scope;
iter = vpi_iterate(vpiScope, pscope);
/*
* The acc_next_* functions need to be reentrant, so we need to
* rescan all the items upto the previous one, then return
* the next one.
*/
iter = vpi_iterate(vpiScope, scope); // ICARUS extension
if (prev) {
while ((hand = vpi_scan(iter))) {
if (hand == prev) break;
}
}
/* scan iterator */
rtn = 0;
while ((hand = vpi_scan(iter))) {
if (acc_object_in_typelist(hand, type)) {
rtn = hand;
break;
/* scan for next */
if (hand) {
while ((hand = vpi_scan(iter))) {
if (acc_object_in_typelist(hand, type))
break;
}
}
/* if we exhausted iterator, cleanup */
if (!hand) { pscope = iter = 0; }
/* don't leak iterators */
if (hand) vpi_free_object(iter);
err:
/* trace */
if (pli_trace) {
fprintf(pli_trace, " --> %p", rtn);
if (rtn)
fprintf(pli_trace, " \"%s\"\n", vpi_get_str(vpiName, rtn));
fprintf(pli_trace, " --> %p", hand);
if (hand)
fprintf(pli_trace, " \"%s\"\n", vpi_get_str(vpiName, hand));
else
fprintf(pli_trace, "\n");
}
return rtn;
return hand;
}
handle acc_next_scope(handle scope, handle prev)
{
PLI_INT32 type[2] = {accScope, 0};
return acc_next(type, scope, prev);
}
/*
* $Log: a_next.c,v $
* Revision 1.2 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.1 2003/05/30 04:18:31 steve
* Add acc_next function.
*

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_object_of_type.c,v 1.4 2003/05/30 04:18:31 steve Exp $"
#ident "$Id: a_object_of_type.c,v 1.5 2003/06/04 01:56:20 steve Exp $"
#endif
#include <assert.h>
@ -43,10 +43,7 @@ PLI_INT32 acc_object_of_type(handle object, PLI_INT32 type)
vtype = vpi_get(vpiType, object);
switch (type) {
case accModule:
if (vtype == vpiModule)
rtn = 1;
break;
case accModule: rtn = vtype == vpiModule; break;
case accScope:
if (vtype == vpiModule || vtype == vpiNamedBegin ||
@ -54,15 +51,20 @@ PLI_INT32 acc_object_of_type(handle object, PLI_INT32 type)
vtype == vpiFunction) rtn = 1;
break;
case accNet:
if (vtype == vpiNet)
case accNet: rtn = vtype == vpiNet; break;
case accReg: rtn = vtype == vpiReg; break;
case accRealParam:
if (vtype == vpiNamedEvent &&
vpi_get(vpiConstType, object) == vpiRealConst)
rtn = 1;
break;
case accReg:
if (vtype == vpiReg)
rtn = 1;
break;
case accParameter: rtn = vtype == vpiParameter; break;
case accNamedEvent: rtn = vtype == vpiNamedEvent; break;
case accIntegerVar: rtn = vtype == vpiIntegerVar; break;
case accRealVar: rtn = vtype == vpiRealVar; break;
case accTimeVar: rtn = vtype == vpiTimeVar; break;
case accScalar:
if (vtype == vpiReg || vtype == vpiNet)
@ -74,11 +76,6 @@ PLI_INT32 acc_object_of_type(handle object, PLI_INT32 type)
rtn = vpi_get(vpiSize, object) > 1;
break;
case accParameter:
if (vtype == vpiParameter)
rtn = 1;
break;
default:
vpi_printf("acc_object_of_type: Unknown type %d\n", type);
rtn = 0;
@ -104,6 +101,15 @@ PLI_INT32 acc_object_in_typelist(handle object, PLI_INT32*typelist)
/*
* $Log: a_object_of_type.c,v $
* Revision 1.5 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.4 2003/05/30 04:18:31 steve
* Add acc_next function.
*

55
libveriuser/config.h.in Normal file
View File

@ -0,0 +1,55 @@
#ifndef __config_H
#define __config_H
/*
* 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
*/
#if !defined(WINNT)
#ident "$Id: config.h.in,v 1.1 2003/06/04 01:56:20 steve Exp $"
#endif
# define SIZEOF_UNSIGNED_LONG_LONG 0
# define SIZEOF_UNSIGNED_LONG 0
# define SIZEOF_UNSIGNED 0
#if SIZEOF_UNSIGNED >= 8
typedef unsigned ivl_u64_t;
#else
# if SIZEOF_UNSIGNED_LONG >= 8
typedef unsigned long ivl_u64_t;
# else
# if SIZEOF_UNSIGNED_LONG_LONG > SIZEOF_UNSIGNED_LONG
typedef unsigned long long ivl_u64_t;
# else
typedef unsigned long ivl_u64_t;
# endif
# endif
#endif
/*
* $Log: config.h.in,v $
* Revision 1.1 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
*/
#endif

View File

@ -1,4 +1,5 @@
AC_INIT(Makefile.in)
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_PROG_INSTALL
@ -9,6 +10,10 @@ AC_EXEEXT
AC_CHECK_HEADERS(malloc.h)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned)
# Darwin requires -no-cpp-precomp
case "${host}" in
*-*-darwin*)

View File

@ -17,22 +17,23 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: getsimtime.c,v 1.8 2003/05/30 04:01:55 steve Exp $"
#ident "$Id: getsimtime.c,v 1.9 2003/06/04 01:56:20 steve Exp $"
#endif
#include <veriuser.h>
#include <vpi_user.h>
#include <stdlib.h>
#include <math.h>
#include "config.h"
/*
* some TF time routines implemented using VPI interface
*/
static long long
static ivl_u64_t
scale(int high, int low, void*obj) {
vpiHandle hand = vpi_handle(vpiScope, vpi_handle(vpiSysTfCall,0));
long long scaled;
ivl_u64_t scaled;
scaled = high;
scaled = (scaled << 32) | low;
@ -68,7 +69,7 @@ char *tf_strgettime(void)
PLI_INT32 tf_getlongtime(PLI_INT32 *high)
{
s_vpi_time time;
long long scaled;
ivl_u64_t scaled;
time.type = vpiSimTime;
vpi_get_time (0, &time);
scaled = scale(time.high, time.low, 0);
@ -80,7 +81,7 @@ PLI_INT32 tf_getlongtime(PLI_INT32 *high)
PLI_INT32 tf_igetlongtime(PLI_INT32 *high, void*obj)
{
s_vpi_time time;
long long scaled;
ivl_u64_t scaled;
time.type = vpiSimTime;
vpi_get_time ((vpiHandle)obj, &time);
scaled = scale(time.high, time.low, obj);
@ -96,7 +97,7 @@ PLI_INT32 tf_getlongsimtime(PLI_INT32 *high) \
void tf_scale_longdelay(void*obj, PLI_INT32 lo, PLI_INT32 hi,
PLI_INT32 *low, PLI_INT32 *high)
{
long long scaled = scale(hi, lo, obj);
ivl_u64_t scaled = scale(hi, lo, obj);
*high = (scaled >> 32) & 0xffffffff;
*low = scaled & 0xffffffff;
}
@ -129,6 +130,15 @@ PLI_INT32 tf_igettimeunit(void*obj)
/*
* $Log: getsimtime.c,v $
* Revision 1.9 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.8 2003/05/30 04:01:55 steve
* Add tf_scale_longdelay.
*

View File

@ -17,42 +17,43 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: math.c,v 1.1 2003/04/23 15:01:29 steve Exp $"
#ident "$Id: math.c,v 1.2 2003/06/04 01:56:20 steve Exp $"
#endif
# include <string.h>
# include <stdlib.h>
# include <assert.h>
# include "config.h"
# include "vpi_user.h"
# include "veriuser.h"
void tf_multiply_long(PLI_INT32*aof_low1, PLI_INT32*aof_high1,
PLI_INT32 aof_low2, PLI_INT32 aof_high2)
{
if (sizeof(long) == 8) {
long a, b;
a = (*aof_high1 << 32) | (*aof_low1);
b = (aof_high2 << 32) | (aof_low2);
a *= b;
*aof_low1 = a & 0xffffffff;
a >>= 32;
*aof_high1 = a & 0xffffffff;
} else if (sizeof(long long) == 8) {
long long a, b;
a = (*aof_high1 << 32) | (*aof_low1);
b = ( aof_high2 << 32) | ( aof_low2);
a *= b;
*aof_low1 = a & 0xffffffff;
a >>= 32;
*aof_high1 = a & 0xffffffff;
} else {
assert(0);
}
ivl_u64_t a, b;
a = *aof_high1;
a <<= 32;
a |= *aof_low1;
b = aof_high2;
b <<= 32;
b |= aof_low2;
a *= b;
*aof_low1 = a & 0xffffffff;
a >>= 32;
*aof_high1 = a & 0xffffffff;
}
/*
* $Log: math.c,v $
* Revision 1.2 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.1 2003/04/23 15:01:29 steve
* Add tf_synchronize and tf_multiply_long.
*

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.10 2003/05/30 04:05:32 steve Exp $"
#ident "$Id: veriusertfs.c,v 1.11 2003/06/04 01:56:20 steve Exp $"
#endif
/*
@ -29,9 +29,11 @@
# include <string.h>
# include <stdlib.h>
# include <assert.h>
# include <math.h>
# include "config.h"
# include "priv.h"
# include "vpi_user.h"
# include "veriuser.h"
# include "priv.h"
/*
* local structure used to hold the persistent veriusertfs data
@ -263,6 +265,9 @@ static int callback(p_cb_data data)
case cbReadOnlySynch:
reason = reason_rosynch;
break;
case cbAfterDelay:
reason = reason_reactivate;
break;
default:
assert(0);
}
@ -334,8 +339,51 @@ PLI_INT32 tf_rosynchronize(void)
return tf_irosynchronize(tf_getinstance());
}
PLI_INT32 tf_isetrealdelay(double dly, void*obj)
{
vpiHandle sys = (vpiHandle)obj;
p_pli_data pli = vpi_get_userdata(sys);
s_cb_data cb;
s_vpi_time ti = {vpiSimTime};
// Scale delay to SimTime
ivl_u64_t delay = ((dly
* pow(10, tf_gettimeprecision() - tf_gettimeunit()))
+ 0.5);
ti.high = delay >> 32 & 0xffffffff;
ti.low = delay & 0xffffffff;
cb.reason = cbAfterDelay;
cb.cb_rtn = callback;
cb.obj = sys;
cb.time = &ti;
cb.user_data = (char *)pli;
vpi_register_cb(&cb);
if (pli_trace)
fprintf(pli_trace, "tf_isetrealdelay(%f, %p) --> %d\n",
dly, obj, 0);
return 0;
}
PLI_INT32 tf_setrealdelay(double dly)
{
return tf_isetrealdelay(dly, tf_getinstance());
}
/*
* $Log: veriusertfs.c,v $
* Revision 1.11 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.10 2003/05/30 04:05:32 steve
* Add tf_rosynchronize and friends.
*

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.31 2003/05/30 04:22:13 steve Exp $"
#ident "$Id: veriuser.h,v 1.32 2003/06/04 01:56:20 steve Exp $"
#endif
/*
@ -167,6 +167,8 @@ extern void veriusertfs_register_table(p_tfcell vtable);
#define reason_synch 8
#define REASON_SYNCH reason_synch
#define reason_finish 9
#define reason_reactivate 10
#define REASON_REACTIVATE reason_reactivate
#define reason_rosynch 11
#define REASON_ROSYNCH reason_rosynch
#define reason_endofcompile 16
@ -323,6 +325,9 @@ extern PLI_INT32 tf_isynchronize(void* sys);
extern PLI_INT32 tf_rosynchronize(void);
extern PLI_INT32 tf_irosynchronize(void* sys);
extern PLI_INT32 tf_setrealdelay(double realdelay);
extern PLI_INT32 tf_isetrealdelay(double realdelay, void*inst);
extern PLI_INT32 tf_typep(PLI_INT32 narg);
extern void tf_warning(const char*, ...)
@ -332,6 +337,15 @@ EXTERN_C_END
/*
* $Log: veriuser.h,v $
* Revision 1.32 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.31 2003/05/30 04:22:13 steve
* Add tf_strgetp functions.
*

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_user.h,v 1.27 2003/05/29 02:21:45 steve Exp $"
#ident "$Id: vpi_user.h,v 1.28 2003/06/04 01:56:20 steve Exp $"
#endif
@ -190,6 +190,8 @@ typedef struct t_vpi_value {
#define vpiDefName 9
#define vpiTimeUnit 11
#define vpiTimePrecision 12
#define vpiNetType 22
# define vpiWire 1
#define vpiConstType 43
# define vpiDecConst 1
# define vpiRealConst 2
@ -397,6 +399,15 @@ EXTERN_C_END
/*
* $Log: vpi_user.h,v $
* Revision 1.28 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.27 2003/05/29 02:21:45 steve
* Implement acc_fetch_defname and its infrastructure in vvp.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vpi_signal.cc,v 1.56 2003/05/02 04:29:57 steve Exp $"
#ident "$Id: vpi_signal.cc,v 1.57 2003/06/04 01:56:20 steve Exp $"
#endif
/*
@ -96,6 +96,15 @@ static int signal_get(int code, vpiHandle ref)
else
return rfp->lsb - rfp->msb + 1;
case vpiNetType:
if (ref->vpi_type->type_code==vpiNet)
return vpiWire;
else
return 0;
case vpiLeftRange: return rfp->msb;
case vpiRightRange: return rfp->lsb;
case _vpiNexusId:
if (rfp->msb == rfp->lsb)
return vvp_fvector_get(rfp->bits, 0);
@ -103,6 +112,7 @@ static int signal_get(int code, vpiHandle ref)
return 0;
default:
vpi_printf("signal_get: property %d is unknown\n", code);
return 0;
}
}
@ -835,6 +845,15 @@ vpiHandle vpip_make_net(const char*name, int msb, int lsb,
/*
* $Log: vpi_signal.cc,v $
* Revision 1.57 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and
* tf_isetrealdelay, acc_handle_scope
* 3) makes acc_next reentrant
* 4) adds basic vpiWire type support
* 5) fills in some acc_object_of_type() and acc_fetch_{full}type()
* 6) add vpiLeftRange/RigthRange to signals
*
* Revision 1.56 2003/05/02 04:29:57 steve
* Add put_value with transport delay.
*