controlled method
- Logic original, {
- dynamic resetValue,
Returns a (potentially) delayed (by one cycle) version of original
if
delayControlledSignals is true and the clock gating isPresent. This is
the signal that should be used as inputs to logic depending on the
gatedClk.
If a resetValue
is provided, then the signal will be reset to that value
when the clock gating is reset.
Implementation
Logic controlled(Logic original, {dynamic resetValue}) {
if (!isPresent || !delayControlledSignals) {
return original;
}
if (_controlledCache.containsKey(original)) {
return _controlledCache[original]!;
} else {
final o = super.addOutput(
_uniquifier.getUniqueName(initialName: '${original.name}_delayed'));
_controlledCache[original] = o;
o <=
flop(
_freeClk,
reset: _reset,
resetValue: resetValue,
super.addInput(
_uniquifier.getUniqueName(initialName: original.name),
original,
width: original.width,
),
);
return o;
}
}