llvm / llvm/circt

[FIRRTL] Disabling an enabled layer on the main module can trip the verifier

Open
#8,816 3 comments 1 reaction 0 assignees View on GitHub
bug FIRRTL
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

Consider the following circuit:

``` firrtl
FIRRTL version 5.2.0
circuit Foo:
layer A, bind:
public module Foo enablelayer A:
```

If this is compiled with the option to disable `layer A`, then the main module is deleted and the circuit is invalid:

```
# firtool Foo.fir -disable-layers=A
Foo.fir:2:1: error: 'firrtl.circuit' op does not contain module with same name as circuit
circuit Foo:
^
Foo.fir:2:1: note: see current operation:
"firrtl.circuit"() <{annotations = [], name = "Foo"}> ({
^bb0:
}) : () -> ()
```

If the circuit continues to require that there exists a main module in it with the same name, then this should produce a better error. However, I think the better approach is likely to not require a main module.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the verifier failure with the FIRRTL circuit shown in the issue using `firtool Foo.fir -disable-layers=A`. Start by tracing firtool's handling of disabled layers and the requirement that a circuit contain a same-named main module. Done means the case either remains valid without that module or produces a clearer diagnostic, depending on the chosen behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
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.