Generate verbuse status messages (Stephan Boettcher)

This commit is contained in:
steve 2001-07-03 04:09:24 +00:00
parent a76d6dc352
commit 039769dbaf
5 changed files with 106 additions and 18 deletions

View File

@ -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 <unistd.h>
#include <sys/times.h>
,{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

View File

@ -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.
*

View File

@ -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 <stddef.h>
@ -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.
*

View File

@ -56,20 +56,20 @@
# be useful and interesting if the -N flag is included.
[-tnull -S]
<ivl>%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- -
<ivl>%B/ivl %[v-v] %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- -
[-tnull]
<ivl>%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/null.tgt -- -
<ivl>%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]
<ivl>%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 -- -
<ivl>%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]
<ivl>%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 -- -
<ivl>%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 <ivl> string to take the preprocessed code from
@ -78,17 +78,17 @@
# on the result.
[-tvvm]
<ivl>%B/ivl %W %[s-s%s] %[N-N%N] %[T-T%T] -tvvm -Fcprop -Fnodangle -fVPI_MODULE_PATH=%B %f %m -o%o.cc -- -
<ivl>%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]
<ivl>%B/ivl %[s-s%s] %[N-N%N] %[T-T%T] -tvvm -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -
<ivl>%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=<type>
# flag to specify the part type.
[-tpal]
<ivl>%B/ivl %[s-s%s] %[N-N%N] %[T-T%T] -tdll -fDLL=%B/pal.tgt -Fsynth -Fsyn-rules -Fcprop -Fnodangle -o%o -- -
<ivl>%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 -- -

85
main.cc
View File

@ -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 <map>
# include <unistd.h>
# include <stdlib.h>
#if defined(HAVE_TIMES)
# include <sys/times.h>
#endif
#if defined(HAVE_GETOPT_H)
# include <getopt.h>
#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> 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, "
<<cycles_diff(cycles+1, cycles+0)<<" seconds."<<endl;
}
cout << "ELABORATING DESIGN -s "<<start_module<<" ..." << endl;
}
/* On with the process of elaborating the module. */
@ -327,12 +374,19 @@ int main(int argc, char*argv[])
if (verbose_flag) {
cout << "RUNNING FUNCTORS..." << endl;
if (times_flag) {
times(cycles+2);
cerr<<" ... done, "
<<cycles_diff(cycles+2, cycles+1)<<" seconds."<<endl;
}
cout << "RUNNING FUNCTORS ..." << endl;
}
while (!net_func_queue.empty()) {
net_func func = net_func_queue.front();
net_func_queue.pop();
if (verbose_flag)
cerr<<" -F "<<net_func_to_name(func)<<endl;
func(des);
}
@ -343,7 +397,12 @@ int main(int argc, char*argv[])
if (verbose_flag) {
cout << "STARTING CODE GENERATOR..." << endl;
if (times_flag) {
times(cycles+3);
cerr<<" ... done, "
<<cycles_diff(cycles+3, cycles+2)<<" seconds."<<endl;
}
cout << "CODE GENERATION -t "<<target<<" ..." << endl;
}
bool emit_rc = emit(des, target);
@ -353,7 +412,12 @@ int main(int argc, char*argv[])
}
if (verbose_flag) {
cout << "DONE." << endl;
if (times_flag) {
times(cycles+4);
cerr<<" ... done, "
<<cycles_diff(cycles+4, cycles+3)<<" seconds."<<endl;
} else
cout << "DONE." << endl;
}
return 0;
@ -361,6 +425,9 @@ int main(int argc, char*argv[])
/*
* $Log: main.cc,v $
* Revision 1.44 2001/07/03 04:09:24 steve
* Generate verbuse status messages (Stephan Boettcher)
*
* Revision 1.43 2001/07/02 01:57:27 steve
* Add the -V flag, and some verbose messages.
*