Skip to content

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.

2 participants