ReplicationOp constructor Null safety

  1. Logic original,
  2. int _multiplier

Constructs a ReplicationOp

The signal original will be repeated over the _multiplier times as an output. Input _multiplier cannot be negative or zero, an exception will be thrown, otherwise. Module is in-lined as SystemVerilog, it will use {width{bit}}


ReplicationOp(Logic original, this._multiplier)
    : _inputName = Module.unpreferredName('input_${}'),
      _outputName = Module.unpreferredName('output_${}') {
  final newWidth = original.width * _multiplier;
  if (newWidth < 1) {
    throw InvalidMultiplierException(newWidth);

  addInput(_inputName, original, width: original.width);
  addOutput(_outputName, width: original.width * _multiplier);