Make simulation precision available to VPI.

This commit is contained in:
steve 2000-07-26 03:53:11 +00:00
parent 5f7c298a21
commit 08e6bf2e27
5 changed files with 50 additions and 5 deletions

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: t-vvm.cc,v 1.162 2000/07/14 06:12:57 steve Exp $"
#ident "$Id: t-vvm.cc,v 1.163 2000/07/26 03:53:11 steve Exp $"
#endif
# include <iostream>
@ -922,6 +922,8 @@ void target_vvm::start_design(ostream&os, const Design*mod)
init_code << "{" << endl;
init_code << " vpip_init_simulation();"
<< endl;
init_code << " vpip_time_scale("
<< mod->get_precision() << ");" << endl;
start_code << "static void design_start()" << endl;
start_code << "{" << endl;
}
@ -3086,6 +3088,9 @@ extern const struct target tgt_vvm = {
};
/*
* $Log: t-vvm.cc,v $
* Revision 1.163 2000/07/26 03:53:11 steve
* Make simulation precision available to VPI.
*
* Revision 1.162 2000/07/14 06:12:57 steve
* Move inital value handling from NetNet to Nexus
* objects. This allows better propogation of inital

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vpi_user.h,v 1.18 2000/05/31 01:32:16 steve Exp $"
#ident "$Id: vpi_user.h,v 1.19 2000/07/26 03:53:12 steve Exp $"
#endif
#ifdef __cplusplus
@ -133,6 +133,8 @@ typedef struct t_vpi_value {
#define vpiName 2
#define vpiFullName 3
#define vpiSize 4
#define vpiTimeUnit 11
#define vpiTimePrecision 12
#define vpiConstType 43
# define vpiDecConst 1
# define vpiRealConst 2
@ -246,6 +248,9 @@ extern void (*vlog_startup_routines[])();
/*
* $Log: vpi_user.h,v $
* Revision 1.19 2000/07/26 03:53:12 steve
* Make simulation precision available to VPI.
*
* Revision 1.18 2000/05/31 01:32:16 steve
* typ vpiRealType.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vpi_priv.c,v 1.7 2000/05/07 18:20:08 steve Exp $"
#ident "$Id: vpi_priv.c,v 1.8 2000/07/26 03:53:12 steve Exp $"
#endif
# include "vpi_priv.h"
@ -111,11 +111,26 @@ int vpi_free_object(vpiHandle ref)
return 0;
}
static int vpip_get_global(int property)
{
switch (property) {
case vpiTimePrecision:
return vpip_simulation_obj.time_precision;
default:
assert(0);
return -1;
}
}
int vpi_get(int property, vpiHandle ref)
{
if (property == vpiType)
return ref->vpi_type->type_code;
if (ref == 0)
return vpip_get_global(property);
if (ref->vpi_type->vpi_get_ == 0)
return -1;
@ -219,6 +234,9 @@ void vpi_register_systf(const struct t_vpi_systf_data*systf)
/*
* $Log: vpi_priv.c,v $
* Revision 1.8 2000/07/26 03:53:12 steve
* Make simulation precision available to VPI.
*
* Revision 1.7 2000/05/07 18:20:08 steve
* Import MCD support from Stephen Tell, and add
* system function parameter support to the IVL core.

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vpi_priv.h,v 1.21 2000/05/18 03:27:32 steve Exp $"
#ident "$Id: vpi_priv.h,v 1.22 2000/07/26 03:53:12 steve Exp $"
#endif
/*
@ -340,11 +340,16 @@ struct vpip_simulation {
/* List of simulation cycles, starting with the next time. */
struct vpip_simulation_cycle*sim;
int going_flag;
/* This is the precision of the simulation clock. It may be
used by the run time to scale time values. */
short time_precision;
};
extern struct vpip_simulation vpip_simulation_obj;
extern void vpip_init_simulation();
extern void vpip_time_scale(int precision);
extern void vpip_simulation_run();
/*
@ -379,6 +384,9 @@ extern int vpip_finished();
/*
* $Log: vpi_priv.h,v $
* Revision 1.22 2000/07/26 03:53:12 steve
* Make simulation precision available to VPI.
*
* Revision 1.21 2000/05/18 03:27:32 steve
* Support writing scalars and vectors to signals.
*

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vpi_simulation.c,v 1.2 2000/02/23 02:56:56 steve Exp $"
#ident "$Id: vpi_simulation.c,v 1.3 2000/07/26 03:53:12 steve Exp $"
#endif
# include "vpi_priv.h"
@ -70,6 +70,12 @@ void vpip_init_simulation()
cur->delay = 0;
cur->next = cur->prev = cur;
vpip_simulation_obj.sim = cur;
vpip_simulation_obj.time_precision = 0;
}
void vpip_time_scale(int precision)
{
vpip_simulation_obj.time_precision = precision;
}
vpiHandle vpip_sim_time()
@ -195,6 +201,9 @@ void vpip_simulation_run()
/*
* $Log: vpi_simulation.c,v $
* Revision 1.3 2000/07/26 03:53:12 steve
* Make simulation precision available to VPI.
*
* Revision 1.2 2000/02/23 02:56:56 steve
* Macintosh compilers do not support ident.
*