MutiplyOnly constructor

MutiplyOnly(
  1. Logic a,
  2. Logic b,
  3. Logic c,
  4. Multiplier multiplyGenerator(
    1. Logic a,
    2. Logic b
    ), {
  5. bool signed = false,
})

Construct a MultiplyAccumulate that only multiplies to enable using the same tester with zero accumulate addend c.

Implementation

MutiplyOnly(super.a, super.b, super.c,
    Multiplier Function(Logic a, Logic b) multiplyGenerator,
    {super.signed = false}) // Will be overrwridden by multiplyGenerator
    : super(name: 'Multiply Only: ${multiplyGenerator.call(a, b).name}') {
  final accumulate = addOutput('accumulate', width: a.width + b.width + 1);

  final multiply = multiplyGenerator(a, b);
  signed = multiply.signed;

  accumulate <=
      (signed
          ? [multiply.product[multiply.product.width - 1], multiply.product]
              .swizzle()
          : multiply.product.zeroExtend(accumulate.width));
}