Skip to content
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

enforce that hdlname/scopename is used consistently with public/private names #4842

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nakengelhardt
Copy link
Member

What are the reasons/motivation for this change?

A number of passes and utilities use code of the shape if(foo->name.isPublic()) { foo->get_hdlname_attribute(); } which doesn't work as expected if the implicit invariant to use hdlname on public objects and scopename on private objects isn't upheld. Since this invariant is easy to break accidentally, enforce it.

Explain how this is achieved.

Add checks in Module::check() to make sure the invariant holds for Module, Wire, Cell, and Memory names. (Should processes also be checked?)

If applicable, please suggest to reviewers how they can test the change.

Run larger flows and examples, and rarely used passes, especially in combination with flatten -scopename.

@nakengelhardt
Copy link
Member Author

There are currently too many cases that don't respect this invariant, so we'll defer the checks for now. We should introduce a group of helpers for copying attributes, which get some context on whether the destination object replaces or duplicates the origin object, and can make sure to handle this kind of invariant under the hood without each pass having to know all the details of attribute semantics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant