llvm / circt

Circuit IR Compilers and Tools
https://circt.org
Other
1.64k stars 285 forks source link

[SimToSV] Lowering fails if a DPI call result is consumed by another #7191

Closed uenoku closed 3 months ago

uenoku commented 3 months ago
  sim.func.dpi private @increment_counter(in %in_0 : i64, out out_0 : i32) attributes {verilogName = "increment_counter"}
  sim.func.dpi private @create_counter(out out_0 : i64) attributes {verilogName = "create_counter"}
  hw.module @DPITest(in %clock: !seq.clock, out result : i32) {
    %0 = sim.func.dpi.call @create_counter() : () -> i64
    %1 = sim.func.dpi.call @increment_counter(%0) : (i64) -> i32
    hw.output %1: i32
  }
      * Pattern : 'sim.func.dpi.call -> ()' {
      } -> FAILURE : pattern was already applied
    } -> FAILURE : no matched legalization pattern
    //===-------------------------------------------===//
  } -> FAILURE : failed to legalize operation updated in-place 'sim.func.dpi.call'
} -> FAILURE : pattern failed to match
} -> FAILURE : no matched legalization pattern
//===-------------------------------------------===//
tmp.mlir:5:10: error: failed to legalize operation 'sim.func.dpi.call' that was explicitly marked illegal
    %0 = sim.func.dpi.call @create_counter() : () -> i64