circt icon indicating copy to clipboard operation
circt copied to clipboard

[FIRRTL] Instance Choices with Layers Error Out

Open seldridge opened this issue 7 months ago • 1 comments
trafficstars

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

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

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<name_kind interesting_name>, portAnnotations = [], portDirections = array<i1>, portNames = []}> : () -> ()
Foo.fir:10:3: note: original module declared here
  module Bar enablelayer A :

seldridge avatar Mar 27 '25 21:03 seldridge