diff --git a/vvp/Makefile.in b/vvp/Makefile.in index f4ff819d5..a0d0262ab 100644 --- a/vvp/Makefile.in +++ b/vvp/Makefile.in @@ -16,7 +16,7 @@ # 59 Temple Place - Suite 330 # Boston, MA 02111-1307, USA # -#ident "$Id: Makefile.in,v 1.38 2002/05/18 02:34:11 steve Exp $" +#ident "$Id: Makefile.in,v 1.39 2002/07/05 02:50:57 steve Exp $" # # SHELL = /bin/sh @@ -67,7 +67,8 @@ vpi_vthr_vector.o vpip_bin.o vpip_hex.o vpip_oct.o vpip_to_dec.o vvp_vpi.o O = main.o parse.o parse_misc.o lexor.o arith.o bufif.o compile.o debug.o \ functor.o fvectors.o npmos.o resolv.o symbols.o ufunc.o codes.o vthread.o \ -schedule.o tables.o udp.o memory.o force.o event.o logic.o delay.o $V +schedule.o statistics.o tables.o udp.o memory.o force.o event.o \ +logic.o delay.o $V vvp: $O $(CXX) $(rdynamic) $(CXXFLAGS) $(LDFLAGS) -o vvp $O $(LIBS) $(dllib) diff --git a/vvp/codes.cc b/vvp/codes.cc index abe0527ca..21f3fd1ba 100644 --- a/vvp/codes.cc +++ b/vvp/codes.cc @@ -17,10 +17,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: codes.cc,v 1.9 2002/03/01 05:43:59 steve Exp $" +#ident "$Id: codes.cc,v 1.10 2002/07/05 02:50:58 steve Exp $" #endif # include "codes.h" +# include "statistics.h" # include # include @@ -81,6 +82,7 @@ vvp_cpoint_t codespace_allocate(void) vvp_cpoint_t res = code_count; code_count += 1; + count_opcodes += 1; return res; } @@ -89,6 +91,11 @@ vvp_cpoint_t codespace_next(void) return code_count; } +unsigned code_limit(void) +{ + return code_count; +} + vvp_code_t codespace_index(vvp_cpoint_t point) { assert(point < code_count); @@ -105,6 +112,9 @@ vvp_code_t codespace_index(vvp_cpoint_t point) /* * $Log: codes.cc,v $ + * Revision 1.10 2002/07/05 02:50:58 steve + * Remove the vpi object symbol table after compile. + * * Revision 1.9 2002/03/01 05:43:59 steve * Initialize all the codes tables. * diff --git a/vvp/codes.h b/vvp/codes.h index 24f49fc89..27b320eb6 100644 --- a/vvp/codes.h +++ b/vvp/codes.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: codes.h,v 1.44 2002/06/02 18:55:58 steve Exp $" +#ident "$Id: codes.h,v 1.45 2002/07/05 02:50:58 steve Exp $" #endif @@ -130,10 +130,6 @@ struct vvp_code_s { */ extern void codespace_init(void); -/* -** Return the number of codes -*/ -extern unsigned code_limit(); /* * This function returns a pointer to the next free instruction in the @@ -156,6 +152,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr); /* * $Log: codes.h,v $ + * Revision 1.45 2002/07/05 02:50:58 steve + * Remove the vpi object symbol table after compile. + * * Revision 1.44 2002/06/02 18:55:58 steve * Add %cmpi/u instruction. * diff --git a/vvp/compile.cc b/vvp/compile.cc index 7234271d5..faa5f10e7 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: compile.cc,v 1.131 2002/06/21 04:58:55 steve Exp $" +#ident "$Id: compile.cc,v 1.132 2002/07/05 02:50:58 steve Exp $" #endif # include "arith.h" @@ -490,6 +490,9 @@ void compile_cleanup(void) } while (nerrs && !last); compile_errors += nerrs; + + delete_symbol_table(sym_vpi); + sym_vpi = 0; } void compile_vpi_symbol(const char*label, vpiHandle obj) @@ -1417,6 +1420,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name) /* * $Log: compile.cc,v $ + * Revision 1.132 2002/07/05 02:50:58 steve + * Remove the vpi object symbol table after compile. + * * Revision 1.131 2002/06/21 04:58:55 steve * Add support for special integer vectors. * diff --git a/vvp/functor.cc b/vvp/functor.cc index 9496413e5..6dd17e5cb 100644 --- a/vvp/functor.cc +++ b/vvp/functor.cc @@ -17,10 +17,11 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: functor.cc,v 1.38 2002/01/06 17:50:50 steve Exp $" +#ident "$Id: functor.cc,v 1.39 2002/07/05 02:50:58 steve Exp $" #endif # include "functor.h" +# include "statistics.h" # include "debug.h" # include # include @@ -75,6 +76,7 @@ vvp_ipoint_t functor_allocate(unsigned wid) { vvp_ipoint_t idx = functor_count*4; functor_count += wid; + count_functors += wid; if (functor_count > functor_chunk_count*functor_chunk_size) { @@ -201,6 +203,9 @@ void functor_s::debug_print(vvp_ipoint_t fnc) /* * $Log: functor.cc,v $ + * Revision 1.39 2002/07/05 02:50:58 steve + * Remove the vpi object symbol table after compile. + * * Revision 1.38 2002/01/06 17:50:50 steve * Support scope for functors. (Stephan Boettcher) * diff --git a/vvp/main.cc b/vvp/main.cc index ab3b70f63..3f351a3ec 100644 --- a/vvp/main.cc +++ b/vvp/main.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: main.cc,v 1.24 2002/04/12 02:44:02 steve Exp $" +#ident "$Id: main.cc,v 1.25 2002/07/05 02:50:58 steve Exp $" #endif # include "config.h" @@ -26,6 +26,7 @@ # include "compile.h" # include "schedule.h" # include "vpi_priv.h" +# include "statistics.h" # include # include # include @@ -236,6 +237,12 @@ int main(int argc, char*argv[]) return compile_errors; } + if (verbose_flag) { + fprintf(stderr, " ... %8lu functors\n", count_functors); + fprintf(stderr, " ... %8lu opcodes\n", count_opcodes); + fprintf(stderr, " ... %8lu nets\n", count_vpi_nets); + } + if (verbose_flag) { my_getrusage(cycles+1); print_rusage(stderr, cycles+1, cycles+0); @@ -265,6 +272,9 @@ int main(int argc, char*argv[]) /* * $Log: main.cc,v $ + * Revision 1.25 2002/07/05 02:50:58 steve + * Remove the vpi object symbol table after compile. + * * Revision 1.24 2002/04/12 02:44:02 steve * Formally define extended arguments to vvp. * @@ -276,76 +286,5 @@ int main(int argc, char*argv[]) * * Revision 1.21 2001/10/20 01:03:42 steve * Print memory usage information if requested (Stephan Boettcher) - * - * Revision 1.20 2001/07/30 02:44:05 steve - * Cleanup defines and types for mingw compile. - * - * Revision 1.19 2001/07/26 03:13:51 steve - * Make the -M flag add module search paths. - * - * Revision 1.18 2001/07/21 21:18:55 steve - * Add the -h flag for help. (Stephan Boettcher) - * - * Revision 1.17 2001/07/16 18:40:19 steve - * Add a stdlog output for vvp, and vvp options - * to direct them around. (Stephan Boettcher.) - * - * Revision 1.16 2001/06/23 18:26:26 steve - * Add the %shiftl/i0 instruction. - * - * Revision 1.15 2001/06/12 03:53:11 steve - * Change the VPI call process so that loaded .vpi modules - * use a function table instead of implicit binding. - * - * Revision 1.14 2001/05/20 17:34:53 steve - * declare getopt by hand in mingw32 compile. - * - * Revision 1.13 2001/05/12 20:38:06 steve - * A resolver that understands some simple strengths. - * - * Revision 1.12 2001/05/11 03:26:31 steve - * No entry breakpoint if debug is compiled out. - * - * Revision 1.11 2001/05/11 02:06:14 steve - * Add the --enable-vvp-debug option to the configure - * script of vvp, and detect getopt.h. - * - * Revision 1.10 2001/05/09 04:23:19 steve - * Now that the interactive debugger exists, - * there is no use for the output dump. - * - * Revision 1.9 2001/05/08 23:32:26 steve - * Add to the debugger the ability to view and - * break on functors. - * - * Add strengths to functors at compile time, - * and Make functors pass their strengths as they - * propagate their output. - * - * Revision 1.8 2001/04/04 04:33:08 steve - * Take vector form as parameters to vpi_call. - * - * Revision 1.7 2001/03/23 02:40:22 steve - * Add the :module header statement. - * - * Revision 1.6 2001/03/22 22:38:14 steve - * Detect undefined system tasks at compile time. - * - * Revision 1.5 2001/03/22 21:26:54 steve - * Compile in a default VPI module dir. - * - * Revision 1.4 2001/03/20 06:16:24 steve - * Add support for variable vectors. - * - * Revision 1.3 2001/03/18 04:35:18 steve - * Add support for string constants to VPI. - * - * Revision 1.2 2001/03/16 01:44:34 steve - * Add structures for VPI support, and all the %vpi_call - * instruction. Get linking of VPI modules to work. - * - * Revision 1.1 2001/03/11 00:29:38 steve - * Add the vvp engine to cvs. - * */ diff --git a/vvp/statistics.cc b/vvp/statistics.cc new file mode 100644 index 000000000..53ba85456 --- /dev/null +++ b/vvp/statistics.cc @@ -0,0 +1,38 @@ +/* + * 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 + */ +#if !defined(WINNT) +#ident "$Id: statistics.cc,v 1.1 2002/07/05 02:50:58 steve Exp $" +#endif + +/* + * This is a count of the instruction opcodes that were created. + */ +unsigned long count_opcodes = 0; + +unsigned long count_functors = 0; + +unsigned long count_vpi_nets = 0; + +/* + * $Log: statistics.cc,v $ + * Revision 1.1 2002/07/05 02:50:58 steve + * Remove the vpi object symbol table after compile. + * + */ + diff --git a/vvp/statistics.h b/vvp/statistics.h new file mode 100644 index 000000000..3dd5cde58 --- /dev/null +++ b/vvp/statistics.h @@ -0,0 +1,35 @@ +#ifndef __statistics_H +#define __statistics_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 + */ +#if !defined(WINNT) +#ident "$Id: statistics.h,v 1.1 2002/07/05 02:50:58 steve Exp $" +#endif + + +extern unsigned long count_opcodes; +extern unsigned long count_functors; +extern unsigned long count_vpi_nets; +/* + * $Log: statistics.h,v $ + * Revision 1.1 2002/07/05 02:50:58 steve + * Remove the vpi object symbol table after compile. + * + */ +#endif diff --git a/vvp/symbols.cc b/vvp/symbols.cc index 6aee966a2..dff576552 100644 --- a/vvp/symbols.cc +++ b/vvp/symbols.cc @@ -17,11 +17,15 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: symbols.cc,v 1.5 2002/05/29 05:37:35 steve Exp $" +#ident "$Id: symbols.cc,v 1.6 2002/07/05 02:50:58 steve Exp $" #endif # include "symbols.h" # include +# include +#ifdef HAVE_MALLOC_H +# include +#endif # include struct symbol_table_s { @@ -83,6 +87,28 @@ symbol_table_t new_symbol_table(void) return tbl; } +static void delete_symbol_node(struct tree_node_*cur) +{ + if (cur->leaf_flag) { + for (unsigned idx = 0 ; idx < cur->count ; idx += 1) + free(cur->leaf[idx].key); + + delete cur; + + } else { + for (unsigned idx = 0 ; idx < cur->count ; idx += 1) + delete cur->child[idx]; + + delete cur; + } +} + +void delete_symbol_table(symbol_table_t tab) +{ + delete_symbol_node(tab->root); + delete tab; +} + /* Do as split_leaf_ do, but for nodes. */ static void split_node_(struct tree_node_*cur) { @@ -360,6 +386,9 @@ symbol_value_t sym_get_value(symbol_table_t tbl, const char*key) /* * $Log: symbols.cc,v $ + * Revision 1.6 2002/07/05 02:50:58 steve + * Remove the vpi object symbol table after compile. + * * Revision 1.5 2002/05/29 05:37:35 steve * Use binary search to speed up deep lookups. * diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 412b791dc..fe9ef8211 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_signal.cc,v 1.39 2002/07/03 23:39:57 steve Exp $" +#ident "$Id: vpi_signal.cc,v 1.40 2002/07/05 02:50:58 steve Exp $" #endif /* @@ -27,6 +27,7 @@ # include "vpi_priv.h" # include "functor.h" +# include "statistics.h" # include #ifdef HAVE_MALLOC_H # include @@ -667,12 +668,17 @@ vpiHandle vpip_make_net(char*name, int msb, int lsb, bool signed_flag, obj->scope = vpip_peek_current_scope(); + count_vpi_nets += 1; + return &obj->base; } /* * $Log: vpi_signal.cc,v $ + * Revision 1.40 2002/07/05 02:50:58 steve + * Remove the vpi object symbol table after compile. + * * Revision 1.39 2002/07/03 23:39:57 steve * Dynamic size result buffer for _str and _get_value functions. *