Enforce naming rules on core HDL - #1235
Open
tpwrules wants to merge 7 commits into
Open
Conversation
Contributor
Author
|
Apparently having arbitrary FSM state is desirable, so those will be allowed again once #1234 is merged. This will need a patch after then anyway. |
tpwrules
force-pushed
the
identifier-rules
branch
from
March 25, 2024 21:48
a1fbbb2 to
c9a6839
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1235 +/- ##
==========================================
- Coverage 89.87% 89.82% -0.05%
==========================================
Files 43 43
Lines 9992 10008 +16
Branches 2417 2417
==========================================
+ Hits 8980 8990 +10
- Misses 818 822 +4
- Partials 194 196 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
States are not "names" as such and still allowed to be (relatively) arbitrary objects.
tpwrules
force-pushed
the
identifier-rules
branch
from
March 25, 2024 21:54
c9a6839 to
e0bbaca
Compare
whitequark
reviewed
Jun 10, 2024
Member
There was a problem hiding this comment.
My overall feelings about this PR:
- The general approach with the use of
unicodedataseems good. - I don't like having
none_okandempty_ok. There are already complex conditionals around the use of names in multiple places; adding an invisible at the call site complex conditional to this isn't making it easier to understand. - I don't like how the error messages are no longer greppable because they are composed from multiple parts. I've tried to avoid this elsewhere because it makes it harder to figure out exactly where a message comes from if you don't have a backtrace (eg someone stringified an exception, or you just want to find every place where it's mentioned).
- I don't like that "what" is duplicated several times per entity (e.g. "Clock domain name" is independently used 3 times). I think a private class method that would encapsulate all of the naming logic, including what is currently done by
none_okandempty_ok, would do better than the two boolean flags which despite having 4 states reflect 3 possible desired combinations (I don't think we ever want to accept bothNoneand""by the time the validation is called). - I have some uncertainty about whether attributes and instance named parameters/ports should accept Unicode. Especially attributes.
I think for 0.5 I just want the linked issue fixed as a one-off because this PR has too many moving parts that I'm uncertain about.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The rules are quite simple and liberal:
I did not bother updating the deprecated
_memor_recmodules.Pretty much all cases I tried using a name illegal by these rules, it caused a problem somewhere else (e.g. an RTLIL syntax error).
Maybe worth adding some logic to Fragment to catch any cases that slipped through?
Closes #1209