llvm / llvm/circt

[FIRRTL] Instance Choices with Layers Error Out

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

Description

I haven't thought through what should happen here, yet.

Consider the following FIRRTL which contains layerblocks under an instance choice:

``` firrtl
FIRRTL version 4.2.0
circuit Top :
option Target :
X

layer A, bind :

extmodule Foo :

module Bar enablelayer A :

public module Top enablelayer A :

instchoice divider of Foo, Target :
X => Bar

```

When compiled, this errors out with:

```
# firtool Foo.fir
Foo.fir:14:5: error: 'firrtl.instance_choice' op layers must be [@A], but got []
instchoice divider of Foo, Target :
^
Foo.fir:14:5: note: see current operation: "firrtl.instance_choice"() <{annotations = [], caseNames = [@Target::@X], layers = [], moduleNames = [@Foo, @Bar], name = "divider", nameKind = #firrtl, portAnnotations = [], portDirections = array, portNames = []}> : () -> ()
Foo.fir:10:3: note: original module declared here
module Bar enablelayer A :
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the example with firtool and inspect handling of the firrtl.instance_choice operation and its layer metadata. The issue does not define the intended behavior for layerblocks under an instance choice, so first establish that behavior; done means the intended case compiles without this error and the behavior is covered by verification.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.