Parsing Instance Connects Broken
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Connections involving instances fail to parse, but work in the Scala FIRRTL Compiler.
The following currently fails:
```scala
circuit Instance:
module Sub:
output a: UInt<1>
a <= UInt<1>(0)
module Instance:
output a: {a: UInt<1>}
inst sub of Sub
a <= sub
a <- sub
```
The error is:
```
# circt-translate --import-firrtl new/Instance.fir
new/Instance.fir:11:5: error: expected '.' in field reference
a <- sub
^
```
Glancing at the parser, it looks like it expects `sub` to be in the value table, but it isn't. [There is special logic to handle `sub is invalid`](https://github.com/llvm/circt/blob/main/lib/Dialect/FIRRTL/Import/FIRParser.cpp#L1187), but that needs to be extended to handle connections to submodules. If this isn't a `sub is invalid` situation, then the parser expects to see a subfield.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with circt-translate --import-firrtl using the FIRRTL example in the issue. Inspect lib/Dialect/FIRRTL/Import/FIRParser.cpp around the existing “sub is invalid” handling at line 1187, then verify that connections to the submodule parse successfully without the expected-field-reference error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100