From dd564ab321c31ebe6c8776a4ee71aa9c5db09c24 Mon Sep 17 00:00:00 2001 From: steve Date: Thu, 15 Aug 2002 02:12:20 +0000 Subject: [PATCH] add dumpvars_compiletf to check first argument. --- vpi/sys_lxt.c | 8 +++-- vpi/sys_priv.h | 37 ++++++++++++++++++++ vpi/sys_vcd.c | 94 ++++++++++++++++++++++++++------------------------ 3 files changed, 91 insertions(+), 48 deletions(-) create mode 100644 vpi/sys_priv.h diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index 8920fda0e..24ddecd6a 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -17,10 +17,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: sys_lxt.c,v 1.10 2002/08/12 01:35:04 steve Exp $" +#ident "$Id: sys_lxt.c,v 1.11 2002/08/15 02:12:20 steve Exp $" #endif # include "config.h" +# include "sys_priv.h" # include "lxt_write.h" /* @@ -805,7 +806,7 @@ void sys_lxt_register() tf_data.type = vpiSysTask; tf_data.tfname = "$dumpvars"; tf_data.calltf = sys_dumpvars_calltf; - tf_data.compiletf = 0; + tf_data.compiletf = sys_vcd_dumpvars_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpvars"; vpi_register_systf(&tf_data); @@ -813,6 +814,9 @@ void sys_lxt_register() /* * $Log: sys_lxt.c,v $ + * Revision 1.11 2002/08/15 02:12:20 steve + * add dumpvars_compiletf to check first argument. + * * Revision 1.10 2002/08/12 01:35:04 steve * conditional ident string using autoconfig. * diff --git a/vpi/sys_priv.h b/vpi/sys_priv.h new file mode 100644 index 000000000..7940968d6 --- /dev/null +++ b/vpi/sys_priv.h @@ -0,0 +1,37 @@ +#ifndef __vpi_sys_priv_H +#define __vpi_sys_priv_H +/* + * Copyright (c) 2002 Stephen Williams (steve@icarus.com) + * + * This source code is free software; you can redistribute it + * and/or modify it in source code form under the terms of the GNU + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ +#ifdef HAVE_CVS_IDENT +#ident "$Id: sys_priv.h,v 1.1 2002/08/15 02:12:20 steve Exp $" +#endif + +/* + * This function is used by sys_vcd and sys_lxt as the dumpvars + * compiletf function. + */ +extern int sys_vcd_dumpvars_compiletf(char*name); + +/* + * $Log: sys_priv.h,v $ + * Revision 1.1 2002/08/15 02:12:20 steve + * add dumpvars_compiletf to check first argument. + * + */ +#endif diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index 00ac2eb8d..d401cdb52 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -17,10 +17,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: sys_vcd.c,v 1.36 2002/08/12 01:35:05 steve Exp $" +#ident "$Id: sys_vcd.c,v 1.37 2002/08/15 02:12:20 steve Exp $" #endif # include "config.h" +# include "sys_priv.h" /* * This file contains the implementations of the VCD related @@ -685,6 +686,48 @@ static int draw_scope(vpiHandle item) return depth; } +/* + * This function is also used in sys_lxt to check the arguments of the + * lxt variant of $dumpvars. + */ +int sys_vcd_dumpvars_compiletf(char*name) +{ + vpiHandle sys = vpi_handle(vpiSysTfCall, 0); + vpiHandle argv = vpi_iterate(vpiArgument, sys); + vpiHandle tmp; + + if (argv == 0) + return 0; + + tmp = vpi_scan(argv); + assert(tmp); + + switch (vpi_get(vpiType, tmp)) { + case vpiConstant: + if (vpi_get(vpiConstType, tmp) == vpiStringConst) { + vpi_printf("ERROR: %s argument must be " + "a number constant.\n", name); + vpi_control(vpiFinish, 1); + } + break; + + case vpiNet: + case vpiReg: + case vpiIntegerVar: + case vpiMemoryWord: + break; + + default: + vpi_printf("ERROR: %s argument must be " + "a number constant.\n", name); + vpi_control(vpiFinish, 1); + break; + } + + vpi_free_object(argv); + return 0; +} + static int sys_dumpvars_calltf(char*name) { unsigned depth; @@ -793,7 +836,7 @@ void sys_vcd_register() tf_data.type = vpiSysTask; tf_data.tfname = "$dumpvars"; tf_data.calltf = sys_dumpvars_calltf; - tf_data.compiletf = 0; + tf_data.compiletf = sys_vcd_dumpvars_compiletf; tf_data.sizetf = 0; tf_data.user_data = "$dumpvars"; vpi_register_systf(&tf_data); @@ -801,6 +844,9 @@ void sys_vcd_register() /* * $Log: sys_vcd.c,v $ + * Revision 1.37 2002/08/15 02:12:20 steve + * add dumpvars_compiletf to check first argument. + * * Revision 1.36 2002/08/12 01:35:05 steve * conditional ident string using autoconfig. * @@ -871,49 +917,5 @@ void sys_vcd_register() * * Revision 1.14 2001/01/01 08:10:35 steve * Handle function scopes in dumpvars scn (PR#95) - * - * Revision 1.13 2000/11/01 06:05:44 steve - * VCD scans tasks (PR#35) - * - * Revision 1.12 2000/07/31 03:34:31 steve - * Report error when dumpfile is missing. - * - * Revision 1.11 2000/07/26 04:07:59 steve - * Get VCD timescale from design precision. - * - * Revision 1.10 2000/06/03 02:22:15 steve - * Interpret the depth paramter of dumpvars. - * - * Revision 1.9 2000/04/09 04:18:16 steve - * Catch duplicate $dumpvars of symbols (ajb) - * - * Revision 1.8 2000/04/08 05:28:39 steve - * Revamped VCD id generation and duplicates removal. (ajb) - * - * Revision 1.8 2000/04/06 21:00:00 ajb - * Revamped VCD id generation and duplicates removal. - * - * Revision 1.7 2000/02/23 02:56:56 steve - * Macintosh compilers do not support ident. - * - * Revision 1.6 2000/02/17 06:04:30 steve - * Fix overlap of identifiers when multiple modules used. - * - * Revision 1.5 2000/01/23 23:54:36 steve - * Compile time problems with vpi_user.h - * - * Revision 1.4 2000/01/20 06:04:55 steve - * $dumpall checkpointing in VCD dump. - * - * Revision 1.3 2000/01/13 04:48:50 steve - * Catch some parameter problems. - * - * Revision 1.2 1999/11/28 00:56:08 steve - * Build up the lists in the scope of a module, - * and get $dumpvars to scan the scope for items. - * - * Revision 1.1 1999/11/07 20:33:30 steve - * Add VCD output and related system tasks. - * */