CompressionTreeMultiplier constructor
Construct a compression tree integer multiplier with a given radix
and prefix tree functor ppTree
for the compressor and final adder.
a
and b
are the product terms and they can be different widths
allowing for rectangular multiplication.
signed parameter configures the multiplier as a signed multiplier (default is unsigned).
Optional selectSigned
allows for runtime configuration of signed
or unsigned operation, overriding the signed static configuration.
Implementation
CompressionTreeMultiplier(super.a, super.b, int radix,
{Logic? selectSigned,
ParallelPrefix Function(List<Logic>, Logic Function(Logic, Logic))
ppTree = KoggeStone.new,
super.signed = false,
super.name = 'compression_tree_multiplier'}) {
if (selectSigned != null) {
selectSigned = addInput('selectSigned', selectSigned);
}
final product = addOutput('product', width: a.width + b.width);
final pp = PartialProductGeneratorCompactRectSignExtension(
a, b, RadixEncoder(radix),
selectSigned: selectSigned, signed: signed);
final compressor = ColumnCompressor(pp)..compress();
final adder = ParallelPrefixAdder(
compressor.extractRow(0), compressor.extractRow(1),
ppGen: ppTree);
product <= adder.sum.slice(a.width + b.width - 1, 0);
}