1) setlinebuf() for vpi_trace

2) Addes error checks for trace file opens
 3) removes now extraneous flushes
 4) fixes acc_next() bug
This commit is contained in:
steve 2003-06-17 16:55:07 +00:00
parent b544b319fa
commit bbdf03b457
14 changed files with 164 additions and 73 deletions

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: a_close.c,v 1.3 2003/05/18 00:16:35 steve Exp $" #ident "$Id: a_close.c,v 1.4 2003/06/17 16:55:07 steve Exp $"
#endif #endif
# include <acc_user.h> # include <acc_user.h>
@ -27,12 +27,17 @@ void acc_close(void)
{ {
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "acc_close()\n"); fprintf(pli_trace, "acc_close()\n");
fflush(pli_trace);
} }
} }
/* /*
* $Log: a_close.c,v $ * $Log: a_close.c,v $
* Revision 1.4 2003/06/17 16:55:07 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.3 2003/05/18 00:16:35 steve * Revision 1.3 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules. * Add PLI_TRACE tracing of PLI1 modules.
* *

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: a_configure.c,v 1.2 2003/05/18 00:16:35 steve Exp $" #ident "$Id: a_configure.c,v 1.3 2003/06/17 16:55:07 steve Exp $"
#endif #endif
#include <acc_user.h> #include <acc_user.h>
@ -36,7 +36,6 @@ int acc_configure(PLI_INT32 config_param, const char*value)
fprintf(pli_trace, fprintf(pli_trace,
"acc_configure(accDevelopmentVersion, %s)\n", "acc_configure(accDevelopmentVersion, %s)\n",
value); value);
fflush(pli_trace);
} }
break; break;
@ -45,7 +44,6 @@ int acc_configure(PLI_INT32 config_param, const char*value)
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "acc_configure(config=%d, %s)\n", fprintf(pli_trace, "acc_configure(config=%d, %s)\n",
config_param, value); config_param, value);
fflush(pli_trace);
} }
vpi_printf("XXXX acc_configure(%d, %s)\n", config_param, value); vpi_printf("XXXX acc_configure(%d, %s)\n", config_param, value);
@ -58,6 +56,12 @@ int acc_configure(PLI_INT32 config_param, const char*value)
/* /*
* $Log: a_configure.c,v $ * $Log: a_configure.c,v $
* Revision 1.3 2003/06/17 16:55:07 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.2 2003/05/18 00:16:35 steve * Revision 1.2 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules. * Add PLI_TRACE tracing of PLI1 modules.
* *

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: a_fetch_param.c,v 1.3 2003/05/18 00:16:35 steve Exp $" #ident "$Id: a_fetch_param.c,v 1.4 2003/06/17 16:55:07 steve Exp $"
#endif #endif
#include <assert.h> #include <assert.h>
@ -38,7 +38,6 @@ double acc_fetch_paramval(handle object)
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "acc_fetch_paramval(%s) --> \"%s\"\n", fprintf(pli_trace, "acc_fetch_paramval(%s) --> \"%s\"\n",
vpi_get_str(vpiName, object), val.value.str); vpi_get_str(vpiName, object), val.value.str);
fflush(pli_trace);
} }
return (double) (long)val.value.str; return (double) (long)val.value.str;
@ -52,6 +51,12 @@ double acc_fetch_paramval(handle object)
/* /*
* $Log: a_fetch_param.c,v $ * $Log: a_fetch_param.c,v $
* Revision 1.4 2003/06/17 16:55:07 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.3 2003/05/18 00:16:35 steve * Revision 1.3 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules. * Add PLI_TRACE tracing of PLI1 modules.
* *

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: a_fetch_value.c,v 1.4 2003/05/18 00:16:35 steve Exp $" #ident "$Id: a_fetch_value.c,v 1.5 2003/06/17 16:55:07 steve Exp $"
#endif #endif
# include <acc_user.h> # include <acc_user.h>
@ -57,7 +57,6 @@ static char* fetch_struct_value(handle obj, s_acc_value*value)
"accScalarVal) --> %d\n", "accScalarVal) --> %d\n",
vpi_get_str(vpiFullName,obj), vpi_get_str(vpiFullName,obj),
value->value.scalar); value->value.scalar);
fflush(pli_trace);
} }
break; break;
@ -71,7 +70,6 @@ static char* fetch_struct_value(handle obj, s_acc_value*value)
"accIntVal) --> %d\n", "accIntVal) --> %d\n",
vpi_get_str(vpiFullName,obj), vpi_get_str(vpiFullName,obj),
value->value.integer); value->value.integer);
fflush(pli_trace);
} }
break; break;
@ -85,7 +83,6 @@ static char* fetch_struct_value(handle obj, s_acc_value*value)
"accRealVal) --> %g\n", "accRealVal) --> %g\n",
vpi_get_str(vpiFullName,obj), vpi_get_str(vpiFullName,obj),
value->value.real); value->value.real);
fflush(pli_trace);
} }
break; break;
@ -112,7 +109,6 @@ static char* fetch_strength_value(handle obj)
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "acc_fetch_value(<%s>, \"%%v\") --> %s\n", fprintf(pli_trace, "acc_fetch_value(<%s>, \"%%v\") --> %s\n",
vpi_get_str(vpiFullName,obj), str); vpi_get_str(vpiFullName,obj), str);
fflush(pli_trace);
} }
return __acc_newstring(str); return __acc_newstring(str);
@ -133,6 +129,12 @@ char* acc_fetch_value(handle obj, const char*fmt, s_acc_value*value)
/* /*
* $Log: a_fetch_value.c,v $ * $Log: a_fetch_value.c,v $
* Revision 1.5 2003/06/17 16:55:07 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.4 2003/05/18 00:16:35 steve * Revision 1.4 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules. * Add PLI_TRACE tracing of PLI1 modules.
* *

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: a_handle_by_name.c,v 1.1 2003/05/24 03:02:04 steve Exp $" #ident "$Id: a_handle_by_name.c,v 1.2 2003/06/17 16:55:07 steve Exp $"
#endif #endif
# include <acc_user.h> # include <acc_user.h>
@ -46,7 +46,6 @@ handle acc_handle_by_name(const char*obj_name, handle scope)
fprintf(pli_trace, "acc_handle_by_name(\"%s\", scope=%s) " fprintf(pli_trace, "acc_handle_by_name(\"%s\", scope=%s) "
" --> %p\n", obj_name, " --> %p\n", obj_name,
vpi_get_str(vpiFullName, scope), res); vpi_get_str(vpiFullName, scope), res);
fflush(pli_trace);
} }
return res; return res;
@ -54,6 +53,12 @@ handle acc_handle_by_name(const char*obj_name, handle scope)
/* /*
* $Log: a_handle_by_name.c,v $ * $Log: a_handle_by_name.c,v $
* Revision 1.2 2003/06/17 16:55:07 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.1 2003/05/24 03:02:04 steve * Revision 1.1 2003/05/24 03:02:04 steve
* Add implementation of acc_handle_by_name. * Add implementation of acc_handle_by_name.
* *

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: a_next.c,v 1.2 2003/06/04 01:56:20 steve Exp $" #ident "$Id: a_next.c,v 1.3 2003/06/17 16:55:07 steve Exp $"
#endif #endif
#include <stdio.h> #include <stdio.h>
@ -63,7 +63,7 @@ handle acc_next(PLI_INT32 *type, handle scope, handle prev)
} }
/* scan for next */ /* scan for next */
if (hand) { if (!prev || hand) {
while ((hand = vpi_scan(iter))) { while ((hand = vpi_scan(iter))) {
if (acc_object_in_typelist(hand, type)) if (acc_object_in_typelist(hand, type))
break; break;
@ -94,6 +94,12 @@ handle acc_next_scope(handle scope, handle prev)
/* /*
* $Log: a_next.c,v $ * $Log: a_next.c,v $
* Revision 1.3 2003/06/17 16:55:07 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.2 2003/06/04 01:56:20 steve * Revision 1.2 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings * 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and * 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and

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: a_vcl.c,v 1.5 2003/05/18 00:16:35 steve Exp $" #ident "$Id: a_vcl.c,v 1.6 2003/06/17 16:55:07 steve Exp $"
#endif #endif
#include <vpi_user.h> #include <vpi_user.h>
@ -144,7 +144,6 @@ static PLI_INT32 vcl_value_callback(struct t_cb_data*cb)
vcr.out_value.strengths_s.logic_value, vcr.out_value.strengths_s.logic_value,
vcr.out_value.strengths_s.strength1, vcr.out_value.strengths_s.strength1,
vcr.out_value.strengths_s.strength2); vcr.out_value.strengths_s.strength2);
fflush(pli_trace);
} }
break; break;
@ -187,7 +186,6 @@ void acc_vcl_add(handle obj, PLI_INT32(*consumer)(p_vc_record),
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "acc_vcl_add(<%s>, ..., %p, %d)\n", fprintf(pli_trace, "acc_vcl_add(<%s>, ..., %p, %d)\n",
vpi_get_str(vpiFullName, obj), data, vcl_flag); vpi_get_str(vpiFullName, obj), data, vcl_flag);
fflush(pli_trace);
} }
break; break;
@ -208,6 +206,12 @@ void acc_vcl_delete(handle obj, PLI_INT32(*consumer)(p_vc_record),
/* /*
* $Log: a_vcl.c,v $ * $Log: a_vcl.c,v $
* Revision 1.6 2003/06/17 16:55:07 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.5 2003/05/18 00:16:35 steve * Revision 1.5 2003/05/18 00:16:35 steve
* Add PLI_TRACE tracing of PLI1 modules. * Add PLI_TRACE tracing of PLI1 modules.
* *

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: delay.c,v 1.2 2003/05/28 02:42:43 steve Exp $" #ident "$Id: delay.c,v 1.3 2003/06/17 16:55:07 steve Exp $"
#endif #endif
#include <veriuser.h> #include <veriuser.h>
@ -44,7 +44,6 @@ int tf_isetdelay(PLI_INT32 delay, void*ss)
fprintf(pli_trace, "%s: tf_isetdelay(%d, ...)" fprintf(pli_trace, "%s: tf_isetdelay(%d, ...)"
" <unit=%d, prec=%d>;\n", " <unit=%d, prec=%d>;\n",
vpi_get_str(vpiName, sys), delay, unit, prec); vpi_get_str(vpiName, sys), delay, unit, prec);
fflush(pli_trace);
} }
@ -82,6 +81,12 @@ int tf_setdelay(PLI_INT32 delay)
/* /*
* $Log: delay.c,v $ * $Log: delay.c,v $
* Revision 1.3 2003/06/17 16:55:07 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.2 2003/05/28 02:42:43 steve * Revision 1.2 2003/05/28 02:42:43 steve
* compiler warnings. * compiler warnings.
* *

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: getp.c,v 1.5 2003/05/30 04:22:13 steve Exp $" #ident "$Id: getp.c,v 1.6 2003/06/17 16:55:07 steve Exp $"
#endif #endif
# include <assert.h> # include <assert.h>
@ -66,7 +66,6 @@ out:
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "tf_igetp(n=%d, obj=%p) --> %d\n", fprintf(pli_trace, "tf_igetp(n=%d, obj=%p) --> %d\n",
n, obj, rtn); n, obj, rtn);
fflush(pli_trace);
} }
return rtn; return rtn;
@ -114,7 +113,6 @@ out:
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "tf_igetrealp(n=%d, obj=%p) --> %f\n", fprintf(pli_trace, "tf_igetrealp(n=%d, obj=%p) --> %f\n",
n, obj, rtn); n, obj, rtn);
fflush(pli_trace);
} }
return rtn; return rtn;
@ -172,7 +170,6 @@ out:
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "tf_istrgetp(n=%d, fmt=%c, obj=%p) --> \"%s\"\n", fprintf(pli_trace, "tf_istrgetp(n=%d, fmt=%c, obj=%p) --> \"%s\"\n",
n, fmt, obj, rtn); n, fmt, obj, rtn);
fflush(pli_trace);
} }
return rtn; return rtn;
@ -187,6 +184,12 @@ char *tf_strgetp(PLI_INT32 n, PLI_INT32 fmt)
/* /*
* $Log: getp.c,v $ * $Log: getp.c,v $
* Revision 1.6 2003/06/17 16:55:07 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.5 2003/05/30 04:22:13 steve * Revision 1.5 2003/05/30 04:22:13 steve
* Add tf_strgetp functions. * Add tf_strgetp 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: putp.c,v 1.4 2003/05/29 03:46:21 steve Exp $" #ident "$Id: putp.c,v 1.5 2003/06/17 16:55:08 steve Exp $"
#endif #endif
# include <assert.h> # include <assert.h>
@ -64,7 +64,6 @@ out:
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "tf_iputp(n=%d, value=%d, obj=%p) --> %d\n", fprintf(pli_trace, "tf_iputp(n=%d, value=%d, obj=%p) --> %d\n",
n, value, obj, rtn); n, value, obj, rtn);
fflush(pli_trace);
} }
return rtn; return rtn;
@ -114,7 +113,6 @@ out:
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "tf_iputrealp(n=%d, value=%f, obj=%p) --> %d\n", fprintf(pli_trace, "tf_iputrealp(n=%d, value=%f, obj=%p) --> %d\n",
n, value, obj, rtn); n, value, obj, rtn);
fflush(pli_trace);
} }
return rtn; return rtn;
@ -128,6 +126,12 @@ PLI_INT32 tf_putrealp(PLI_INT32 n, double value)
} }
/* /*
* $Log: putp.c,v $ * $Log: putp.c,v $
* Revision 1.5 2003/06/17 16:55:08 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.4 2003/05/29 03:46:21 steve * Revision 1.4 2003/05/29 03:46:21 steve
* Add tf_getp/putp support for integers * Add tf_getp/putp support for integers
* and real valued arguments. * and real valued arguments.

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: spname.c,v 1.3 2003/05/29 03:46:21 steve Exp $" #ident "$Id: spname.c,v 1.4 2003/06/17 16:55:08 steve Exp $"
#endif #endif
#include <assert.h> #include <assert.h>
@ -37,7 +37,6 @@ char* tf_spname(void)
if (pli_trace) { if (pli_trace) {
fprintf(pli_trace, "%s: tf_spname() --> %s\n", fprintf(pli_trace, "%s: tf_spname() --> %s\n",
vpi_get_str(vpiName,sys), rtn); vpi_get_str(vpiName,sys), rtn);
fflush(pli_trace);
} }
return rtn; return rtn;
@ -55,6 +54,12 @@ char *tf_mipname(void)
/* /*
* $Log: spname.c,v $ * $Log: spname.c,v $
* Revision 1.4 2003/06/17 16:55:08 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.3 2003/05/29 03:46:21 steve * Revision 1.3 2003/05/29 03:46:21 steve
* Add tf_getp/putp support for integers * Add tf_getp/putp support for integers
* and real valued arguments. * and real valued arguments.

View File

@ -18,7 +18,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: veriusertfs.c,v 1.11 2003/06/04 01:56:20 steve Exp $" #ident "$Id: veriusertfs.c,v 1.12 2003/06/17 16:55:08 steve Exp $"
#endif #endif
/* /*
@ -59,11 +59,15 @@ void veriusertfs_register_table(p_tfcell vtable)
s_vpi_systf_data tf_data; s_vpi_systf_data tf_data;
p_pli_data data; p_pli_data data;
if ((pli_trace == 0) && (path = getenv("PLI_TRACE"))) { if (!pli_trace && (path = getenv("PLI_TRACE"))) {
if (strcmp(path,"-") == 0) if (strcmp(path,"-") == 0)
pli_trace = stdout; pli_trace = stdout;
else { else {
pli_trace = fopen(path, "w"); pli_trace = fopen(path, "w");
if (!pli_trace) {
perror(path);
exit(1);
}
setlinebuf(pli_trace); setlinebuf(pli_trace);
} }
} }
@ -375,6 +379,12 @@ PLI_INT32 tf_setrealdelay(double dly)
} }
/* /*
* $Log: veriusertfs.c,v $ * $Log: veriusertfs.c,v $
* Revision 1.12 2003/06/17 16:55:08 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.11 2003/06/04 01:56:20 steve * Revision 1.11 2003/06/04 01:56:20 steve
* 1) Adds configure logic to clean up compiler warnings * 1) Adds configure logic to clean up compiler warnings
* 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and * 2) adds acc_compare_handle, acc_fetch_range, acc_next_scope and

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: sys_display.c,v 1.61 2003/05/23 04:04:02 steve Exp $" #ident "$Id: sys_display.c,v 1.62 2003/06/17 16:55:08 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -383,8 +383,6 @@ static int format_str_char(vpiHandle scope, unsigned int mcd,
use_count = 0; use_count = 0;
break; break;
case 'e':
case 'g':
// new Verilog 2001 format specifiers... // new Verilog 2001 format specifiers...
case 'l': case 'l':
case 'L': case 'L':
@ -533,6 +531,26 @@ static int format_str_char(vpiHandle scope, unsigned int mcd,
use_count = 1; use_count = 1;
break; break;
case 'e':
case 'E':
if (idx >= argc) {
format_error_msg("Missing Argument", leading_zero,
fsize, ffsize, fmt);
return 0;
}
value.format = vpiRealVal;
vpi_get_value(argv[idx], &value);
if (value.format == vpiSuppressVal){
format_error_msg("Incompatible value", leading_zero,
fsize, ffsize, fmt);
return 1;
}
my_mcd_printf(mcd, "%*.*g", fsize, ffsize, value.value.real);
use_count = 1;
break;
case 'f': case 'f':
case 'F': case 'F':
@ -552,6 +570,27 @@ static int format_str_char(vpiHandle scope, unsigned int mcd,
my_mcd_printf(mcd, "%*.*f", fsize, ffsize, value.value.real); my_mcd_printf(mcd, "%*.*f", fsize, ffsize, value.value.real);
use_count = 1;
break;
case 'g':
case 'G':
if (idx >= argc) {
format_error_msg("Missing Argument", leading_zero,
fsize, ffsize, fmt);
return 0;
}
value.format = vpiRealVal;
vpi_get_value(argv[idx], &value);
if (value.format == vpiSuppressVal){
format_error_msg("Incompatible value", leading_zero,
fsize, ffsize, fmt);
return 1;
}
my_mcd_printf(mcd, "%*.*g", fsize, ffsize, value.value.real);
use_count = 1; use_count = 1;
break; break;
@ -1702,6 +1741,12 @@ void sys_display_register()
/* /*
* $Log: sys_display.c,v $ * $Log: sys_display.c,v $
* Revision 1.62 2003/06/17 16:55:08 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.61 2003/05/23 04:04:02 steve * Revision 1.61 2003/05/23 04:04:02 steve
* Add vpi_fopen and vpi_get_file. * Add vpi_fopen and vpi_get_file.
* *

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: vpi_priv.cc,v 1.40 2003/05/30 04:08:28 steve Exp $" #ident "$Id: vpi_priv.cc,v 1.41 2003/06/17 16:55:08 steve Exp $"
#endif #endif
# include "vpi_priv.h" # include "vpi_priv.h"
@ -206,7 +206,6 @@ int vpi_get(int property, vpiHandle ref)
if (vpi_trace) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_get(vpiType, %p) --> %s\n", fprintf(vpi_trace, "vpi_get(vpiType, %p) --> %s\n",
ref, vpi_type_values(ref->vpi_type->type_code)); ref, vpi_type_values(ref->vpi_type->type_code));
fflush(vpi_trace);
} }
struct __vpiSignal*rfp = (struct __vpiSignal*)ref; struct __vpiSignal*rfp = (struct __vpiSignal*)ref;
@ -220,7 +219,6 @@ int vpi_get(int property, vpiHandle ref)
if (vpi_trace) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_get(%s, %p) --X\n", fprintf(vpi_trace, "vpi_get(%s, %p) --X\n",
vpi_property_str(property), ref); vpi_property_str(property), ref);
fflush(vpi_trace);
} }
return vpiUndefined; return vpiUndefined;
@ -231,7 +229,6 @@ int vpi_get(int property, vpiHandle ref)
if (vpi_trace) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_get(%s, %p) --> %d\n", fprintf(vpi_trace, "vpi_get(%s, %p) --> %d\n",
vpi_property_str(property), ref, res); vpi_property_str(property), ref, res);
fflush(vpi_trace);
} }
return res; return res;
@ -250,7 +247,6 @@ char* vpi_get_str(int property, vpiHandle ref)
if (vpi_trace) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_get_str(%s, %p) --X\n", fprintf(vpi_trace, "vpi_get_str(%s, %p) --X\n",
vpi_property_str(property), ref); vpi_property_str(property), ref);
fflush(vpi_trace);
} }
return 0; return 0;
} }
@ -260,7 +256,6 @@ char* vpi_get_str(int property, vpiHandle ref)
if (vpi_trace) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_get_str(%s, %p) --> %s\n", fprintf(vpi_trace, "vpi_get_str(%s, %p) --> %s\n",
vpi_property_str(property), ref, res); vpi_property_str(property), ref, res);
fflush(vpi_trace);
} }
return res; return res;
@ -343,10 +338,16 @@ void vpi_set_vlog_info(int argc, char** argv)
vpi_vlog_info.argv = argv; vpi_vlog_info.argv = argv;
if (const char*path = getenv("VPI_TRACE")) { if (const char*path = getenv("VPI_TRACE")) {
if (strcmp(path,"-") == 0) if (!strcmp(path,"-"))
vpi_trace = stdout; vpi_trace = stdout;
else else {
vpi_trace = fopen(path, "w"); vpi_trace = fopen(path, "w");
if (!vpi_trace) {
perror(path);
exit(1);
}
setlinebuf(vpi_trace);
}
} }
} }
@ -359,27 +360,23 @@ void vpi_get_value(vpiHandle expr, s_vpi_value*vp)
if (vpi_trace) switch (vp->format) { if (vpi_trace) switch (vp->format) {
case vpiStringVal: case vpiStringVal:
fprintf(vpi_trace, "vpi_get_value(%p=<%d>) -> string=\"%s\"\n", fprintf(vpi_trace,"vpi_get_value(%p=<%d>) -> string=\"%s\"\n",
expr, expr->vpi_type->type_code, vp->value.str); expr, expr->vpi_type->type_code, vp->value.str);
fflush(vpi_trace);
break; break;
case vpiBinStrVal: case vpiBinStrVal:
fprintf(vpi_trace, "vpi_get_value(<%d>...) -> binstr=%s\n", fprintf(vpi_trace, "vpi_get_value(<%d>...) -> binstr=%s\n",
expr->vpi_type->type_code, vp->value.str); expr->vpi_type->type_code, vp->value.str);
fflush(vpi_trace);
break; break;
case vpiIntVal: case vpiIntVal:
fprintf(vpi_trace, "vpi_get_value(<%d>...) -> int=%d\n", fprintf(vpi_trace, "vpi_get_value(<%d>...) -> int=%d\n",
expr->vpi_type->type_code, vp->value.integer); expr->vpi_type->type_code, vp->value.integer);
fflush(vpi_trace);
break; break;
default: default:
fprintf(vpi_trace, "vpi_get_value(<%d>...) -> <%d>=?\n", fprintf(vpi_trace, "vpi_get_value(<%d>...) -> <%d>=?\n",
expr->vpi_type->type_code, vp->format); expr->vpi_type->type_code, vp->format);
fflush(vpi_trace);
} }
return; return;
} }
@ -387,7 +384,6 @@ void vpi_get_value(vpiHandle expr, s_vpi_value*vp)
if (vpi_trace) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_get_value(<%d>...) -> <suppress>\n", fprintf(vpi_trace, "vpi_get_value(<%d>...) -> <suppress>\n",
expr->vpi_type->type_code); expr->vpi_type->type_code);
fflush(vpi_trace);
} }
vp->format = vpiSuppressVal; vp->format = vpiSuppressVal;
@ -412,7 +408,6 @@ vpiHandle vpi_handle(int type, vpiHandle ref)
fprintf(vpi_trace, "vpi_handle(vpiSysTfCall, 0) " fprintf(vpi_trace, "vpi_handle(vpiSysTfCall, 0) "
"-> %p (%s)\n", &vpip_cur_task->base, "-> %p (%s)\n", &vpip_cur_task->base,
vpip_cur_task->defn->info.tfname); vpip_cur_task->defn->info.tfname);
fflush(vpi_trace);
} }
return &vpip_cur_task->base; return &vpip_cur_task->base;
@ -425,7 +420,6 @@ vpiHandle vpi_handle(int type, vpiHandle ref)
if (vpi_trace) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_handle(%d, %p) -X\n", fprintf(vpi_trace, "vpi_handle(%d, %p) -X\n",
type, ref); type, ref);
fflush(vpi_trace);
} }
return 0; return 0;
@ -437,7 +431,6 @@ vpiHandle vpi_handle(int type, vpiHandle ref)
if (vpi_trace) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_handle(%d, %p) -> %p\n", fprintf(vpi_trace, "vpi_handle(%d, %p) -> %p\n",
type, ref, res); type, ref, res);
fflush(vpi_trace);
} }
return res; return res;
@ -461,6 +454,8 @@ static vpiHandle vpi_iterate_global(int type)
vpiHandle vpi_iterate(int type, vpiHandle ref) vpiHandle vpi_iterate(int type, vpiHandle ref)
{ {
vpiHandle rtn = 0;
assert(vpi_mode_flag != VPI_MODE_NONE); assert(vpi_mode_flag != VPI_MODE_NONE);
if (vpi_mode_flag == VPI_MODE_REGISTER) { if (vpi_mode_flag == VPI_MODE_REGISTER) {
fprintf(stderr, "vpi error: vpi_iterate called during " fprintf(stderr, "vpi error: vpi_iterate called during "
@ -469,28 +464,16 @@ vpiHandle vpi_iterate(int type, vpiHandle ref)
} }
if (ref == 0) if (ref == 0)
return vpi_iterate_global(type); rtn = vpi_iterate_global(type);
else if (ref->vpi_type->iterate_)
rtn = (ref->vpi_type->iterate_)(type, ref);
if (ref->vpi_type->iterate_) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_iterate(%d, %p) ->%s\n",
if (vpi_trace) { type, ref, rtn ? "" : " (null)");
fprintf(vpi_trace, "vpi_iterate(%d, %p) ->\n",
type, ref);
fflush(vpi_trace);
}
return (ref->vpi_type->iterate_)(type, ref);
} else {
if (vpi_trace) {
fprintf(vpi_trace, "vpi_iterate(%d, %p) -X\n",
type, ref);
fflush(vpi_trace);
}
return 0;
} }
return rtn;
} }
vpiHandle vpi_handle_by_index(vpiHandle ref, int idx) vpiHandle vpi_handle_by_index(vpiHandle ref, int idx)
@ -577,7 +560,6 @@ vpiHandle vpi_handle_by_name(const char *name, vpiHandle scope)
if (vpi_trace) { if (vpi_trace) {
fprintf(vpi_trace, "vpi_handle_by_name(%s, %p) -->\n", fprintf(vpi_trace, "vpi_handle_by_name(%s, %p) -->\n",
name, scope); name, scope);
fflush(vpi_trace);
} }
/* If scope provided, look in corresponding module; otherwise /* If scope provided, look in corresponding module; otherwise
@ -658,6 +640,12 @@ extern "C" void vpi_control(int operation, ...)
/* /*
* $Log: vpi_priv.cc,v $ * $Log: vpi_priv.cc,v $
* Revision 1.41 2003/06/17 16:55:08 steve
* 1) setlinebuf() for vpi_trace
* 2) Addes error checks for trace file opens
* 3) removes now extraneous flushes
* 4) fixes acc_next() bug
*
* Revision 1.40 2003/05/30 04:08:28 steve * Revision 1.40 2003/05/30 04:08:28 steve
* vpi_trace of vpi_free_object. * vpi_trace of vpi_free_object.
* *