llvm / llvm/circt

[SV] Move interfaces over to use `InnerNameRef`

Open
#2,189 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Verilog/SystemVerilog
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

The HW and most operations in the SV dialect have moved to the new InnerNameRef-based scheme of declaring symbols that are scoped within the parent module. It would be great if we switched the SV interfaces over to use this scheme as well, and start to introduce a distinction between a "name" that is used for SV emission (as given by the name attribute) and a "symbol" that is used to refer to stuff within the IR (as given by the inner_sym attribute after the change).

Since we are in full control of InnerNameRef, this change would help us avoid some of the pitfalls of the nested symbol tables upstream. Basically, anything that has a sym_name right now (except for the top-level InterfaceOp) would have that attribute replaced with a inner_sym, serving the same purpose. References to stuff in the interface would then be done as #hw.innerNameRef<@InterfaceName::@someSignalSymbol>. That ties the interfaces better into the current "philosophy" of ExportVerilog, and will make it easier to refer to interfaces, their instances, signals, and modports by symbolic name in sv.verbatim operations (e.g. for metadata or script emission that remains stable across renaming and name conflict resolution).

This has the potential to make @teqdruid grumpy!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating SV interface operations and their current sym_name uses, then compare them with existing InnerNameRef-based HW and SV operations. Done means non-top-level interface symbols use inner_sym and references use InnerNameRef while the name attribute remains available for SV emission.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.