Support specified times in cbReadOnlySync, and
add support for cbReadWriteSync. Keep simulation time in a 64bit number.
This commit is contained in:
parent
47a3b1f744
commit
eb708c1540
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: config.h.in,v 1.9 2001/10/20 01:03:42 steve Exp $"
|
||||
#ident "$Id: config.h.in,v 1.10 2002/04/20 04:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
# define SIZEOF_UNSIGNED_LONG 0
|
||||
|
|
@ -41,6 +41,20 @@
|
|||
# define MODULE_DIR "."
|
||||
#endif
|
||||
|
||||
#if SIZEOF_UNSIGNED >= 8
|
||||
typedef unsigned vvp_time64_t;
|
||||
#else
|
||||
# if SIZEOF_UNSIGNED_LONG >= 8
|
||||
typedef unsigned long vvp_time64_t;
|
||||
# else
|
||||
# if SIZEOF_UNSIGNED_LONG_LONG > SIZEOF_UNSIGNED_LONG
|
||||
typedef unsigned long long vvp_time64_t;
|
||||
# else
|
||||
typedef unsigned long vvp_time64_t;
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_LIBREADLINE) && defined(ENABLE_VVP_DEBUG)
|
||||
# define WITH_DEBUG 1
|
||||
#endif
|
||||
|
|
@ -70,6 +84,11 @@
|
|||
|
||||
/*
|
||||
* $Log: config.h.in,v $
|
||||
* Revision 1.10 2002/04/20 04:33:23 steve
|
||||
* Support specified times in cbReadOnlySync, and
|
||||
* add support for cbReadWriteSync.
|
||||
* Keep simulation time in a 64bit number.
|
||||
*
|
||||
* Revision 1.9 2001/10/20 01:03:42 steve
|
||||
* Print memory usage information if requested (Stephan Boettcher)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ AC_ARG_ENABLE(vvp-debug, vvp-debug -- interactive debugger for VVP runtime.,
|
|||
|
||||
AC_CHECK_HEADERS(getopt.h malloc.h)
|
||||
|
||||
AC_CHECK_SIZEOF(unsigned long long)
|
||||
AC_CHECK_SIZEOF(unsigned long)
|
||||
AC_CHECK_SIZEOF(unsigned)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: schedule.cc,v 1.15 2002/03/17 03:23:55 steve Exp $"
|
||||
#ident "$Id: schedule.cc,v 1.16 2002/04/20 04:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "schedule.h"
|
||||
|
|
@ -276,8 +276,8 @@ void schedule_generic(vvp_gen_event_t obj, unsigned char val, unsigned delay)
|
|||
schedule_event_(cur);
|
||||
}
|
||||
|
||||
static unsigned long schedule_time;
|
||||
unsigned long schedule_simtime(void)
|
||||
static vvp_time64_t schedule_time;
|
||||
vvp_time64_t schedule_simtime(void)
|
||||
{ return schedule_time; }
|
||||
|
||||
void schedule_simulate(void)
|
||||
|
|
@ -364,6 +364,11 @@ void schedule_simulate(void)
|
|||
|
||||
/*
|
||||
* $Log: schedule.cc,v $
|
||||
* Revision 1.16 2002/04/20 04:33:23 steve
|
||||
* Support specified times in cbReadOnlySync, and
|
||||
* add support for cbReadWriteSync.
|
||||
* Keep simulation time in a 64bit number.
|
||||
*
|
||||
* Revision 1.15 2002/03/17 03:23:55 steve
|
||||
* Force the push flags to be explicit.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: schedule.h,v 1.8 2001/10/31 04:27:47 steve Exp $"
|
||||
#ident "$Id: schedule.h,v 1.9 2002/04/20 04:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vthread.h"
|
||||
|
|
@ -71,7 +71,7 @@ extern void schedule_simulate(void);
|
|||
* internally by the scheduler (which uses time differences instead)
|
||||
* but is used for printouts and stuff.
|
||||
*/
|
||||
extern unsigned long schedule_simtime(void);
|
||||
extern vvp_time64_t schedule_simtime(void);
|
||||
|
||||
/*
|
||||
* This function is the equivilent of the $finish system task. It
|
||||
|
|
@ -88,6 +88,11 @@ extern bool schedule_finished(void);
|
|||
|
||||
/*
|
||||
* $Log: schedule.h,v $
|
||||
* Revision 1.9 2002/04/20 04:33:23 steve
|
||||
* Support specified times in cbReadOnlySync, and
|
||||
* add support for cbReadWriteSync.
|
||||
* Keep simulation time in a 64bit number.
|
||||
*
|
||||
* Revision 1.8 2001/10/31 04:27:47 steve
|
||||
* Rewrite the functor type to have fewer functor modes,
|
||||
* and use objects to manage the different types.
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_callback.cc,v 1.11 2002/04/06 20:25:45 steve Exp $"
|
||||
#ident "$Id: vpi_callback.cc,v 1.12 2002/04/20 04:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -226,14 +226,13 @@ static void make_sync_run(vvp_gen_event_t obj, unsigned char)
|
|||
|
||||
struct __vpiCallback*cur = cb->handle;
|
||||
cur->cb_data.time->type = vpiSimTime;
|
||||
cur->cb_data.time->low = schedule_simtime();
|
||||
cur->cb_data.time->high = 0;
|
||||
vpip_time_to_timestruct(cur->cb_data.time, schedule_simtime());
|
||||
(cur->cb_data.cb_rtn)(&cur->cb_data);
|
||||
|
||||
free_vpi_callback(cur);
|
||||
}
|
||||
|
||||
static struct __vpiCallback* make_sync(p_cb_data data)
|
||||
static struct __vpiCallback* make_sync(p_cb_data data, bool readonly_flag)
|
||||
{
|
||||
struct __vpiCallback*obj = new_vpi_callback();
|
||||
obj->cb_data = *data;
|
||||
|
|
@ -243,12 +242,31 @@ static struct __vpiCallback* make_sync(p_cb_data data)
|
|||
obj->next = 0;
|
||||
|
||||
struct sync_cb*cb = new sync_cb;
|
||||
cb->sync_flag = true;
|
||||
cb->sync_flag = readonly_flag? true : false;
|
||||
cb->run = &make_sync_run;
|
||||
cb->handle = obj;
|
||||
obj->cb_sync = cb;
|
||||
|
||||
schedule_generic(cb, 0, 0);
|
||||
switch (obj->cb_time.type) {
|
||||
case vpiSuppressTime:
|
||||
schedule_generic(cb, 0, 0);
|
||||
break;
|
||||
|
||||
case vpiSimTime:
|
||||
{ vvp_time64_t tv = vpip_timestruct_to_time(&obj->cb_time);
|
||||
vvp_time64_t tn = schedule_simtime();
|
||||
if (tv < tn) {
|
||||
schedule_generic(cb, 0, 0);
|
||||
} else {
|
||||
schedule_generic(cb, 0, tv - tn);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
break;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
|
@ -263,7 +281,11 @@ vpiHandle vpi_register_cb(p_cb_data data)
|
|||
break;
|
||||
|
||||
case cbReadOnlySynch:
|
||||
obj = make_sync(data);
|
||||
obj = make_sync(data, true);
|
||||
break;
|
||||
|
||||
case cbReadWriteSynch:
|
||||
obj = make_sync(data, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -313,21 +335,21 @@ void callback_functor_s::set(vvp_ipoint_t, bool, unsigned val, unsigned)
|
|||
}
|
||||
}
|
||||
cur->cb_data.time->type = vpiSimTime;
|
||||
cur->cb_data.time->low = schedule_simtime();
|
||||
cur->cb_data.time->high = 0;
|
||||
vpip_time_to_timestruct(cur->cb_data.time, schedule_simtime());
|
||||
(cur->cb_data.cb_rtn)(&cur->cb_data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void vpip_trip_monitor_callbacks(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: vpi_callback.cc,v $
|
||||
* Revision 1.12 2002/04/20 04:33:23 steve
|
||||
* Support specified times in cbReadOnlySync, and
|
||||
* add support for cbReadWriteSync.
|
||||
* Keep simulation time in a 64bit number.
|
||||
*
|
||||
* Revision 1.11 2002/04/06 20:25:45 steve
|
||||
* cbValueChange automatically replays.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_priv.h,v 1.30 2002/04/14 03:53:20 steve Exp $"
|
||||
#ident "$Id: vpi_priv.h,v 1.31 2002/04/20 04:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_user.h"
|
||||
|
|
@ -248,6 +248,9 @@ vpiHandle vpip_sim_time(void);
|
|||
extern int vpip_get_time_precision(void);
|
||||
extern void vpip_set_time_precision(int pres);
|
||||
|
||||
extern void vpip_time_to_timestruct(struct t_vpi_time*ts, vvp_time64_t ti);
|
||||
extern vvp_time64_t vpip_timestruct_to_time(const struct t_vpi_time*ts);
|
||||
|
||||
|
||||
/*
|
||||
** Functions defined in vpi_scope.cc, to keep track of functor scope.
|
||||
|
|
@ -269,6 +272,11 @@ extern unsigned vpip_bits_to_dec_str(const unsigned char *bits,
|
|||
|
||||
/*
|
||||
* $Log: vpi_priv.h,v $
|
||||
* Revision 1.31 2002/04/20 04:33:23 steve
|
||||
* Support specified times in cbReadOnlySync, and
|
||||
* add support for cbReadWriteSync.
|
||||
* Keep simulation time in a 64bit number.
|
||||
*
|
||||
* Revision 1.30 2002/04/14 03:53:20 steve
|
||||
* Allow signed constant vectors for call_vpi parameters.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_time.cc,v 1.6 2002/01/15 03:06:29 steve Exp $"
|
||||
#ident "$Id: vpi_time.cc,v 1.7 2002/04/20 04:33:23 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_priv.h"
|
||||
|
|
@ -28,6 +28,20 @@
|
|||
|
||||
static int vpi_time_precision = 0;
|
||||
|
||||
void vpip_time_to_timestruct(struct t_vpi_time*ts, vvp_time64_t ti)
|
||||
{
|
||||
ts->low = ti & 0xFFFFFFFF;
|
||||
ts->high = (ti >> 32) & 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
vvp_time64_t vpip_timestruct_to_time(const struct t_vpi_time*ts)
|
||||
{
|
||||
vvp_time64_t ti = ts->high;
|
||||
ti <<= 32;
|
||||
ti += ts->low & 0xffffffff;
|
||||
return ti;
|
||||
}
|
||||
|
||||
static struct __vpiSystemTime {
|
||||
struct __vpiHandle base;
|
||||
struct t_vpi_time value;
|
||||
|
|
@ -60,8 +74,7 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp)
|
|||
case vpiTimeVal:
|
||||
vp->value.time = &time_handle.value;
|
||||
vp->value.time->type = vpiSimTime;
|
||||
vp->value.time->high = 0;
|
||||
vp->value.time->low = schedule_simtime();
|
||||
vpip_time_to_timestruct(vp->value.time, schedule_simtime());
|
||||
vp->format = vpiTimeVal;
|
||||
break;
|
||||
|
||||
|
|
@ -129,6 +142,11 @@ void vpip_set_time_precision(int pre)
|
|||
|
||||
/*
|
||||
* $Log: vpi_time.cc,v $
|
||||
* Revision 1.7 2002/04/20 04:33:23 steve
|
||||
* Support specified times in cbReadOnlySync, and
|
||||
* add support for cbReadWriteSync.
|
||||
* Keep simulation time in a 64bit number.
|
||||
*
|
||||
* Revision 1.6 2002/01/15 03:06:29 steve
|
||||
* Support vpiSize and vpiSigned for time objects.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue