condFlop function
Conditionally constructs a positive edge triggered flip condFlop on clk
.
It returns either FlipFlop.q if clk
is non-null or d
if not.
When the optional en
is provided, an additional input will be created for
condFlop. If optional en
is high or not provided, output will vary as per
inputd
. For low en
, output remains frozen irrespective of input d
.
- When the optional
reset
is provided, the condFlop will be reset (active-high). - If no
resetValue
is provided, the reset value is always0
. Otherwise, it will reset to the providedresetValue
. - If
asyncReset
is true, thereset
signal (if provided) will be treated as an async reset. IfasyncReset
is false, the reset signal will be treated as synchronous.
Implementation
Logic condFlop(
Logic? clk,
Logic d, {
Logic? en,
Logic? reset,
dynamic resetValue,
bool asyncReset = false,
}) =>
(clk == null)
? d
: flop(clk, d,
en: en,
reset: reset,
resetValue: resetValue,
asyncReset: asyncReset)
.named('${d.name}_flopped');