[FIRRTL][enumcreate] textual IR prints attributes but can't read back
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Consider this input:
```
firrtl.circuit "MatchTest" {
firrtl.module @MatchTest(in %i: !firrtl.enum, None: uint<0>>) attributes {convention = #firrtl} {
%c0_ui8 = firrtl.constant 0 : !firrtl.const.uint<8>
%0 = firrtl.enumcreate Some(%c0_ui8) : (!firrtl.const.uint<8>) -> !firrtl.enum, None: uint<0>>
%some = firrtl.node interesting_name %0 : !firrtl.enum, None: uint<0>>
%c0_ui0 = firrtl.constant 0 : !firrtl.const.uint<0>
%1 = firrtl.enumcreate None(%c0_ui0) : (!firrtl.const.uint<0>) -> !firrtl.enum, None: uint<0>>
%none = firrtl.node interesting_name %1 : !firrtl.enum, None: uint<0>>
}
}
```
Fed through this pipeline:
```
circt-opt --no-implicit-module -p 'firrtl.circuit(firrtl.module(firrtl-lower-matches,firrtl-expand-whens,firrtl-drop-names,canonicalize))' match-test-name.mlir
```
Produces:
```
firrtl.circuit "MatchTest" {
firrtl.module @MatchTest(in %i: !firrtl.enum, None: uint<0>>) attributes {convention = #firrtl} {
%c0_ui0 = firrtl.constant 0 : !firrtl.const.uint<0>
%c0_ui8 = firrtl.constant 0 : !firrtl.const.uint<8>
%0 = firrtl.enumcreate Some(%c0_ui8) attributes {name = "some"} : (!firrtl.const.uint<8>) -> !firrtl.enum, None: uint<0>>
%1 = firrtl.enumcreate None(%c0_ui0) attributes {name = "none"} : (!firrtl.const.uint<0>) -> !firrtl.enum, None: uint<0>>
}
}
```
(names from nodes to go their inputs, cc #7064, I think so that we give nicer names should these becomes name-able things, but regardless)
This IR can't be parsed, failure at `attributes`:
```
:5:41: error: expected ':'
%0 = firrtl.enumcreate Some(%c0_ui8) attributes {name = "some"} : (!firrtl.const.uint<8>) -> !firrtl.enum, None: uint<0>>
```
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 issue with the provided FIRRTL input and circt-opt pipeline, then trace the FIRRTL enumcreate textual parser and printer handling. The fix is done when the printed IR containing enumcreate attributes can be parsed successfully without the reported 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