If a constant wire is marked don't touch and used as the reset initial value, then CIRCT will complain that this is a "non-constant async reset value" during LowerToHW because it relies on IMCP to prove reset value constant-ness and IMCP will correctly not propagate through don't touch.
Consider the following circuit:
circuit ConstantReset:
module ConstantReset:
input clock: Clock
input reset: AsyncReset
input d: UInt<1>
output q: UInt<1>
input x: UInt<1>
wire w: UInt<1>
w <= UInt<1>(0)
reg r: UInt<1>, clock with: (reset => (reset, w))
r <= d
q <= r
When compiled with firtool ConstantReset.fir everything works. If compiled with firtool ConstantReset.fir --annotation-file ConstantReset.anno.json, then this will error out:
ConstantReset.fir:12:5: error: register with async reset requires constant reset value
reg r: UInt<1>, clock with: (reset => (reset, w))
^
ConstantReset.fir:12:5: note: see current operation: %12 = "firrtl.regreset"(%1, %2, %8) {annotations = [], name = "r"} : (!firrtl.clock, !firrtl.asyncreset, !firrtl.uint<1>) -> !firrtl.uint<1>
ConstantReset.fir:9:5: note: reset value defined here:
wire w: UInt<1>
^
SFC will compile wither of these just fine.
As much as it pains me, this likely motivates moving the exact SFC CheckResets logic into RemoveInvalid and turning this into the omnibus SFCExactness pass.
If a constant wire is marked don't touch and used as the reset initial value, then CIRCT will complain that this is a "non-constant async reset value" during
LowerToHW
because it relies on IMCP to prove reset value constant-ness and IMCP will correctly not propagate through don't touch.Consider the following circuit:
And the following annotation file:
When compiled with
firtool ConstantReset.fir
everything works. If compiled withfirtool ConstantReset.fir --annotation-file ConstantReset.anno.json
, then this will error out:SFC will compile wither of these just fine.
As much as it pains me, this likely motivates moving the exact SFC
CheckResets
logic intoRemoveInvalid
and turning this into the omnibus SFCExactness pass.