Warnings about long long time.

This commit is contained in:
steve 2003-03-13 20:31:40 +00:00
parent c37153b604
commit e6db4113a5
3 changed files with 28 additions and 13 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #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 #endif
# define SIZEOF_UNSIGNED_LONG_LONG 0 # define SIZEOF_UNSIGNED_LONG_LONG 0
@ -42,14 +42,18 @@
#if SIZEOF_UNSIGNED >= 8 #if SIZEOF_UNSIGNED >= 8
typedef unsigned vvp_time64_t; typedef unsigned vvp_time64_t;
# define TIME_FMT ""
#else #else
# if SIZEOF_UNSIGNED_LONG >= 8 # if SIZEOF_UNSIGNED_LONG >= 8
typedef unsigned long vvp_time64_t; typedef unsigned long vvp_time64_t;
# define TIME_FMT "l"
# else # else
# if SIZEOF_UNSIGNED_LONG_LONG > SIZEOF_UNSIGNED_LONG # if SIZEOF_UNSIGNED_LONG_LONG > SIZEOF_UNSIGNED_LONG
typedef unsigned long long vvp_time64_t; typedef unsigned long long vvp_time64_t;
# define TIME_FMT "ll"
# else # else
typedef unsigned long vvp_time64_t; typedef unsigned long vvp_time64_t;
# define TIME_FMT "l"
# endif # endif
# endif # endif
#endif #endif
@ -79,6 +83,9 @@ typedef unsigned long vvp_time64_t;
/* /*
* $Log: config.h.in,v $ * $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 * Revision 1.12 2003/03/13 04:36:57 steve
* Remove the obsolete functor delete functions. * Remove the obsolete functor delete functions.
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #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 #endif
/* /*
@ -393,7 +393,8 @@ static void invoke_command(char*txt)
void stop_handler(int rc) void stop_handler(int rc)
{ {
printf("** VVP Stop(%d) **\n", 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; interact_flag = true;
while (interact_flag) { while (interact_flag) {
@ -420,6 +421,9 @@ void stop_handler(int rc)
/* /*
* $Log: stop.cc,v $ * $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 * Revision 1.6 2003/03/10 23:37:07 steve
* Direct support for string parameters. * Direct support for string parameters.
* *

View File

@ -17,9 +17,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT #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 #endif
# include "config.h"
# include "vpi_priv.h" # include "vpi_priv.h"
# include "schedule.h" # include "schedule.h"
# include <stdio.h> # include <stdio.h>
@ -140,8 +141,8 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp)
struct __vpiSystemTime*rfp struct __vpiSystemTime*rfp
= reinterpret_cast<struct __vpiSystemTime*>(ref); = reinterpret_cast<struct __vpiSystemTime*>(ref);
unsigned long x, num_bits; unsigned long num_bits;
vvp_time64_t simtime = schedule_simtime(); vvp_time64_t x, simtime = schedule_simtime();
int units = rfp->scope? rfp->scope->time_units : vpi_time_precision; int units = rfp->scope? rfp->scope->time_units : vpi_time_precision;
char*rbuf = need_result_buf(128, RBUF_VAL); char*rbuf = need_result_buf(128, RBUF_VAL);
@ -172,13 +173,13 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp)
break; break;
case vpiRealVal: case vpiRealVal:
vp->value.real = pow(10, vpi_time_precision-rfp->scope->time_units) vp->value.real = pow(10, vpi_time_precision - units);
* schedule_simtime(); vp->value.real *= schedule_simtime();
break; break;
case vpiBinStrVal: case vpiBinStrVal:
x = simtime; x = simtime;
num_bits = 8 * sizeof(unsigned long); num_bits = 8 * sizeof(vvp_time64_t);
rbuf[num_bits] = 0; rbuf[num_bits] = 0;
for (unsigned i = 1; i <= num_bits; i++) { for (unsigned i = 1; i <= num_bits; i++) {
@ -190,17 +191,17 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp)
break; break;
case vpiDecStrVal: case vpiDecStrVal:
sprintf(rbuf, "%lu", simtime); sprintf(rbuf, "%" TIME_FMT "u", simtime);
vp->value.str = rbuf; vp->value.str = rbuf;
break; break;
case vpiOctStrVal: case vpiOctStrVal:
sprintf(rbuf, "%lo", simtime); sprintf(rbuf, "%" TIME_FMT "o", simtime);
vp->value.str = rbuf; vp->value.str = rbuf;
break; break;
case vpiHexStrVal: case vpiHexStrVal:
sprintf(rbuf, "%lx", simtime); sprintf(rbuf, "%" TIME_FMT "x", simtime);
vp->value.str = rbuf; vp->value.str = rbuf;
break; break;
@ -268,6 +269,9 @@ void vpip_set_time_precision(int pre)
/* /*
* $Log: vpi_time.cc,v $ * $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 * Revision 1.13 2003/03/13 04:59:21 steve
* Use rbufs instead of static buffers. * Use rbufs instead of static buffers.
* *