Counter.simple constructor

Counter.simple({
  1. required Logic clk,
  2. required Logic reset,
  3. int by = 1,
  4. Logic? enable,
  5. int minValue = 0,
  6. int? maxValue,
  7. int? width,
  8. Logic? restart,
  9. bool saturates = false,
  10. bool increments = true,
  11. int resetValue = 0,
  12. String name = 'counter',
})

A simplified constructor for Counter that accepts a single fixed amount to count by (up or down based on increments) along with much of the other available configuration in the default Counter constructor.

Implementation

Counter.simple({
  required Logic clk,
  required Logic reset,
  int by = 1,
  Logic? enable,
  int minValue = 0,
  int? maxValue,
  int? width,
  Logic? restart,
  bool saturates = false,
  bool increments = true,
  int resetValue = 0,
  String name = 'counter',
}) : this([
        SumInterface(
            width: width,
            fixedAmount: by,
            hasEnable: enable != null,
            increments: increments)
          ..enable?.gets(enable!),
      ],
          clk: clk,
          reset: reset,
          resetValue: resetValue,
          restart: restart,
          maxValue: maxValue,
          minValue: minValue,
          width: width,
          saturates: saturates,
          name: name);