V0.8: 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:
Cary R 2007-12-29 22:27:34 -08:00 committed by Stephen Williams
parent 24b097ce89
commit e34647f79c
3 changed files with 22 additions and 1 deletions

View File

@ -129,6 +129,7 @@ int main(int argc, char*argv[])
const char *logfile_name = 0x0;
FILE *logfile = 0x0;
extern void vpi_set_vlog_info(int, char**);
extern bool stop_is_finish;
#ifdef __MINGW32__
/* In the Windows world, we get the first module path
@ -144,7 +145,10 @@ int main(int argc, char*argv[])
}
#endif
while ((opt = getopt(argc, argv, "+dhl:M:m:v")) != 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, "+dhl:M:m:nv")) != EOF) switch (opt) {
case 'h':
fprintf(stderr,
"Usage: vvp [options] input-file [+plusargs...]\n"
@ -154,6 +158,7 @@ int main(int argc, char*argv[])
" -M path VPI module directory\n"
" -M - Clear VPI module path\n"
" -m module Load vpi module.\n"
" -n Non-interactive ($stop = $finish).\n"
" -v Verbose progress messages.\n" );
exit(0);
case 'l':
@ -170,6 +175,9 @@ int main(int argc, char*argv[])
case 'm':
module_tab[module_cnt++] = optarg;
break;
case 'n':
stop_is_finish = true;
break;
case 'v':
verbose_flag = true;
break;

View File

@ -47,6 +47,7 @@
#endif
struct __vpiScope*stop_current_scope = 0;
bool stop_is_finish; /* When set, $stop acts like $finish (set in main.cc). */
#ifdef USE_READLINE
@ -449,6 +450,13 @@ static void invoke_command(char*txt)
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;
}
printf("** VVP Stop(%d) **\n", rc);
printf("** Current simulation time is %" TIME_FMT "u ticks.\n",
schedule_simtime());

View File

@ -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
to be a complete file name.
.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 -v
Turn on verbose messages. This will cause information about run time
progress to be printed to standard out.