From 039769dbafe354da8aa6fd27de8fd5b8e0269cac Mon Sep 17 00:00:00 2001 From: steve Date: Tue, 3 Jul 2001 04:09:24 +0000 Subject: [PATCH] Generate verbuse status messages (Stephan Boettcher) --- configure.in | 11 ++++++ driver/build_string.c | 6 ++- driver/globals.h | 8 +++- iverilog.conf | 14 +++---- main.cc | 85 ++++++++++++++++++++++++++++++++++++++----- 5 files changed, 106 insertions(+), 18 deletions(-) diff --git a/configure.in b/configure.in index a7c261f17..f146cac19 100644 --- a/configure.in +++ b/configure.in @@ -17,6 +17,17 @@ AC_LANG_CPLUSPLUS AC_CHECK_HEADERS(getopt.h iosfwd sys/wait.h) +AC_MSG_CHECKING(for sys/times) +AC_TRY_LINK( +#include +#include +,{clock_t a = times(0)/sysconf(_SC_CLK_TCK);}, +do_times=yes +AC_DEFINE(HAVE_TIMES,1), +do_times=no +) +AC_MSG_RESULT($do_times) + AC_CHECK_HEADER(ipal.h, HAVE_IPAL=yes, HAVE_IPAL=) AC_ARG_WITH(ipal,enable PAL target, if test "$with_ipal" = no; then diff --git a/driver/build_string.c b/driver/build_string.c index f3df6849e..e8d7d1496 100644 --- a/driver/build_string.c +++ b/driver/build_string.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: build_string.c,v 1.2 2000/10/28 03:45:47 steve Exp $" +#ident "$Id: build_string.c,v 1.3 2001/07/03 04:09:25 steve Exp $" #endif # include "globals.h" @@ -51,6 +51,7 @@ int build_string(char*output, size_t olen, const char*pattern) tmp_buf[tail-pattern-1] = 0; if (((*pattern == 's') && start) + || ((*pattern == 'v') && verbose_flag) || ((*pattern == 'N') && npath) || ((*pattern == 'T') && mtm)) { int rc = build_string(output, olen, @@ -141,6 +142,9 @@ int build_string(char*output, size_t olen, const char*pattern) /* * $Log: build_string.c,v $ + * Revision 1.3 2001/07/03 04:09:25 steve + * Generate verbuse status messages (Stephan Boettcher) + * * Revision 1.2 2000/10/28 03:45:47 steve * Use the conf file to generate the vvm ivl string. * diff --git a/driver/globals.h b/driver/globals.h index ed0afb6fd..a09b0b135 100644 --- a/driver/globals.h +++ b/driver/globals.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: globals.h,v 1.3 2000/11/09 21:58:00 steve Exp $" +#ident "$Id: globals.h,v 1.4 2001/07/03 04:09:25 steve Exp $" #endif # include @@ -51,6 +51,9 @@ extern int synth_flag; /* This is the name of the selected target. */ extern const char*targ; + /* -v */ +extern int verbose_flag; + extern char warning_flags[]; extern const char*lookup_pattern(const char*key); @@ -59,6 +62,9 @@ extern int build_string(char*out, size_t olen, const char*pattern); /* * $Log: globals.h,v $ + * Revision 1.4 2001/07/03 04:09:25 steve + * Generate verbuse status messages (Stephan Boettcher) + * * Revision 1.3 2000/11/09 21:58:00 steve * Remember to include the -S condition. * diff --git a/iverilog.conf b/iverilog.conf index c90ab9b48..06c05c1ef 100644 --- a/iverilog.conf +++ b/iverilog.conf @@ -56,20 +56,20 @@ # be useful and interesting if the -N flag is included. [-tnull -S] -%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- - +%B/ivl %[v-v] %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- - [-tnull] -%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- - +%B/ivl %[v-v] %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- - # -- # The vvp target generates code that the vvp simulation engine can execute. # These rules support synthesized and non-synthesized variants. [-tvvp -S] -%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fsynth -Fsyn-rules -Fcprop -Fnodangle %f %m -o%o -- - +%B/ivl %[v-v] %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fsynth -Fsyn-rules -Fcprop -Fnodangle %f %m -o%o -- - [-tvvp] -%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fcprop -Fnodangle %f %m -o%o -- - +%B/ivl %[v-v] %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/vvp.tgt -fVVP_EXECUTABLE=%B/../../bin/vvp -Fcprop -Fnodangle %f %m -o%o -- - # -- # The vvm target uses the string to take the preprocessed code from @@ -78,17 +78,17 @@ # on the result. [-tvvm] -%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B %f %m -o%o.cc -- - +%B/ivl %[v-v] %W %[s-s%s] %[N-N%N] %[T-T%T] -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B %f %m -o%o.cc -- - # -- (not supported yet) # This is the XNF code generator. [-txnf] -%B/ivl %[s-s%s] %[N-N%N] %[T-T%T] -tvvm -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- - +%B/ivl %[v-v] %[s-s%s] %[N-N%N] %[T-T%T] -tvvm -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- - # -- # This is the pal code generator. The target module requires the -fpart= # flag to specify the part type. [-tpal] -%B/ivl %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/pal.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- - +%B/ivl %[v-v] %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/pal.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- - diff --git a/main.cc b/main.cc index a436e44de..bd49bc17c 100644 --- a/main.cc +++ b/main.cc @@ -19,7 +19,7 @@ const char COPYRIGHT[] = * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: main.cc,v 1.43 2001/07/02 01:57:27 steve Exp $" +#ident "$Id: main.cc,v 1.44 2001/07/03 04:09:24 steve Exp $" #endif const char NOTICE[] = @@ -45,6 +45,9 @@ const char NOTICE[] = # include # include # include +#if defined(HAVE_TIMES) +# include +#endif #if defined(HAVE_GETOPT_H) # include #endif @@ -121,11 +124,43 @@ net_func name_to_net_func(const string&name) return 0; } +const char *net_func_to_name(const net_func func) +{ + for (unsigned idx = 0 ; func_table[idx].name ; idx += 1) + if (func == func_table[idx].func) + return func_table[idx].name; + + return "This cannot happen"; +} + +#if defined(HAVE_TIMES) +static double cycles_diff(struct tms *a, struct tms *b) +{ + clock_t aa = a->tms_utime + + a->tms_stime + + a->tms_cutime + + a->tms_cstime; + + clock_t bb = b->tms_utime + + b->tms_stime + + b->tms_cutime + + b->tms_cstime; + + return (aa-bb)/(double)sysconf(_SC_CLK_TCK); +} +#else // ! defined(HAVE_TIMES) +// Provide dummies +struct tms { int x; }; +inline static void times(struct tms *) { } +inline static double cycles_diff(struct tms *a, struct tms *b) { return 0; } +#endif // ! defined(HAVE_TIMES) int main(int argc, char*argv[]) { bool help_flag = false; bool verbose_flag = false; + bool times_flag = false; + const char* net_path = 0; const char* pf_path = 0; const char* warn_en = ""; @@ -133,6 +168,8 @@ int main(int argc, char*argv[]) unsigned flag_errors = 0; queue net_func_queue; + struct tms cycles[5]; + flags["VPI_MODULE_LIST"] = "system"; flags["-o"] = "a.out"; min_typ_max_flag = TYP; @@ -193,10 +230,13 @@ int main(int argc, char*argv[]) case 't': target = optarg; break; - case 'V': - verbose_flag = true; - break; case 'v': + verbose_flag = true; +# if defined(HAVE_TIMES) + times_flag = true; +# endif + break; + case 'V': cout << "Icarus Verilog version " << VERSION << endl; cout << COPYRIGHT << endl; cout << endl << NOTICE << endl; @@ -237,7 +277,9 @@ int main(int argc, char*argv[]) } if (verbose_flag) { - cout << "PARSING INPUT..." << endl; + if (times_flag) + times(cycles+0); + cout << "PARSING INPUT ..." << endl; } /* Parse the input. Make the pform. */ @@ -306,7 +348,12 @@ int main(int argc, char*argv[]) if (verbose_flag) { - cout << "ELABORATING DESIGN..." << endl; + if (times_flag) { + times(cycles+1); + cerr<<" ... done, " + <