New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support pre-opened file descriptors for $fwrite() #961
Comments
Original Redmine Comment Verilator only supports new-style file descriptors, not legacy multi-channel descriptors. This is unlikely to change unless you'd like to contribute a patch to do so - if you'd like pointers of how to do that just ask. |
Original Redmine Comment I would like to try but it seems related to a lot components. So the limited target would be supporting only stdin, stdout and stderr. According to my understanding, I need to:
Some guidance on these? Pointer to related files would be great. |
Original Redmine Comment The stdin/out/err channels will already be open. You want to use the number computed at runtime, not parse time. First, make a standalone test in test_regress format (see the docs) that passes on other sims and fails on verilator. Then, you'll see a message like "Unsupported: $fopen/$fclose/$f* descriptor must be a simple variable" this is made by V3LinkResolve. Change that to accept an AstConst (constant) and check that the value only has stdout/stderr bits set. There might be some minor changes but eventually the code will verilate. Then fix include/verilated.h/cpp to fix the VL_FWRITEF runtime code to understand the magic values -- you'll see it calls VL_CVT_I_FP to make a file pointer instead this will need to return a list of stdout and stderr. |
Original Redmine Comment Fixed in git towards 3.878. |
Original Redmine Comment Fixed in git towards 3.878. |
Original Redmine Comment In 3.878. |
Author Name: Wei Song
Original Redmine Issue: 961 from https://www.veripool.org
Original Date: 2015-08-27
Original Assignee: Wilson Snyder (@wsnyder)
Currently the following statement cause compiling error:
$fwrite(32'h80000002, "Error message!");
32'h80000000 to 32'h80000002 are pre-opened file descriptors for stdin, stdout, and stderr.
Or, may be there is a work-around I can use right now.
The text was updated successfully, but these errors were encountered: