createModule method

  1. @override
Module createModule()
override

Creates a Module instance as configured.

Implementation

@override
Module createModule() {
  final sumIntfs = sumInterfaceKnobs.knobs
      .map((e) => e as SumInterfaceKnob)
      .map((e) => SumInterface(
            hasEnable: e.hasEnableKnob.value,
            fixedAmount:
                e.isFixedValueKnob.value ? e.fixedValueKnob.value : null,
            width: e.widthKnob.value,
            increments: e.incrementsKnob.value,
          ))
      .toList();

  if (clockGatingKnob.value) {
    return GatedCounter(
      sumIntfs,
      resetValue: resetValueKnob.value,
      width: widthKnob.value,
      minValue: minValueKnob.value,
      maxValue: maxValueKnob.value,
      saturates: saturatesKnob.value,
      clk: Logic(),
      reset: Logic(),
      clkGatePartitionIndex: clockGatingPartitionIndexKnob.value,
      gateToggles: gateTogglesKnob.value,
    );
  } else {
    return Counter(
      sumIntfs,
      resetValue: resetValueKnob.value,
      width: widthKnob.value,
      minValue: minValueKnob.value,
      maxValue: maxValueKnob.value,
      saturates: saturatesKnob.value,
      clk: Logic(),
      reset: Logic(),
    );
  }
}