PartialProductGenerator constructor
Construct a PartialProductGenerator -- the partial product matrix.
signedMultiplier
generates a fixed signed encoder versus using
selectSignedMultiplier
which is a runtime sign selection Logic
in which case signedMultiplier
must be false.
Implementation
PartialProductGenerator(
Logic multiplicand, Logic multiplier, RadixEncoder radixEncoder,
{this.signedMultiplicand = false,
this.selectSignedMultiplicand,
this.signedMultiplier = false,
this.selectSignedMultiplier,
super.name = 'ppg'}) {
if (signedMultiplier && (selectSignedMultiplier != null)) {
throw RohdHclException('sign reconfiguration requires signed=false');
}
encoder = MultiplierEncoder(multiplier, radixEncoder,
signedMultiplier: signedMultiplier,
selectSignedMultiplier: selectSignedMultiplier);
selector = MultiplicandSelector(radixEncoder.radix, multiplicand,
signedMultiplicand: signedMultiplicand,
selectSignedMultiplicand: selectSignedMultiplicand);
if (multiplicand.width < selector.shift) {
throw RohdHclException('multiplicand width must be greater than '
'or equal to ${selector.shift}');
}
if (multiplier.width < (selector.shift + (signedMultiplier ? 1 : 0))) {
throw RohdHclException('multiplier width must be greater than '
'or equal to ${selector.shift + (signedMultiplier ? 1 : 0)}');
}
_build();
signExtend();
}