Add vvp flag that allows $stop to act like $finish.
This patch adds a new flag to vvp "-n" that can be used to make $stop and hence <Control-C> act like $finish. This may be desired when using vvp in a non-interactive environment.
This commit is contained in:
parent
8ea3b6b0b8
commit
d95c77a58a
10
vvp/main.cc
10
vvp/main.cc
|
|
@ -144,6 +144,7 @@ int main(int argc, char*argv[])
|
||||||
const char *logfile_name = 0x0;
|
const char *logfile_name = 0x0;
|
||||||
FILE *logfile = 0x0;
|
FILE *logfile = 0x0;
|
||||||
extern void vpi_set_vlog_info(int, char**);
|
extern void vpi_set_vlog_info(int, char**);
|
||||||
|
extern bool stop_is_finish;
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
/* In the Windows world, we get the first module path
|
/* In the Windows world, we get the first module path
|
||||||
|
|
@ -159,7 +160,10 @@ int main(int argc, char*argv[])
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "+hl:M:m:sv")) != EOF) switch (opt) {
|
/* For non-interactive runs we do not want to run the interactive
|
||||||
|
* debugger, so make $stop just execute a $finish. */
|
||||||
|
stop_is_finish = false;
|
||||||
|
while ((opt = getopt(argc, argv, "+hl:M:m:nsv")) != EOF) switch (opt) {
|
||||||
case 'h':
|
case 'h':
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"Usage: vvp [options] input-file [+plusargs...]\n"
|
"Usage: vvp [options] input-file [+plusargs...]\n"
|
||||||
|
|
@ -169,6 +173,7 @@ int main(int argc, char*argv[])
|
||||||
" -M path VPI module directory\n"
|
" -M path VPI module directory\n"
|
||||||
" -M - Clear VPI module path\n"
|
" -M - Clear VPI module path\n"
|
||||||
" -m module Load vpi module.\n"
|
" -m module Load vpi module.\n"
|
||||||
|
" -n Non-interctive ($stop = $finish).\n"
|
||||||
" -s $stop right away.\n"
|
" -s $stop right away.\n"
|
||||||
" -v Verbose progress messages.\n" );
|
" -v Verbose progress messages.\n" );
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
@ -186,6 +191,9 @@ int main(int argc, char*argv[])
|
||||||
case 'm':
|
case 'm':
|
||||||
module_tab[module_cnt++] = optarg;
|
module_tab[module_cnt++] = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
stop_is_finish = true;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
schedule_stop(0);
|
schedule_stop(0);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
34
vvp/stop.cc
34
vvp/stop.cc
|
|
@ -43,6 +43,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct __vpiScope*stop_current_scope = 0;
|
struct __vpiScope*stop_current_scope = 0;
|
||||||
|
bool stop_is_finish; /* When set, $stop acts like $finish (set in main.cc). */
|
||||||
|
|
||||||
#ifndef USE_READLINE
|
#ifndef USE_READLINE
|
||||||
static char* readline_stub(const char*prompt)
|
static char* readline_stub(const char*prompt)
|
||||||
|
|
@ -474,6 +475,13 @@ static void invoke_command(char*txt)
|
||||||
|
|
||||||
void stop_handler(int rc)
|
void stop_handler(int rc)
|
||||||
{
|
{
|
||||||
|
/* The user may be running in a non-interactive environment, so
|
||||||
|
* they want $stop and <Control-C> to be the same as $finish. */
|
||||||
|
if (stop_is_finish) {
|
||||||
|
schedule_finish(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
vpi_mcd_printf(1,"** VVP Stop(%d) **\n", rc);
|
vpi_mcd_printf(1,"** VVP Stop(%d) **\n", rc);
|
||||||
vpi_mcd_printf(1,"** Current simulation time is %" TIME_FMT "u ticks.\n",
|
vpi_mcd_printf(1,"** Current simulation time is %" TIME_FMT "u ticks.\n",
|
||||||
schedule_simtime());
|
schedule_simtime());
|
||||||
|
|
@ -503,29 +511,3 @@ void stop_handler(int rc)
|
||||||
vpi_mcd_printf(1,"** Continue **\n");
|
vpi_mcd_printf(1,"** Continue **\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* $Log: stop.cc,v $
|
|
||||||
* Revision 1.16 2006/06/18 04:15:50 steve
|
|
||||||
* Add support for system functions in continuous assignments.
|
|
||||||
*
|
|
||||||
* Revision 1.15 2005/11/25 18:35:38 steve
|
|
||||||
* stop/continue messages go through MCD for logging.
|
|
||||||
*
|
|
||||||
* Revision 1.14 2005/09/20 18:34:02 steve
|
|
||||||
* Clean up compiler warnings.
|
|
||||||
*
|
|
||||||
* Revision 1.13 2005/01/29 06:29:17 steve
|
|
||||||
* Support interactive mode even without readline.
|
|
||||||
*
|
|
||||||
* Revision 1.12 2004/10/04 01:10:59 steve
|
|
||||||
* Clean up spurious trailing white space.
|
|
||||||
*
|
|
||||||
* Revision 1.11 2004/02/21 00:44:34 steve
|
|
||||||
* Add load command to interactive stop.
|
|
||||||
* Support decimal constants passed interactive to system tasks.
|
|
||||||
*
|
|
||||||
* Revision 1.10 2003/11/07 05:58:02 steve
|
|
||||||
* Fix conditional compilation of readline history.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,11 @@ the module. However, if the name includes at least one directory
|
||||||
character, then the search path is not scanned and the name is assumed
|
character, then the search path is not scanned and the name is assumed
|
||||||
to be a complete file name.
|
to be a complete file name.
|
||||||
.TP 8
|
.TP 8
|
||||||
|
.B -n
|
||||||
|
This flag makes $stop or a <Control-C> a synonym for $finish.
|
||||||
|
It can be used to give the program a more meaningful interface when
|
||||||
|
running in a non-interactive environment.
|
||||||
|
.TP 8
|
||||||
.B -s
|
.B -s
|
||||||
Stop. This will cause the simulation to stop in the beginning, before
|
Stop. This will cause the simulation to stop in the beginning, before
|
||||||
any events are scheduled. This allows the interactive user to get
|
any events are scheduled. This allows the interactive user to get
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue