llvm / circt

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

[FIRRTL] Instance cycle - diagnose, don't crash #7165

Open dtzSiFive opened 2 weeks ago

dtzSiFive commented 2 weeks ago

Example:

FIRRTL version 4.0.0

circuit Cyclic:
  public module Cyclic:
    inst f of Foo

  module Foo:
    inst c of Cyclic

Infer Resets presently overflows its stack recursing. Skipping that, we produce:

// Generated by CIRCT firtool-1.76.0-22-g0b5534b31
module Cyclic();
  Foo f ();
endmodule

module Foo();
  Cyclic c ();
endmodule

Producing a diagnostic would be a good improvement.