createModule method

  1. @override
Module createModule()
override

Creates a Module instance as configured.

Implementation

@override
Module createModule() {
  if (dualPathAdderKnob.value && explicitJBitKnob.value) {
    throw RohdHclException(
      'The dual-path floating-point adder does not support explicit J bits.',
    );
  }

  final a = FloatingPoint(
    exponentWidth: exponentWidthKnob.value,
    mantissaWidth: mantissaWidthKnob.value,
    explicitJBit: explicitJBitKnob.value,
    subNormalAsZero: subNormalAsZeroSelecKnob.denormalAsZeroA.value,
  );
  final b = FloatingPoint(
    exponentWidth: exponentWidthKnob.value,
    mantissaWidth: mantissaWidthKnob.value,
    explicitJBit: explicitJBitKnob.value,
    subNormalAsZero: subNormalAsZeroSelecKnob.denormalAsZeroB.value,
  );
  final outSum = outputWidthSelectKnob.differentWidthOutput.value
      ? FloatingPoint(
          exponentWidth: outputWidthSelectKnob.exponentWidthKnob.value,
          mantissaWidth: outputWidthSelectKnob.mantissaWidthKnob.value,
          explicitJBit: outputWidthSelectKnob.explicitJBitKnob.value,
          subNormalAsZero: subNormalAsZeroSelecKnob.flushToZero.value,
        )
      : FloatingPoint(
          exponentWidth: exponentWidthKnob.value,
          mantissaWidth: mantissaWidthKnob.value,
          explicitJBit: explicitJBitKnob.value,
          subNormalAsZero: subNormalAsZeroSelecKnob.flushToZero.value,
        );

  return dualPathAdderKnob.value
      ? FloatingPointAdderDualPath(
          clk: pipelinedKnob.value ? Logic() : null,
          a,
          b,
          outSum: outSum,
          subtract: dualPathSubtractInputKnob.value
              ? Logic(name: 'subtract')
              : null,
          roundingMode: roundingModeKnob.value,
          adderGen: adderSelectionKnob.selectedAdder(),
          ppTree: treeGeneratorMap[prefixTreeKnob.value]!,
          definitionName: 'FloatingPointAdderDualPath',
        )
      : FloatingPointAdderSinglePath(
          clk: pipelinedKnob.value ? Logic() : null,
          a,
          b,
          outSum: outSum,
          roundingMode: roundingModeKnob.value,
          adderGen: adderSelectionKnob.selectedAdder(),
          definitionName: 'FloatingPointAdderSinglePath',
        );
}