diff --git a/vvp/config.h.in b/vvp/config.h.in index d33b615ca..6e7dfc00a 100644 --- a/vvp/config.h.in +++ b/vvp/config.h.in @@ -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.12 2003/03/13 04:36:57 steve Exp $" +#ident "$Id: config.h.in,v 1.13 2003/03/13 20:31:40 steve Exp $" #endif # define SIZEOF_UNSIGNED_LONG_LONG 0 @@ -42,14 +42,18 @@ #if SIZEOF_UNSIGNED >= 8 typedef unsigned vvp_time64_t; +# define TIME_FMT "" #else # if SIZEOF_UNSIGNED_LONG >= 8 typedef unsigned long vvp_time64_t; +# define TIME_FMT "l" # else # if SIZEOF_UNSIGNED_LONG_LONG > SIZEOF_UNSIGNED_LONG typedef unsigned long long vvp_time64_t; +# define TIME_FMT "ll" # else typedef unsigned long vvp_time64_t; +# define TIME_FMT "l" # endif # endif #endif @@ -79,6 +83,9 @@ typedef unsigned long vvp_time64_t; /* * $Log: config.h.in,v $ + * Revision 1.13 2003/03/13 20:31:40 steve + * Warnings about long long time. + * * Revision 1.12 2003/03/13 04:36:57 steve * Remove the obsolete functor delete functions. * diff --git a/vvp/stop.cc b/vvp/stop.cc index 8d0c78a79..d6af7c3b5 100644 --- a/vvp/stop.cc +++ b/vvp/stop.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: stop.cc,v 1.6 2003/03/10 23:37:07 steve Exp $" +#ident "$Id: stop.cc,v 1.7 2003/03/13 20:31:40 steve Exp $" #endif /* @@ -393,7 +393,8 @@ static void invoke_command(char*txt) void stop_handler(int rc) { printf("** VVP Stop(%d) **\n", rc); - printf("** Current simulation time is %lu ticks.\n", schedule_simtime()); + printf("** Current simulation time is %" TIME_FMT "u ticks.\n", + schedule_simtime()); interact_flag = true; while (interact_flag) { @@ -420,6 +421,9 @@ void stop_handler(int rc) /* * $Log: stop.cc,v $ + * Revision 1.7 2003/03/13 20:31:40 steve + * Warnings about long long time. + * * Revision 1.6 2003/03/10 23:37:07 steve * Direct support for string parameters. * diff --git a/vvp/vpi_time.cc b/vvp/vpi_time.cc index 94ce2ec03..68610be5e 100644 --- a/vvp/vpi_time.cc +++ b/vvp/vpi_time.cc @@ -17,9 +17,10 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vpi_time.cc,v 1.13 2003/03/13 04:59:21 steve Exp $" +#ident "$Id: vpi_time.cc,v 1.14 2003/03/13 20:31:41 steve Exp $" #endif +# include "config.h" # include "vpi_priv.h" # include "schedule.h" # include @@ -140,8 +141,8 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp) struct __vpiSystemTime*rfp = reinterpret_cast(ref); - unsigned long x, num_bits; - vvp_time64_t simtime = schedule_simtime(); + unsigned long num_bits; + vvp_time64_t x, simtime = schedule_simtime(); int units = rfp->scope? rfp->scope->time_units : vpi_time_precision; char*rbuf = need_result_buf(128, RBUF_VAL); @@ -172,13 +173,13 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp) break; case vpiRealVal: - vp->value.real = pow(10, vpi_time_precision-rfp->scope->time_units) - * schedule_simtime(); + vp->value.real = pow(10, vpi_time_precision - units); + vp->value.real *= schedule_simtime(); break; - case vpiBinStrVal: + case vpiBinStrVal: x = simtime; - num_bits = 8 * sizeof(unsigned long); + num_bits = 8 * sizeof(vvp_time64_t); rbuf[num_bits] = 0; for (unsigned i = 1; i <= num_bits; i++) { @@ -190,17 +191,17 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp) break; case vpiDecStrVal: - sprintf(rbuf, "%lu", simtime); + sprintf(rbuf, "%" TIME_FMT "u", simtime); vp->value.str = rbuf; break; case vpiOctStrVal: - sprintf(rbuf, "%lo", simtime); + sprintf(rbuf, "%" TIME_FMT "o", simtime); vp->value.str = rbuf; break; case vpiHexStrVal: - sprintf(rbuf, "%lx", simtime); + sprintf(rbuf, "%" TIME_FMT "x", simtime); vp->value.str = rbuf; break; @@ -268,6 +269,9 @@ void vpip_set_time_precision(int pre) /* * $Log: vpi_time.cc,v $ + * Revision 1.14 2003/03/13 20:31:41 steve + * Warnings about long long time. + * * Revision 1.13 2003/03/13 04:59:21 steve * Use rbufs instead of static buffers. *