Add a stdlog output for vvp, and vvp options

to direct them around. (Stephan Boettcher.)
This commit is contained in:
steve
2001-07-16 18:40:19 +00:00
parent 64837efac5
commit ae209a144f
5 changed files with 104 additions and 11 deletions
+7 -3
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: sys_display.c,v 1.26 2001/07/11 02:22:17 steve Exp $" #ident "$Id: sys_display.c,v 1.27 2001/07/16 18:40:19 steve Exp $"
#endif #endif
# include "vpi_user.h" # include "vpi_user.h"
@@ -246,12 +246,12 @@ static int sys_display_calltf(char *name)
info.scope = scope; info.scope = scope;
array_from_iterator(&info, argv); array_from_iterator(&info, argv);
do_display(1, &info); do_display(5, &info);
free(info.items); free(info.items);
if (strcmp(name,"$display") == 0) if (strcmp(name,"$display") == 0)
vpi_printf("\n"); vpi_mcd_printf(5, "\n");
return 0; return 0;
} }
@@ -726,6 +726,10 @@ void sys_display_register()
/* /*
* $Log: sys_display.c,v $ * $Log: sys_display.c,v $
* Revision 1.27 2001/07/16 18:40:19 steve
* Add a stdlog output for vvp, and vvp options
* to direct them around. (Stephan Boettcher.)
*
* Revision 1.26 2001/07/11 02:22:17 steve * Revision 1.26 2001/07/11 02:22:17 steve
* Manually create the stage-2 callback structure. * Manually create the stage-2 callback structure.
* *
+7 -1
View File
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: config.h.in,v 1.5 2001/05/11 02:06:14 steve Exp $" #ident "$Id: config.h.in,v 1.6 2001/07/16 18:40:19 steve Exp $"
#endif #endif
# define SIZEOF_UNSIGNED_LONG 0 # define SIZEOF_UNSIGNED_LONG 0
@@ -43,8 +43,14 @@
# define WITH_DEBUG 1 # define WITH_DEBUG 1
#endif #endif
# undef HAVE_TIMES
/* /*
* $Log: config.h.in,v $ * $Log: config.h.in,v $
* Revision 1.6 2001/07/16 18:40:19 steve
* Add a stdlog output for vvp, and vvp options
* to direct them around. (Stephan Boettcher.)
*
* Revision 1.5 2001/05/11 02:06:14 steve * Revision 1.5 2001/05/11 02:06:14 steve
* Add the --enable-vvp-debug option to the configure * Add the --enable-vvp-debug option to the configure
* script of vvp, and detect getopt.h. * script of vvp, and detect getopt.h.
+12
View File
@@ -42,6 +42,18 @@ fi
AC_SUBST(DLLIB) AC_SUBST(DLLIB)
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)
# The -rdynamic flag is used by iverilog when compiling the target, # The -rdynamic flag is used by iverilog when compiling the target,
# to know how to export symbols of the main program to loadable modules # to know how to export symbols of the main program to loadable modules
# that are brought in by -ldl. VPI support requires this. # that are brought in by -ldl. VPI support requires this.
+75 -4
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: main.cc,v 1.16 2001/06/23 18:26:26 steve Exp $" #ident "$Id: main.cc,v 1.17 2001/07/16 18:40:19 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@@ -28,6 +28,11 @@
# include "vpi_priv.h" # include "vpi_priv.h"
# include <stdio.h> # include <stdio.h>
# include <stdlib.h> # include <stdlib.h>
# include <string.h>
#if defined(HAVE_TIMES)
# include <unistd.h>
# include <sys/times.h>
#endif
#if defined(HAVE_GETOPT_H) #if defined(HAVE_GETOPT_H)
# include <getopt.h> # include <getopt.h>
#endif #endif
@@ -38,12 +43,34 @@ extern "C" int optind;
extern "C" const char*optarg; extern "C" const char*optarg;
#endif #endif
#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)
const char*module_path = MODULE_DIR; const char*module_path = MODULE_DIR;
unsigned module_cnt = 0; unsigned module_cnt = 0;
const char*module_tab[64]; const char*module_tab[64];
extern void vpi_mcd_init(void); extern void vpi_mcd_init(FILE *log);
extern void vvp_vpi_init(void); extern void vvp_vpi_init(void);
int main(int argc, char*argv[]) int main(int argc, char*argv[])
@@ -52,17 +79,27 @@ int main(int argc, char*argv[])
unsigned flag_errors = 0; unsigned flag_errors = 0;
const char*design_path = 0; const char*design_path = 0;
bool debug_flag = false; bool debug_flag = false;
bool verbose_flag = false;
struct tms cycles[3];
char *logfile_name = 0x0;
FILE *logfile = 0x0;
while ((opt = getopt(argc, argv, "dM:m:")) != EOF) switch (opt) { while ((opt = getopt(argc, argv, "dl:M:m:v")) != EOF) switch (opt) {
case 'd': case 'd':
debug_flag = true; debug_flag = true;
break; break;
case 'l':
logfile_name = optarg;
break;
case 'M': case 'M':
module_path = optarg; module_path = optarg;
break; break;
case 'm': case 'm':
module_tab[module_cnt++] = optarg; module_tab[module_cnt++] = optarg;
break; break;
case 'v':
verbose_flag = true;
break;
default: default:
flag_errors += 1; flag_errors += 1;
} }
@@ -81,8 +118,24 @@ int main(int argc, char*argv[])
anything. It is done early because it is plausible that the anything. It is done early because it is plausible that the
compile might affect it, and it is cheap to do. */ compile might affect it, and it is cheap to do. */
vpi_mcd_init(); if (logfile_name) {
if (!strcmp(logfile_name, "-"))
logfile = stderr;
else
logfile = fopen(logfile_name, "w");
if (!logfile) {
perror(logfile_name);
exit(1);
}
}
if (verbose_flag) {
times(cycles+0);
fprintf(stderr, "Compiling VVP ...\n");
}
vpi_mcd_init(logfile);
vvp_vpi_init(); vvp_vpi_init();
compile_init(); compile_init();
@@ -94,6 +147,14 @@ int main(int argc, char*argv[])
return rc; return rc;
compile_cleanup(); compile_cleanup();
if (verbose_flag) {
times(cycles+1);
fprintf(stderr,
" ... %G seconds\n"
"Running ...\n",
cycles_diff(cycles+1, cycles+0));
}
if (compile_errors > 0) { if (compile_errors > 0) {
fprintf(stderr, "%s: Program not runnable, %u errors.\n", fprintf(stderr, "%s: Program not runnable, %u errors.\n",
design_path, compile_errors); design_path, compile_errors);
@@ -107,11 +168,21 @@ int main(int argc, char*argv[])
schedule_simulate(); schedule_simulate();
if (verbose_flag) {
times(cycles+2);
fprintf(stderr, " ... %G seconds\n",
cycles_diff(cycles+2, cycles+1));
}
return 0; return 0;
} }
/* /*
* $Log: main.cc,v $ * $Log: main.cc,v $
* 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 * Revision 1.16 2001/06/23 18:26:26 steve
* Add the %shiftl/i0 instruction. * Add the %shiftl/i0 instruction.
* *
+3 -3
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) && !defined(macintosh) #if !defined(WINNT) && !defined(macintosh)
#ident "$Id: vpi_mcd.cc,v 1.4 2001/06/12 03:53:11 steve Exp $" #ident "$Id: vpi_mcd.cc,v 1.5 2001/07/16 18:40:19 steve Exp $"
#endif #endif
# include "vpi_priv.h" # include "vpi_priv.h"
@@ -37,13 +37,13 @@ static struct mcd_entry mcd_table[32];
/* Initialize mcd portion of vpi. Must be called before /* Initialize mcd portion of vpi. Must be called before
* any vpi_mcd routines can be used. * any vpi_mcd routines can be used.
*/ */
void vpi_mcd_init(void) void vpi_mcd_init(FILE *log)
{ {
mcd_table[0].fp = stdout; mcd_table[0].fp = stdout;
mcd_table[0].filename = "<stdout>"; mcd_table[0].filename = "<stdout>";
mcd_table[1].fp = stderr; mcd_table[1].fp = stderr;
mcd_table[1].filename = "<stderr>"; mcd_table[1].filename = "<stderr>";
mcd_table[2].fp = stdout; /* TODO: initialize this to log file */ mcd_table[2].fp = log;
mcd_table[2].filename = "<stdlog>"; mcd_table[2].filename = "<stdlog>";
} }