GatedCounter constructor
- List<
SumInterface> interfaces, { - required Logic clk,
- required Logic reset,
- Logic? restart,
- dynamic resetValue = 0,
- dynamic maxValue,
- dynamic minValue = 0,
- int? width,
- bool saturates = false,
- bool gateToggles = true,
- ClockGateControlInterface? clockGateControlInterface,
- int? clkGatePartitionIndex,
- String name = 'counter',
Constructs a GatedCounter in the same way as a Counter, but with the
added ability to gateToggles
of the interfaces when they are not enabled
and gate the clocks of the counter in a partitioned way.
Clock gating is performed on the same cycle as the increment/decrement(s), so the functionality when compared to the base Counter is identical with no added latency to the count.
The clkGatePartitionIndex
is the index at which to partition the counter
for clock gating. If the clkGatePartitionIndex
is less than 0 or greater
than the width
, then the entire counter will be gated together rather
than partitioned. If no clkGatePartitionIndex
is provided, the counter
will attempt to infer a good partition index based on the interfaces
provided.
Implementation
GatedCounter(
super.interfaces, {
required super.clk,
required super.reset,
super.restart,
super.resetValue,
super.maxValue,
super.minValue,
super.width,
super.saturates,
this.gateToggles = true,
ClockGateControlInterface? clockGateControlInterface,
int? clkGatePartitionIndex,
super.name,
}) : _providedClkGateParitionIndex = clkGatePartitionIndex,
_clockGateControlInterface = clockGateControlInterface == null
? null
: ClockGateControlInterface.clone(clockGateControlInterface) {
_clockGateControlInterface?.pairConnectIO(
this, clockGateControlInterface!, PairRole.consumer);
}