circt icon indicating copy to clipboard operation
circt copied to clipboard

[HW] Inner symbols dropped by InlineModules

Open uenoku opened this issue 1 year ago • 0 comments

InlineModules pass currently strips inner symbols so it could break design.

$ cat test.mlir
  hw.hierpath @hier [@Foo::@bar, @Bar::@a]
  hw.module private @Bar(in %a : i1 {hw.exportPort = #hw<innerSym@a>}, out b : i1) {
    hw.output %a : i1
  }
  hw.module @Foo(in %a : i1, out b : i1) {
    %bar.b = hw.instance "bar" sym @bar @Bar(a: %a: i1) -> (b: i1)
    hw.output %bar.b : i1
  }

$ circt-opt test.mlir -hw-flatten-modules -hw-verify-irn
test.mlir:1:3: error: 'hw.hierpath' op  module: "Foo" does not contain any instance with symbol: "bar"
  hw.hierpath @hier [@Foo::@bar, @Bar::@a]  
  ^
test.mlir:1:3: note: see current operation: "hw.hierpath"() {namepath = [#hw.innerNameRef<@Foo::@bar>, #hw.innerN

uenoku avatar Apr 30 '24 06:04 uenoku