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
Double quotes in -f option file #1535
Comments
Original Redmine Comment Thanks for your issue & looking at how to fix this. As the old comment noted, most other simulators don't support this. Which big-3 simulator respects quotes? I don't think Verilator should be on its own in how they are handled. Also if your doing this to support e.g. spaces in directory names, note that will break "make". As to the patch itself, assuming there's another simulator that supports this:
|
Original Redmine Comment I acknowledge this and future contributions are made under the Developer Certificate of Origin (https://developercertificate.org/) |
Original Redmine Comment Hi Wilson, As for big-3 simulators, i have tested the following cases:
CHAIN1 is a simple string, CHAIN2 contains a space, CHAIN3 contains an escaped double quote. Simulator 1 supports the 3 chains. Simulator 2 only supports simple strings (CHAIN1) Simulator 3 supports, CHAIN1 and CHAIN2, but doesn't support escaped double quote. Verilator could support a least simple chains without spaces, nor escaped quotes while being compatible whith other simulators. So I need to modify my patch to look for " instead of " |
Original Redmine Comment Great, awaiting next patch. |
Original Redmine Comment Please find here an updated proposal based on further investigations on the big-3 simulators. First of all the "string parameter" may be transmitted to the simulator using two methods:
Furthermore we have to distinguish 2 cases for "string parameter" transmission:
As regards "quoting" we have also to take into account integer definitions using annotations like : 32'h As regards the "+define+" solution on the command line the following table summarize
Has regards the same "+define+" solution through the "-f" option files, the results are
Has regards the direct overriding of a parameters, the exact syntax differs from one
Parameters overriding may be done either through the "-f" option file either
As a conclusion, verilator behavior is very close to "simulator 1" behavior for string parameters defined in the command line. I propose to choose the same behavior for the "-f" option file, while keeping already Please find here a patch including the V3Options.cpp source file as well as updated non regression tests t_flag_parameters and t_flag_define. I also changed the error message, to info messages. I didn't notice any new error in other non regression tests. |
Original Redmine Comment Thanks for the great analysis. I don't see that there's anything at all
Use Upper for enum names, ALL_CAPS for enum values, with common prefix. e.g.
Fix style: Remove spaces before semicolons. Two spaces before //
I don't see why this code needs to parse the =. The extracted argument (including the equal)
Faster to use:
This would need to be a new warning code (in V3Error.h). Alternatively if
Tests looks good. In t_flag_parameter.v I suggest you also paste (in comments) the |
Original Redmine Comment New proposal updated taking into account your last post.
As regards the parsing of '=' it was an attempt to distinguish the two following cases:
I updated also the non regression tests (t_flag_defines.v) in order check the different forms of base specified literal constants. I propose to suppress any "warning" message, as this code supports all cases of well formed strings. It's up to the parser to detect any incorrect option. |
Original Redmine Comment Looking good.
|
Original Redmine Comment Wilson Snyder wrote:
Yes that's correct: shells (sh, zsh, bash, csh...) don't check escaped chars inside single quotes, all inside chars are transmitted. The proposed code has the same behavior. Furthermore, as I tried to be compatible with the current command line behavior of Verilator, strings like in the following example are not supported.
As a result simple quotes are only used to protect double quote strings, and to avoid escaping chars for readability. I added an example in the tables of the non regression tests.
Ok (modified)
Yes, this state is not usefull (modified) |
Original Redmine Comment I think good to go (with a few trivial space issues I'll fix). May I use the email you registered under for the git commit or do you prefer something else? |
Original Redmine Comment Wilson Snyder wrote:
That's ok for the registered mail. |
Original Redmine Comment Great, thanks for the work. Pushed to git towards eventual 4.022 release. |
Original Redmine Comment In 4.022. |
Author Name: Yves Mathieu
Original Redmine Issue: 1535 from https://www.veripool.org
Original Assignee: Yves Mathieu
SystemVerilog allows string parameters.
Using -f option file should support quoted strings.
Please find, attached a suggested patch for the support of double quote in -f file.
The text was updated successfully, but these errors were encountered: