Skip to content

[FIRRTL] Instance Choices with Layers Error Out #8353

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
seldridge opened this issue Mar 27, 2025 · 1 comment
Open

[FIRRTL] Instance Choices with Layers Error Out #8353

seldridge opened this issue Mar 27, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@seldridge
Copy link
Member

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 seldridge added the bug Something isn't working label Mar 27, 2025
@seldridge
Copy link
Member Author

As @rwy7 has pointed out, the issue here is that the external module does not have a layer enables (and it can't as we haven't defined this). So, therefore this is the same as if you had two instance choice modules where one did not have a layer enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant