Comments (10)
For me, running under Linux. the output appears immediately. What version of Icarus and O/S are you using?
from iverilog.
@martinwhitaker, what do you mean by immediately? What I'm looking for is for the first $display to appear first, then the second, etc. Currently I'm seeing them all appear on the screen at the same time at the end of the run.
I tried it with Icarus 0.9.6 on Ubuntu 13.04, and with a recent Icarus 0.10.0 on RHEL5
from iverilog.
By immediately I mean as soon as the simulation reaches that point, i.e. exactly what you expect/want.
I would only expect the output to be delayed if you have redirected or piped standard output, e.g. something like 'vvp a.out | tee run.log' will give the behaviour you are seeing. Are you running vvp directly from a command prompt in a terminal window?
from iverilog.
What you are looking for is the following (from 1364-2005)
17.2.6 Flushing output
For example:
$fflush ( mcd );
$fflush ( fd );
$fflush ( );
writes any buffered output to the file(s) specified by mcd, to the file specified by fd, or if $fflush is invoked
with no arguments, to all open files.
and this snippet from 17.2.1
Three file descriptors are pre-opened; they are STDIN, STDOUT, and STDERR, which have the values 32'h8000_0000, 32'h8000_0001, and 32'h8000_0002, respectively. STDIN is pre-opened for reading, and STDOUT and STDERR are pre-opened for append.
If you don't have other files open for writing that would benefit from buffering just calling $fflush(); should be enough otherwise try $fflush(32'h8000_0001); to just flush STDOUT.
Cary
from iverilog.
Yes, using $fflush() works.
Thank you.
from iverilog.
@martinwhitaker, yes, I ran vvp directly from command prompt and also from inside a bash script. I always see results flushed out at the end of the sim.
from iverilog.
Glad to hear Cary's solution works for you, but it shouldn't be needed! stdout should be line-buffered when connected to a terminal, so each $display should produce output immediately. Unfortunately I can't think of any explanation for why this is not happening for you.
from iverilog.
Ok. I see the difference in behavior now. I'm running vvp like this:
vvp a.out | tee log.txt
. Whenever the vvp output gets piped or redirected, the results don't get flushed out. This is inconvenient -- I'm writing a Java-based wrapper (intended for quick Verilog prototyping using different simulators) and I must do redirection. Any chance this behavior can be changed?
from iverilog.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The behavior you are seeing is the typical behavoir of stdout
as defined by the C library. It is possible to override this
(by explicitly setting stdout to line buffered) but the reason
the people in the olden days did this is because output that is
not going to the tty is typically being sent to a file or other
non-interactive destination and the C library chooses the most
efficient way to do that.
What is typically done with programs that want to interactively
wrap interactive programs is to use ptty devices to link the
wrapper program to the interactive program.
On 07/17/2013 07:04 AM, getvictor wrote:
Ok. I see the difference in behavior now. I'm running vvp like
this: |vvp a.out | tee log.txt|. Whenever the vvp output gets piped
or redirected, the results don't get flushed out. This is
inconvenient since I'm writing a Java-based wrapper (intended for
quick Verilog prototyping using different simulators). Any chance
this behavior can be changed?— Reply to this email directly or view it on GitHub
#3 (comment).
Steve Williams "The woods are lovely, dark and deep.
steve at icarus.com But I have promises to keep,
http://www.icarus.com and lines to code before I sleep,
http://www.picturel.com And lines to code before I sleep."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlHmse4ACgkQrPt1Sc2b3imjpgCgzoRK2EORC3sC0TBKMcBo+BKv
aRgAnisnyMB1j5azhdSCaIzZBhVg7JlL
=ftIx
-----END PGP SIGNATURE-----
from iverilog.
@steveicarus, thank you for the explanation. I found a way to enable line buffering while redirecting: unbuffer vvp a.out | tee log.txt
from iverilog.
Related Issues (20)
- Please tag an official `v13.0.1`, or `v13.0.1-rc1`, or something HOT 6
- Executing multiple `vvp` instances of different files in parallel on the same computer causes vvp to hang HOT 3
- This code stalls instead of erroring HOT 2
- The simulation of iverilog and other tools is inconsistent HOT 1
- Adding signal output will cause abnormal simulation output in iverilog HOT 3
- Bug: assert: elab_expr.cc:2673: failed assertion base_index.size()+1 == net->packed_dimensions() HOT 3
- Changing Fixed VVP Path for Prebuilt Icarus Verilog on a Restricted System HOT 3
- Downgrade non-existing parameter to a warning (again) HOT 1
- Non-interactive mode of vvp (-n, -N) seems to be broken HOT 3
- Uninformative "syntax error" message when an undefined package name is used HOT 4
- No error or warning reported when a vector lsb or msb value contains `x` or `z` bits HOT 7
- function being classified as non-constant HOT 3
- no warning for scaler being access with indexed part select. No warning for double assignment of combiniational logic HOT 2
- incomplete for statement produces no output. HOT 9
- $display not working inside function during non clocked execution HOT 2
- icarus gets caught in a infinite combi loop and I'm not sure why. HOT 4
- infinant loop in recursive function causes crash HOT 2
- Assertion Failure in AST Processing: node->bits == v at frontends/ast/ast.cc:855 HOT 1
- Simulation results discrepancy HOT 1
- Unpacked localparam array support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iverilog.