Skip to content

hierarchy: refactor#5821

Draft
widlarizer wants to merge 4 commits into
mainfrom
emil/refactor-hierarchy
Draft

hierarchy: refactor#5821
widlarizer wants to merge 4 commits into
mainfrom
emil/refactor-hierarchy

Conversation

@widlarizer
Copy link
Copy Markdown
Collaborator

Chop up hierarchy.cc into digestible pieces. Required for improving hierarchy with signorm (#5804) later. If I wanted to be consistent with opt_clean refactoring, I would have to create a directory at passes/hierarchy/hierarchy/, so it's passes/hierarchy/util/ for now. No public interfaces were harmed

@widlarizer
Copy link
Copy Markdown
Collaborator Author

It's interesting to note that almost all of the complexity of hierarchy comes from the fact that it has to handle langauge features. It's a deferred phase of elaboration, but there is zero separation. Load-bearing attributes are just glued onto RTLIL instead of proper modeling. Another direct consequence of having a simple pass interface for scripting - frontends should call into hierarchy or the other way around in some way, rather than hierarchy etc uncontrollably accumulating this flotsam

@whitequark
Copy link
Copy Markdown
Member

I hope the RPC frontend could also be better integrated into the flow after the refactor.

@widlarizer
Copy link
Copy Markdown
Collaborator Author

@whitequark What would making it better for RPC entail?

@widlarizer widlarizer force-pushed the emil/refactor-hierarchy branch from eb8ba41 to 1b07985 Compare April 21, 2026 20:16
@whitequark
Copy link
Copy Markdown
Member

What would making it better for RPC entail?

It's been a few years, but I remember that the RPC frontend had to plug into hierarchy and it was kind of a pain to adapt it for the elaboration hook intended for read_verilog. One issue was that it had to mangle names of everything returned by the frontend to avoid name collisions. Perhaps a cleaner implementation of hierarchy would make this less painful, seeing as this is morally something best done in hierarchy so all the metadata could be updated, etc.

@widlarizer widlarizer force-pushed the emil/refactor-hierarchy branch from 1b07985 to 2032930 Compare April 21, 2026 20:45
@widlarizer
Copy link
Copy Markdown
Collaborator Author

[sc-497]

@widlarizer widlarizer marked this pull request as draft April 24, 2026 20:18
@widlarizer widlarizer force-pushed the emil/refactor-hierarchy branch from 2032930 to c4c8681 Compare May 5, 2026 17:00
@widlarizer widlarizer force-pushed the emil/refactor-hierarchy branch from c4c8681 to 343538b Compare May 5, 2026 17:05
@widlarizer
Copy link
Copy Markdown
Collaborator Author

The CI went green with tests skipped, how? Usually I run tests locally since my machine outruns the runners, but I skipped that for a draft refactor and went on when I saw green... Weird

@widlarizer
Copy link
Copy Markdown
Collaborator Author

The part that I'm interested in (checking port directionality correctness) is apparently intertwined with the systemverilog interface resolution code. I'm interested in it because I want to later add directional resolution for signorm $connect cells, and it's not a great idea to take more passes through the design needlessly, even if that would be a clean way to separate systemverilog from fundamental hierarchy logic

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