Counter.ofLogics constructor

Counter.ofLogics(
  1. List<Logic> logics, {
  2. required Logic clk,
  3. required Logic reset,
  4. Logic? restart,
  5. dynamic resetValue = 0,
  6. dynamic maxValue,
  7. dynamic minValue = 0,
  8. Logic? enable,
  9. int? width,
  10. bool saturates = false,
  11. String name = 'counter',
})

Creates a Counter that counts up by all of the provided logics, including much of the other available configuration in the default constructor.

All logics are always incrementing and controlled optionally by a single enable.

Implementation

factory Counter.ofLogics(
  List<Logic> logics, {
  required Logic clk,
  required Logic reset,
  Logic? restart,
  dynamic resetValue = 0,
  dynamic maxValue,
  dynamic minValue = 0,
  Logic? enable,
  int? width,
  bool saturates = false,
  String name = 'counter',
}) =>
    Counter(
      logics
          .map((e) => SumInterface(width: e.width, hasEnable: enable != null)
            ..amount.gets(e)
            ..enable?.gets(enable!))
          .toList(),
      clk: clk,
      reset: reset,
      resetValue: resetValue,
      maxValue: maxValue,
      minValue: minValue,
      width: width,
      saturates: saturates,
      restart: restart,
      name: name,
    );