GatedCounter constructor

GatedCounter(
  1. List<SumInterface> interfaces, {
  2. required Logic clk,
  3. required Logic reset,
  4. Logic? restart,
  5. dynamic resetValue = 0,
  6. dynamic maxValue,
  7. dynamic minValue = 0,
  8. int? width,
  9. bool saturates = false,
  10. bool gateToggles = true,
  11. ClockGateControlInterface? clockGateControlInterface,
  12. int? clkGatePartitionIndex,
  13. 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);
}