-
Notifications
You must be signed in to change notification settings - Fork 177
raise error on space in fsm name #595
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #595 +/- ##
==========================================
- Coverage 81.50% 81.47% -0.03%
==========================================
Files 49 49
Lines 6461 6463 +2
Branches 1287 1288 +1
==========================================
Hits 5266 5266
- Misses 1007 1009 +2
Partials 188 188
Continue to review full report at Codecov.
|
Why not replace spaces with underscores instead? This is arguably a gtkwave bug. |
I think that would be a weird feature. So you couldn't use
I haven't found a specification for vcd files, specifically for the id/name. Can you help out here? |
The Extended VCD File Format is defined in IEEE 1364-2001 and later revisions, however it doesn't shed much light on this issue. I did find this GTKWave thread about escaping spaces as hex or octal, but the context isn't quite clear. I'd suggest you try that and see what results you get. EDIT: OK I tried it and it doesn't work, also GTKWave gets somewhat cranky about names with backslashes in them (dropping everything before the backslash in the signal view). |
Is it possible to migrate this error to the VCD writer? I'm not sure I agree with whitequark that this is a GTKWave bug exactly, I think it's actually a deficiency in the VCD file format. Throwing from the VCD writer would prevent creating useless VCD files without restricting the names that can be used in nmigen proper. |
I think it would be better to escape spaces when writing vcd files, rather than failing |
I agree but I don't think there's an unambiguous way to do so. In the "foo a" vs "foo_a" example above, what do you do? |
I don't like it when the program does something that I didn't intend to do. As @awygle and me already saying, you are creating two different names but both will have the same name in the end, because the program does something not very obvious. I'm more than willing to raise the error in the vcdwriter. Will have (hopefully) time tomorrow to do that. |
The ValueError will now be raised in the VCDWriter instead, so it catches all variables that contain a space. I think this is the better solution :) |
Thanks for the report and the PR! I've implemented a slightly extended version of the check in 66295fa that covers the grammar recognized by GTKWave, and added a test. |
This testcase will throw an error on gtkwave start:
After this: nmigen will throw this error:
Other character, even non visible, e.g.
\x03
seems fine, only a space\x20
is bad.