[firrtl] Improve Initialization Error Messages
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Currently, the errors generated when something is undriven are not awesome. If there is an associated FIRRTL-provided source locator, then the message is terse to the point of not being useful. If there is no source locator (or the source locator is ignored), the input FIRRTL text is then shown, but without enough context (e.g., what module it is) to fix it.
Consider:
```
circuit Foo:
module Foo:
wire w: UInt<1> @[herpderp 42:42]
```
Running this with `firtool`, this produces:
```
herpderp:42:42: error: sink "w" not fully initialized
herpderp:42:42: note: see current operation: %0 = "firrtl.wire"() {annotations = [], name = "w", nameKind = #firrtl} : () -> !firrtl.uint<1>
```
Running with `firtool -ignore-fir-locators`:
```
Foo.fir:4:5: error: sink "w" not fully initialized
wire w: UInt<1> @[herpderp 42:42]
^
Foo.fir:4:5: note: see current operation: %0 = "firrtl.wire"() {annotations = [], name = "w", nameKind = #firrtl} : () -> !firrtl.uint<1>
```
In a perfect world, we would show the line of Chisel that caused the issue, but we don't have that. Just printing a diagnostic that tells you what module it is in would likely be sufficient.
Ideas welcome on what would be better approach to showing this information.
h/t @azidar
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the undriven-sink diagnostic with the FIRRTL example through firtool, both normally and with -ignore-fir-locators. Trace the diagnostic handling from that entry point and determine how to include the containing module; done means the error provides enough module context in both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100