PartialProductGenerator constructor

PartialProductGenerator(
  1. Logic multiplicand,
  2. Logic multiplier,
  3. RadixEncoder radixEncoder, {
  4. bool signed = false,
  5. Logic? selectSigned,
})

Construct a PartialProductGenerator -- the partial product matrix

Implementation

PartialProductGenerator(
    Logic multiplicand, Logic multiplier, RadixEncoder radixEncoder,
    {this.signed = false, this.selectSigned}) {
  if (signed && (selectSigned != null)) {
    throw RohdHclException('sign reconfiguration requires signed=false');
  }
  encoder = MultiplierEncoder(multiplier, radixEncoder,
      selectSigned: selectSigned, signed: signed);
  selector = MultiplicandSelector(radixEncoder.radix, multiplicand,
      selectSigned: selectSigned, signed: signed);

  if (multiplicand.width < selector.shift) {
    throw RohdHclException('multiplicand width must be greater than '
        '${selector.shift}');
  }
  if (multiplier.width < (selector.shift + (signed ? 1 : 0))) {
    throw RohdHclException('multiplier width must be greater than '
        '${selector.shift + (signed ? 1 : 0)}');
  }
  _build();
  signExtend();
}