|
From: Lennert B. <bu...@wa...> - 2019-01-02 14:34:32
|
Hello!
I've been using the hack patch below to make Icarus Verilog
automatically start in noninteractive mode when standard input is
not a terminal. This is useful when you're piping test data into a
testbench and you don't want Ctrl-C to cause your terminal to be
flooded with endless output like this:
$ ./gen | vvp ./detect
[...]
[1117850] 0 x x x
[1119450] 0 x x x
^C** VVP Stop(0) **
** Flushing output streams.
** Current simulation time is 1120750 ticks.
> 0
Unknown command: 0
Try the help command to get a summary
of available commands.
> 0
Unknown command: 0
Try the help command to get a summary
of available commands.
> 0
Unknown command: 0
Try the help command to get a summary
of available commands.
> 0
Unknown command: 0
Try the help command to get a summary
of available commands.
[...]
Specifying -n by hand achieves the same thing, but there doesn't seem
to be a legitimate reason to make Ctrl-C cause piped (noninteractive)
input to be treated as commands if you don't explicitly pass in an
option to prevent that from happening, IMHO.
Not sure if this works on Windows or whether this is the right way to
do it, but any thoughts?
Thanks!
diff --git a/vvp/main.cc b/vvp/main.cc
index 5b598e4d..53cd5705 100644
--- a/vvp/main.cc
+++ b/vvp/main.cc
@@ -277,7 +277,7 @@ int main(int argc, char*argv[])
/* For non-interactive runs we do not want to run the interactive
* debugger, so make $stop just execute a $finish. */
- stop_is_finish = false;
+ stop_is_finish = !isatty(0);
while ((opt = getopt(argc, argv, "+hil:M:m:nNsvV")) != EOF) switch (opt) {
case 'h':
fprintf(stderr,
|