From e549a2c5c342ba6566ca5235d14422d5e5474848 Mon Sep 17 00:00:00 2001 From: steve Date: Sat, 1 Feb 2003 05:49:13 +0000 Subject: [PATCH] Display $time and $realtime specially. --- vpi/sys_display.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/vpi/sys_display.c b/vpi/sys_display.c index c7229e7b0..75e611a07 100644 --- a/vpi/sys_display.c +++ b/vpi/sys_display.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: sys_display.c,v 1.49 2003/01/26 18:18:36 steve Exp $" +#ident "$Id: sys_display.c,v 1.50 2003/02/01 05:49:13 steve Exp $" #endif # include "config.h" @@ -780,6 +780,31 @@ static void do_display(unsigned int mcd, struct strobe_cb_info*info) vpi_mcd_printf(mcd, "%f", value.value.real); break; + case vpiSysFuncCall: { + char*tmp = vpi_get_str(vpiName, item); + vpiHandle scope = vpi_handle(vpiScope, item); + + if (strcmp(tmp,"$time") == 0) { + value.format = vpiTimeVal; + vpi_get_value(item, &value); + vpi_mcd_printf(mcd, "%20u", value.value.time->low); + } else if (strcmp(tmp,"$realtime") == 0) { + int time_units = vpi_get(vpiTimeUnit, scope); + int time_prec = vpi_get(vpiTimePrecision, 0); + int use_prec = time_units - time_prec; + if (use_prec < 0) + use_prec = 0; + + value.format = vpiRealVal; + vpi_get_value(item, &value); + vpi_mcd_printf(mcd, "%0.*f", use_prec, + value.value.real); + } else { + vpi_mcd_printf(mcd, "<%s>", tmp); + } + break; + } + default: vpi_mcd_printf(mcd, "?"); break; @@ -1574,6 +1599,9 @@ void sys_display_register() /* * $Log: sys_display.c,v $ + * Revision 1.50 2003/02/01 05:49:13 steve + * Display $time and $realtime specially. + * * Revision 1.49 2003/01/26 18:18:36 steve * Support display of real values and constants. *