llvm / circt

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

[FIRRTL] InferResets: extmodules should not be allowed to have abstract resets #7275

Open youngar opened 3 months ago

youngar commented 3 months ago

The type of reset inferred for a module port changes the implementation of any register which uses it. Since extmodules are separately compiled modules from other circuits, it does not make sense that the reset could be inferred. We already have a verifier that public modules do not have uninferred reset types, so there should be no reason to allow this.

FIRRTL version 4.0.0
circuit Foo:
  public module Foo:
    input sync : UInt<1>

    inst bar of Bar
    connect bar.r, sync

  extmodule Bar:
    input r : Reset

compiles fine and Bar.r is inferred to be a synchronous reset.

dtzSiFive commented 3 months ago

cc https://github.com/chipsalliance/firrtl-spec/pull/181, https://github.com/llvm/circt/pull/7248