Skip to content

[FIRRTL][Inliner] Annotation dropped in presence of both Inline + Flatten annotations #10678

@dtzSiFive

Description

@dtzSiFive

Consider:

firrtl.circuit "Top" {
  hw.hierpath private @nla [@Bar::@baz_inst, @Baz]

  firrtl.module @Top() {
    firrtl.instance foo @Foo()
  }

  firrtl.module private @Foo() {
    firrtl.instance bar @Bar()
  }

  firrtl.module private @Bar() attributes {annotations = [
    {class = "firrtl.passes.InlineAnnotation"},
    {class = "firrtl.transforms.FlattenAnnotation"}
  ]} {
    %baz_port = firrtl.instance baz sym @baz_inst @Baz(in port: !firrtl.uint<1>)
  }

  // Annotation on this port should be preserved on /something/!
  firrtl.module private @Baz(in %port: !firrtl.uint<1> [{circt.nonlocal = @nla, class = "test"}]) { }
}

With circt-opt --firrtl-inliner (1.149.0, 1.144.0, and likely earlier) we produce the following:

module {
  firrtl.circuit "Top" {
    firrtl.module @Top() {
      firrtl.instance foo @Foo()
    }
    firrtl.module private @Foo() {
      %bar_baz_port = firrtl.wire : !firrtl.uint<1>
    }
  }
}

Note that we've dropped the annotation on the wire created for the port.

Expected:

firrtl.module private @Foo() {
  %bar_baz_port = firrtl.wire {annotations = [{class = "test"}]} : !firrtl.uint<1>
}

This affects any module that has both InlineAnnotation and FlattenAnnotation with NLAs rooted at that module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FIRRTLInvolving the `firrtl` dialectbugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions