2001-03-11 01:29:38 +01:00
|
|
|
/*
|
2009-01-09 02:59:39 +01:00
|
|
|
* Copyright (c) 2001-2009 Stephen Williams (steve@icarus.com)
|
2001-03-11 01:29:38 +01:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
|
2008-11-20 01:45:17 +01:00
|
|
|
# include "version.h"
|
2001-03-11 01:29:38 +01:00
|
|
|
# include "config.h"
|
|
|
|
|
# include "parse_misc.h"
|
|
|
|
|
# include "compile.h"
|
|
|
|
|
# include "schedule.h"
|
2001-03-16 02:44:34 +01:00
|
|
|
# include "vpi_priv.h"
|
2002-07-05 04:50:57 +02:00
|
|
|
# include "statistics.h"
|
2009-01-24 01:04:44 +01:00
|
|
|
# include "vvp_cleanup.h"
|
2001-03-11 01:29:38 +01:00
|
|
|
# include <stdio.h>
|
2001-06-23 20:26:26 +02:00
|
|
|
# include <stdlib.h>
|
2001-07-16 20:40:19 +02:00
|
|
|
# include <string.h>
|
|
|
|
|
# include <unistd.h>
|
2001-10-20 03:03:42 +02:00
|
|
|
|
|
|
|
|
#if defined(HAVE_SYS_RESOURCE_H)
|
|
|
|
|
# include <sys/time.h>
|
|
|
|
|
# include <sys/resource.h>
|
|
|
|
|
#endif // defined(HAVE_SYS_RESOURCE_H)
|
|
|
|
|
|
2001-05-11 04:06:14 +02:00
|
|
|
#if defined(HAVE_GETOPT_H)
|
2001-03-11 01:29:38 +01:00
|
|
|
# include <getopt.h>
|
2001-05-11 04:06:14 +02:00
|
|
|
#endif
|
2001-03-11 01:29:38 +01:00
|
|
|
|
2001-07-30 04:44:05 +02:00
|
|
|
#if defined(__MINGW32__)
|
|
|
|
|
# include <windows.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-07-12 06:38:56 +02:00
|
|
|
ofstream debug_file;
|
|
|
|
|
|
2001-05-20 19:34:53 +02:00
|
|
|
#if defined(__MINGW32__) && !defined(HAVE_GETOPT_H)
|
|
|
|
|
extern "C" int getopt(int argc, char*argv[], const char*fmt);
|
|
|
|
|
extern "C" int optind;
|
|
|
|
|
extern "C" const char*optarg;
|
|
|
|
|
#endif
|
|
|
|
|
|
2006-04-27 07:04:59 +02:00
|
|
|
#if !defined(HAVE_LROUND)
|
|
|
|
|
/*
|
|
|
|
|
* If the system doesn't provide the lround function, then we provide
|
|
|
|
|
* it ourselves here. It is simply the nearest integer, rounded away
|
|
|
|
|
* from zero.
|
|
|
|
|
*/
|
2006-04-28 17:44:37 +02:00
|
|
|
# include <math.h>
|
2006-04-28 17:40:30 +02:00
|
|
|
extern "C" long int lround(double x)
|
2006-04-27 07:04:59 +02:00
|
|
|
{
|
|
|
|
|
if (x >= 0.0)
|
2006-04-28 17:44:37 +02:00
|
|
|
return (long)floor(x+0.5);
|
2006-04-27 07:04:59 +02:00
|
|
|
else
|
2006-04-28 17:44:37 +02:00
|
|
|
return (long)ceil(x-0.5);
|
2006-04-27 07:04:59 +02:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-07-15 02:21:42 +02:00
|
|
|
bool verbose_flag = false;
|
2008-11-20 01:45:17 +01:00
|
|
|
bool version_flag = false;
|
2008-05-23 04:09:03 +02:00
|
|
|
static int vvp_return_value = 0;
|
|
|
|
|
|
|
|
|
|
void vpip_set_return_value(int value)
|
|
|
|
|
{
|
|
|
|
|
vvp_return_value = value;
|
|
|
|
|
}
|
2002-07-15 02:21:42 +02:00
|
|
|
|
2003-06-25 06:04:19 +02:00
|
|
|
static char log_buffer[4096];
|
2001-10-20 03:03:42 +02:00
|
|
|
|
|
|
|
|
#if defined(HAVE_SYS_RESOURCE_H)
|
|
|
|
|
static void my_getrusage(struct rusage *a)
|
2001-07-16 20:40:19 +02:00
|
|
|
{
|
2001-10-20 03:03:42 +02:00
|
|
|
getrusage(RUSAGE_SELF, a);
|
|
|
|
|
|
|
|
|
|
# if defined(LINUX)
|
|
|
|
|
{
|
|
|
|
|
FILE *statm;
|
|
|
|
|
unsigned siz, rss, shd;
|
2007-02-17 00:30:14 +01:00
|
|
|
long page_size = sysconf(_SC_PAGESIZE);
|
|
|
|
|
if (page_size==-1) page_size=0;
|
2001-10-20 03:03:42 +02:00
|
|
|
statm = fopen("/proc/self/statm", "r");
|
|
|
|
|
if (!statm) {
|
|
|
|
|
perror("/proc/self/statm");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (3<=fscanf(statm, "%u%u%u", &siz, &rss, &shd)) {
|
2007-02-17 00:30:14 +01:00
|
|
|
a->ru_maxrss = page_size * siz;
|
|
|
|
|
a->ru_idrss = page_size * rss;
|
|
|
|
|
a->ru_ixrss = page_size * shd;
|
2001-10-20 03:03:42 +02:00
|
|
|
}
|
|
|
|
|
fclose(statm);
|
|
|
|
|
}
|
|
|
|
|
# endif
|
|
|
|
|
}
|
2001-07-16 20:40:19 +02:00
|
|
|
|
2003-06-13 21:51:08 +02:00
|
|
|
static void print_rusage(struct rusage *a, struct rusage *b)
|
2001-10-20 03:03:42 +02:00
|
|
|
{
|
|
|
|
|
double delta = a->ru_utime.tv_sec
|
|
|
|
|
+ a->ru_utime.tv_usec/1E6
|
|
|
|
|
+ a->ru_stime.tv_sec
|
|
|
|
|
+ a->ru_stime.tv_usec/1E6
|
|
|
|
|
- b->ru_utime.tv_sec
|
|
|
|
|
- b->ru_utime.tv_usec/1E6
|
|
|
|
|
- b->ru_stime.tv_sec
|
|
|
|
|
- b->ru_stime.tv_usec/1E6
|
|
|
|
|
;
|
2001-07-16 20:40:19 +02:00
|
|
|
|
2003-06-13 21:51:08 +02:00
|
|
|
vpi_mcd_printf(1,
|
2001-10-20 03:03:42 +02:00
|
|
|
" ... %G seconds,"
|
|
|
|
|
" %.1f/%.1f/%.1f KBytes size/rss/shared\n",
|
|
|
|
|
delta,
|
|
|
|
|
a->ru_maxrss/1024.0,
|
|
|
|
|
(a->ru_idrss+a->ru_isrss)/1024.0,
|
|
|
|
|
a->ru_ixrss/1024.0 );
|
2001-07-16 20:40:19 +02:00
|
|
|
}
|
2001-10-20 03:03:42 +02:00
|
|
|
|
|
|
|
|
#else // ! defined(HAVE_SYS_RESOURCE_H)
|
|
|
|
|
|
2001-07-16 20:40:19 +02:00
|
|
|
// Provide dummies
|
2001-10-20 03:03:42 +02:00
|
|
|
struct rusage { int x; };
|
|
|
|
|
inline static void my_getrusage(struct rusage *) { }
|
2003-06-13 21:51:08 +02:00
|
|
|
inline static void print_rusage(struct rusage *, struct rusage *){};
|
2001-10-20 03:03:42 +02:00
|
|
|
|
|
|
|
|
#endif // ! defined(HAVE_SYS_RESOURCE_H)
|
2001-07-16 20:40:19 +02:00
|
|
|
|
2008-11-25 00:20:46 +01:00
|
|
|
static bool have_ivl_version = false;
|
|
|
|
|
/*
|
|
|
|
|
* Verify that the input file has a compatible version.
|
|
|
|
|
*/
|
|
|
|
|
void verify_version(char*ivl_ver, char*commit)
|
|
|
|
|
{
|
|
|
|
|
have_ivl_version = true;
|
|
|
|
|
|
|
|
|
|
if (verbose_flag) {
|
|
|
|
|
vpi_mcd_printf(1, " ... VVP file version %s", ivl_ver);
|
|
|
|
|
if (commit) vpi_mcd_printf(1, " %s", commit);
|
|
|
|
|
vpi_mcd_printf(1, "\n");
|
|
|
|
|
}
|
2009-01-13 18:57:12 +01:00
|
|
|
delete[] commit;
|
2008-11-25 00:20:46 +01:00
|
|
|
|
|
|
|
|
char*vvp_ver = strdup(VERSION);
|
|
|
|
|
char *vp, *ip;
|
|
|
|
|
|
|
|
|
|
/* Check the major/minor version. */
|
|
|
|
|
ip = strrchr(ivl_ver, '.');
|
|
|
|
|
*ip = '\0';
|
|
|
|
|
vp = strrchr(vvp_ver, '.');
|
|
|
|
|
*vp = '\0';
|
|
|
|
|
if (strcmp(ivl_ver, vvp_ver) != 0) {
|
|
|
|
|
vpi_mcd_printf(1, "Error: VVP input file version %s can not "
|
|
|
|
|
"be run with run time version %s!\n",
|
|
|
|
|
ivl_ver, vvp_ver);
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check that the sub-version is compatible. */
|
|
|
|
|
ip += 1;
|
|
|
|
|
vp += 1;
|
|
|
|
|
int ivl_sv, vvp_sv;
|
|
|
|
|
if (strcmp(ip, "devel") == 0) {
|
|
|
|
|
ivl_sv = -1;
|
|
|
|
|
} else {
|
|
|
|
|
int res = sscanf(ip, "%d", &ivl_sv);
|
|
|
|
|
assert(res == 1);
|
|
|
|
|
}
|
|
|
|
|
if (strcmp(vp, "devel") == 0) {
|
|
|
|
|
vvp_sv = -1;
|
|
|
|
|
} else {
|
|
|
|
|
int res = sscanf(vp, "%d", &vvp_sv);
|
|
|
|
|
assert(res == 1);
|
|
|
|
|
}
|
|
|
|
|
if (ivl_sv > vvp_sv) {
|
|
|
|
|
if (verbose_flag) vpi_mcd_printf(1, " ... ");
|
|
|
|
|
vpi_mcd_printf(1, "Warning: VVP input file sub-version %s is "
|
|
|
|
|
"greater than the run time sub-version %s!\n",
|
|
|
|
|
ip, vp);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-13 18:57:12 +01:00
|
|
|
delete[] ivl_ver;
|
2008-11-25 00:20:46 +01:00
|
|
|
free(vvp_ver);
|
|
|
|
|
}
|
2001-03-11 01:29:38 +01:00
|
|
|
|
2001-03-16 02:44:34 +01:00
|
|
|
unsigned module_cnt = 0;
|
|
|
|
|
const char*module_tab[64];
|
|
|
|
|
|
2009-06-05 01:12:08 +02:00
|
|
|
extern void vpip_mcd_init(FILE *log);
|
2001-06-12 05:53:10 +02:00
|
|
|
extern void vvp_vpi_init(void);
|
2001-03-18 05:35:18 +01:00
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
int main(int argc, char*argv[])
|
|
|
|
|
{
|
|
|
|
|
int opt;
|
|
|
|
|
unsigned flag_errors = 0;
|
|
|
|
|
const char*design_path = 0;
|
2001-10-20 03:03:42 +02:00
|
|
|
struct rusage cycles[3];
|
2001-07-30 04:44:05 +02:00
|
|
|
const char *logfile_name = 0x0;
|
2001-07-16 20:40:19 +02:00
|
|
|
FILE *logfile = 0x0;
|
2002-01-09 04:15:23 +01:00
|
|
|
extern void vpi_set_vlog_info(int, char**);
|
2007-12-30 07:26:02 +01:00
|
|
|
extern bool stop_is_finish;
|
2001-03-11 01:29:38 +01:00
|
|
|
|
2001-07-26 05:13:51 +02:00
|
|
|
#ifdef __MINGW32__
|
|
|
|
|
/* In the Windows world, we get the first module path
|
|
|
|
|
component relative the location where the binary lives. */
|
|
|
|
|
{ char path[4096], *s;
|
|
|
|
|
GetModuleFileName(NULL,path,1024);
|
|
|
|
|
/* Get to the end. Search back twice for backslashes */
|
|
|
|
|
s = path + strlen(path);
|
|
|
|
|
while (*s != '\\') s--; s--;
|
2004-10-04 03:10:51 +02:00
|
|
|
while (*s != '\\') s--;
|
2001-07-26 05:13:51 +02:00
|
|
|
strcpy(s,"\\lib\\ivl");
|
|
|
|
|
vpip_module_path[0] = strdup(path);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-12-30 07:26:02 +01:00
|
|
|
/* For non-interactive runs we do not want to run the interactive
|
|
|
|
|
* debugger, so make $stop just execute a $finish. */
|
|
|
|
|
stop_is_finish = false;
|
2008-11-20 01:45:17 +01:00
|
|
|
while ((opt = getopt(argc, argv, "+hl:M:m:nsvV")) != EOF) switch (opt) {
|
2001-07-21 23:18:55 +02:00
|
|
|
case 'h':
|
|
|
|
|
fprintf(stderr,
|
2002-04-12 04:44:02 +02:00
|
|
|
"Usage: vvp [options] input-file [+plusargs...]\n"
|
2001-07-21 23:18:55 +02:00
|
|
|
"Options:\n"
|
2001-07-26 05:13:51 +02:00
|
|
|
" -h Print this help message.\n"
|
|
|
|
|
" -l file Logfile, '-' for <stderr>\n"
|
|
|
|
|
" -M path VPI module directory\n"
|
2003-01-19 00:55:35 +01:00
|
|
|
" -M - Clear VPI module path\n"
|
2001-07-26 05:13:51 +02:00
|
|
|
" -m module Load vpi module.\n"
|
2008-06-12 19:04:29 +02:00
|
|
|
" -n Non-interactive ($stop = $finish).\n"
|
2005-01-29 07:28:19 +01:00
|
|
|
" -s $stop right away.\n"
|
2008-11-20 01:45:17 +01:00
|
|
|
" -v Verbose progress messages.\n"
|
|
|
|
|
" -V Print the version information.\n" );
|
2001-07-21 23:18:55 +02:00
|
|
|
exit(0);
|
2001-07-16 20:40:19 +02:00
|
|
|
case 'l':
|
|
|
|
|
logfile_name = optarg;
|
|
|
|
|
break;
|
2001-03-16 02:44:34 +01:00
|
|
|
case 'M':
|
2003-01-19 00:55:35 +01:00
|
|
|
if (strcmp(optarg,"-") == 0) {
|
|
|
|
|
vpip_module_path_cnt = 0;
|
|
|
|
|
vpip_module_path[0] = 0;
|
|
|
|
|
} else {
|
|
|
|
|
vpip_module_path[vpip_module_path_cnt++] = optarg;
|
|
|
|
|
}
|
2001-03-16 02:44:34 +01:00
|
|
|
break;
|
|
|
|
|
case 'm':
|
|
|
|
|
module_tab[module_cnt++] = optarg;
|
|
|
|
|
break;
|
2007-12-30 07:26:02 +01:00
|
|
|
case 'n':
|
|
|
|
|
stop_is_finish = true;
|
|
|
|
|
break;
|
2005-01-29 07:28:19 +01:00
|
|
|
case 's':
|
|
|
|
|
schedule_stop(0);
|
|
|
|
|
break;
|
2001-07-16 20:40:19 +02:00
|
|
|
case 'v':
|
|
|
|
|
verbose_flag = true;
|
|
|
|
|
break;
|
2008-11-20 01:45:17 +01:00
|
|
|
case 'V':
|
|
|
|
|
version_flag = true;
|
|
|
|
|
break;
|
2001-03-11 01:29:38 +01:00
|
|
|
default:
|
|
|
|
|
flag_errors += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (flag_errors)
|
|
|
|
|
return flag_errors;
|
|
|
|
|
|
2008-11-20 01:45:17 +01:00
|
|
|
if (version_flag) {
|
|
|
|
|
fprintf(stderr, "Icarus Verilog runtime version " VERSION " ("
|
|
|
|
|
VERSION_TAG ")\n\n");
|
2009-01-09 02:59:39 +01:00
|
|
|
fprintf(stderr, "Copyright 1998-2009 Stephen Williams\n\n");
|
2008-11-20 01:45:17 +01:00
|
|
|
fprintf(stderr,
|
|
|
|
|
" This program is free software; you can redistribute it and/or modify\n"
|
|
|
|
|
" it under the terms of the GNU General Public License as published by\n"
|
|
|
|
|
" the Free Software Foundation; either version 2 of the License, or\n"
|
|
|
|
|
" (at your option) any later version.\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" This program is distributed in the hope that it will be useful,\n"
|
|
|
|
|
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
|
|
|
|
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
|
|
|
|
" GNU General Public License for more details.\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" You should have received a copy of the GNU General Public License along\n"
|
|
|
|
|
" with this program; if not, write to the Free Software Foundation, Inc.,\n"
|
|
|
|
|
" 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n\n"
|
|
|
|
|
);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
if (optind == argc) {
|
|
|
|
|
fprintf(stderr, "%s: no input file.\n", argv[0]);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2007-07-12 06:38:56 +02:00
|
|
|
/* If the VVP_DEBUG variable is set, then it contains the path
|
|
|
|
|
to the vvp debug file. Open it for output. */
|
|
|
|
|
|
|
|
|
|
if (char*path = getenv("VVP_DEBUG")) {
|
2008-09-30 03:06:47 +02:00
|
|
|
debug_file.open(path, ios::out);
|
2007-07-12 06:38:56 +02:00
|
|
|
}
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
design_path = argv[optind];
|
|
|
|
|
|
2001-03-18 05:35:18 +01:00
|
|
|
/* This is needed to get the MCD I/O routines ready for
|
|
|
|
|
anything. It is done early because it is plausible that the
|
|
|
|
|
compile might affect it, and it is cheap to do. */
|
|
|
|
|
|
2001-07-16 20:40:19 +02:00
|
|
|
if (logfile_name) {
|
|
|
|
|
if (!strcmp(logfile_name, "-"))
|
|
|
|
|
logfile = stderr;
|
2003-05-15 18:51:08 +02:00
|
|
|
else {
|
2001-07-16 20:40:19 +02:00
|
|
|
logfile = fopen(logfile_name, "w");
|
2003-05-15 18:51:08 +02:00
|
|
|
if (!logfile) {
|
|
|
|
|
perror(logfile_name);
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
2003-06-25 06:04:19 +02:00
|
|
|
setvbuf(logfile, log_buffer, _IOLBF, sizeof(log_buffer));
|
2001-07-16 20:40:19 +02:00
|
|
|
}
|
|
|
|
|
}
|
2001-10-20 03:03:42 +02:00
|
|
|
|
2009-06-05 01:12:08 +02:00
|
|
|
vpip_mcd_init(logfile);
|
2003-06-13 21:51:08 +02:00
|
|
|
|
2001-07-16 20:40:19 +02:00
|
|
|
if (verbose_flag) {
|
2001-10-20 03:03:42 +02:00
|
|
|
my_getrusage(cycles+0);
|
2003-06-13 21:51:08 +02:00
|
|
|
vpi_mcd_printf(1, "Compiling VVP ...\n");
|
2001-07-16 20:40:19 +02:00
|
|
|
}
|
2001-03-18 05:35:18 +01:00
|
|
|
|
2001-06-12 05:53:10 +02:00
|
|
|
vvp_vpi_init();
|
|
|
|
|
|
2002-04-12 04:44:02 +02:00
|
|
|
/* Make the extended arguments available to the simulation. */
|
|
|
|
|
vpi_set_vlog_info(argc-optind, argv+optind);
|
2002-01-09 04:15:23 +01:00
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
compile_init();
|
2001-07-26 05:13:51 +02:00
|
|
|
|
2001-03-23 03:40:22 +01:00
|
|
|
for (unsigned idx = 0 ; idx < module_cnt ; idx += 1)
|
2001-07-26 05:13:51 +02:00
|
|
|
vpip_load_module(module_tab[idx]);
|
|
|
|
|
|
2009-01-14 19:26:58 +01:00
|
|
|
int ret_cd = compile_design(design_path);
|
|
|
|
|
destroy_lexor();
|
|
|
|
|
if (ret_cd) return ret_cd;
|
2001-03-11 01:29:38 +01:00
|
|
|
|
2008-11-25 00:20:46 +01:00
|
|
|
if (!have_ivl_version) {
|
|
|
|
|
if (verbose_flag) vpi_mcd_printf(1, "... ");
|
|
|
|
|
vpi_mcd_printf(1, "Warning: vvp input file may not be correct "
|
|
|
|
|
"version!\n");
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-16 20:40:19 +02:00
|
|
|
if (verbose_flag) {
|
2003-06-13 21:51:08 +02:00
|
|
|
vpi_mcd_printf(1, "Compile cleanup...\n");
|
2001-07-16 20:40:19 +02:00
|
|
|
}
|
2002-03-01 06:43:14 +01:00
|
|
|
|
|
|
|
|
compile_cleanup();
|
|
|
|
|
|
2001-03-22 23:38:13 +01:00
|
|
|
if (compile_errors > 0) {
|
2003-06-13 21:51:08 +02:00
|
|
|
vpi_mcd_printf(1, "%s: Program not runnable, %u errors.\n",
|
2001-03-22 23:38:13 +01:00
|
|
|
design_path, compile_errors);
|
|
|
|
|
return compile_errors;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-05 04:50:57 +02:00
|
|
|
if (verbose_flag) {
|
2008-06-14 02:08:11 +02:00
|
|
|
vpi_mcd_printf(1, " ... %8lu functors (net_fun pool=%zu bytes)\n",
|
|
|
|
|
count_functors, size_vvp_net_funs);
|
2007-12-02 17:47:06 +01:00
|
|
|
vpi_mcd_printf(1, " %8lu logic\n", count_functors_logic);
|
2003-06-13 21:51:08 +02:00
|
|
|
vpi_mcd_printf(1, " %8lu bufif\n", count_functors_bufif);
|
|
|
|
|
vpi_mcd_printf(1, " %8lu resolv\n",count_functors_resolv);
|
2007-12-02 17:47:06 +01:00
|
|
|
vpi_mcd_printf(1, " %8lu signals\n", count_functors_sig);
|
2008-06-07 04:50:44 +02:00
|
|
|
vpi_mcd_printf(1, " ... %8lu opcodes (%zu bytes)\n",
|
2008-06-13 18:55:47 +02:00
|
|
|
count_opcodes, size_opcodes);
|
2003-06-13 21:51:08 +02:00
|
|
|
vpi_mcd_printf(1, " ... %8lu nets\n", count_vpi_nets);
|
2008-06-07 04:50:44 +02:00
|
|
|
vpi_mcd_printf(1, " ... %8lu vvp_nets (%zu bytes)\n",
|
|
|
|
|
count_vvp_nets, size_vvp_nets);
|
2008-06-14 02:41:24 +02:00
|
|
|
vpi_mcd_printf(1, " ... %8lu arrays (%lu words)\n",
|
|
|
|
|
count_net_arrays, count_net_array_words);
|
|
|
|
|
vpi_mcd_printf(1, " ... %8lu memories\n",
|
|
|
|
|
count_var_arrays+count_real_arrays);
|
|
|
|
|
vpi_mcd_printf(1, " %8lu logic (%lu words)\n",
|
|
|
|
|
count_var_arrays, count_var_array_words);
|
|
|
|
|
vpi_mcd_printf(1, " %8lu real (%lu words)\n",
|
|
|
|
|
count_real_arrays, count_real_array_words);
|
2003-06-13 21:51:08 +02:00
|
|
|
vpi_mcd_printf(1, " ... %8lu scopes\n", count_vpi_scopes);
|
2002-07-05 04:50:57 +02:00
|
|
|
}
|
|
|
|
|
|
2002-03-01 06:43:14 +01:00
|
|
|
if (verbose_flag) {
|
|
|
|
|
my_getrusage(cycles+1);
|
2003-06-13 21:51:08 +02:00
|
|
|
print_rusage(cycles+1, cycles+0);
|
|
|
|
|
vpi_mcd_printf(1, "Running ...\n");
|
2002-03-01 06:43:14 +01:00
|
|
|
}
|
2004-10-04 03:10:51 +02:00
|
|
|
|
2001-05-09 01:32:26 +02:00
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
schedule_simulate();
|
|
|
|
|
|
2001-07-16 20:40:19 +02:00
|
|
|
if (verbose_flag) {
|
2001-10-20 03:03:42 +02:00
|
|
|
my_getrusage(cycles+2);
|
2003-06-13 21:51:08 +02:00
|
|
|
print_rusage(cycles+2, cycles+1);
|
2003-01-07 00:57:26 +01:00
|
|
|
|
2008-06-07 04:50:44 +02:00
|
|
|
vpi_mcd_printf(1, "Event counts:\n");
|
|
|
|
|
vpi_mcd_printf(1, " %8lu time steps (pool=%lu)\n",
|
2008-06-13 04:55:53 +02:00
|
|
|
count_time_events, count_time_pool());
|
2003-06-13 21:51:08 +02:00
|
|
|
vpi_mcd_printf(1, " %8lu thread schedule events\n",
|
2003-01-07 00:57:26 +01:00
|
|
|
count_thread_events);
|
2003-06-13 21:51:08 +02:00
|
|
|
vpi_mcd_printf(1, " %8lu assign events\n",
|
2003-01-07 00:57:26 +01:00
|
|
|
count_assign_events);
|
2008-06-13 04:55:53 +02:00
|
|
|
vpi_mcd_printf(1, " ...assign(vec4) pool=%lu\n",
|
|
|
|
|
count_assign4_pool());
|
|
|
|
|
vpi_mcd_printf(1, " ...assign(vec8) pool=%lu\n",
|
|
|
|
|
count_assign8_pool());
|
|
|
|
|
vpi_mcd_printf(1, " ...assign(real) pool=%lu\n",
|
|
|
|
|
count_assign_real_pool());
|
|
|
|
|
vpi_mcd_printf(1, " ...assign(word) pool=%lu\n",
|
|
|
|
|
count_assign_aword_pool());
|
|
|
|
|
vpi_mcd_printf(1, " %8lu other events (pool=%lu)\n",
|
|
|
|
|
count_gen_events, count_gen_pool());
|
2001-07-16 20:40:19 +02:00
|
|
|
}
|
|
|
|
|
|
2009-01-30 02:23:09 +01:00
|
|
|
/*
|
|
|
|
|
* We only need to cleanup the memory if we are checking with valgrind.
|
|
|
|
|
*/
|
|
|
|
|
#ifdef CHECK_WITH_VALGRIND
|
2009-01-13 18:57:12 +01:00
|
|
|
/* Clean up the memory. */
|
|
|
|
|
for (vector<const char*>::iterator cur = file_names.begin();
|
|
|
|
|
cur != file_names.end() ; cur++) {
|
|
|
|
|
delete[] *cur;
|
|
|
|
|
}
|
2009-01-24 01:04:44 +01:00
|
|
|
(void)need_result_buf(0, RBUF_DEL);
|
2009-01-30 02:23:09 +01:00
|
|
|
codespace_delete();
|
|
|
|
|
root_table_delete();
|
2009-01-24 01:04:44 +01:00
|
|
|
def_table_delete();
|
|
|
|
|
vpi_mcd_delete();
|
|
|
|
|
dec_str_delete();
|
2009-01-30 02:23:09 +01:00
|
|
|
modpath_delete();
|
|
|
|
|
vpi_handle_delete();
|
|
|
|
|
udp_defns_delete();
|
2009-01-24 01:04:44 +01:00
|
|
|
load_module_delete();
|
2009-02-07 03:05:12 +01:00
|
|
|
island_delete();
|
2009-01-30 02:23:09 +01:00
|
|
|
signal_pool_delete();
|
|
|
|
|
vvp_net_pool_delete();
|
|
|
|
|
#endif
|
2009-01-13 18:57:12 +01:00
|
|
|
|
2008-05-23 04:09:03 +02:00
|
|
|
return vvp_return_value;
|
2001-03-11 01:29:38 +01:00
|
|
|
}
|