Teach vvp about -N
Added support for the -N option, which causes $stop and ^C to behave like $finish with an exit code of 1. While I was at it, I noticed that the summary line in the man page for vvp was missing a couple of options, so I fixed that.
This commit is contained in:
parent
5153bfc1f7
commit
f379cd0a14
|
|
@ -207,6 +207,7 @@ int main(int argc, char*argv[])
|
||||||
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;
|
extern bool stop_is_finish;
|
||||||
|
extern int stop_is_finish_exit_code;
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
/* In the Windows world, we get the first module path
|
/* In the Windows world, we get the first module path
|
||||||
|
|
@ -225,7 +226,7 @@ int main(int argc, char*argv[])
|
||||||
/* For non-interactive runs we do not want to run the interactive
|
/* For non-interactive runs we do not want to run the interactive
|
||||||
* debugger, so make $stop just execute a $finish. */
|
* debugger, so make $stop just execute a $finish. */
|
||||||
stop_is_finish = false;
|
stop_is_finish = false;
|
||||||
while ((opt = getopt(argc, argv, "+hl:M:m:nsvV")) != EOF) switch (opt) {
|
while ((opt = getopt(argc, argv, "+hl:M:m:nNsvV")) != 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"
|
||||||
|
|
@ -236,6 +237,7 @@ int main(int argc, char*argv[])
|
||||||
" -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-interactive ($stop = $finish).\n"
|
" -n Non-interactive ($stop = $finish).\n"
|
||||||
|
" -N Same as -n, but exit code is 1 instead of 0\n"
|
||||||
" -s $stop right away.\n"
|
" -s $stop right away.\n"
|
||||||
" -v Verbose progress messages.\n"
|
" -v Verbose progress messages.\n"
|
||||||
" -V Print the version information.\n" );
|
" -V Print the version information.\n" );
|
||||||
|
|
@ -257,6 +259,10 @@ int main(int argc, char*argv[])
|
||||||
case 'n':
|
case 'n':
|
||||||
stop_is_finish = true;
|
stop_is_finish = true;
|
||||||
break;
|
break;
|
||||||
|
case 'N':
|
||||||
|
stop_is_finish = true;
|
||||||
|
stop_is_finish_exit_code = 1;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
schedule_stop(0);
|
schedule_stop(0);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@
|
||||||
|
|
||||||
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). */
|
bool stop_is_finish; /* When set, $stop acts like $finish (set in main.cc). */
|
||||||
|
int stop_is_finish_exit_code = 0;
|
||||||
|
|
||||||
#ifndef USE_READLINE
|
#ifndef USE_READLINE
|
||||||
static char* readline_stub(const char*prompt)
|
static char* readline_stub(const char*prompt)
|
||||||
|
|
@ -490,6 +491,7 @@ void stop_handler(int rc)
|
||||||
/* The user may be running in a non-interactive environment, so
|
/* The user may be running in a non-interactive environment, so
|
||||||
* they want $stop and <Control-C> to be the same as $finish. */
|
* they want $stop and <Control-C> to be the same as $finish. */
|
||||||
if (stop_is_finish) {
|
if (stop_is_finish) {
|
||||||
|
vpip_set_return_value(stop_is_finish_exit_code);
|
||||||
schedule_finish(0);
|
schedule_finish(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ vvp - Icarus Verilog vvp runtime engine
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B vvp
|
.B vvp
|
||||||
[-sv] [-Mpath] [-mmodule] [-llogfile] inputfile [extended-args...]
|
[-nNsvV] [-Mpath] [-mmodule] [-llogfile] inputfile [extended-args...]
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
|
|
@ -46,6 +46,11 @@ 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
|
It can be used to give the program a more meaningful interface when
|
||||||
running in a non-interactive environment.
|
running in a non-interactive environment.
|
||||||
.TP 8
|
.TP 8
|
||||||
|
.B -N
|
||||||
|
This flag does the same thing as -n, but results in an exit code
|
||||||
|
of 1 if the stimulation calls $stop. It can be used to indicate a
|
||||||
|
simulation failure when running a testbench.
|
||||||
|
.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