Ripple<T extends Logic> constructor

Ripple<T extends Logic>(
  1. List<T> inps,
  2. T op(
    1. T left,
    2. T right
    ), {
  3. bool reserveName = false,
  4. bool reserveDefinitionName = false,
  5. String? definitionName,
})

Ripple constructor.

Implementation

Ripple(List<T> inps, T Function(T left, T right) op,
    {super.reserveName, super.reserveDefinitionName, String? definitionName})
    : super(definitionName: definitionName ?? 'Ripple', inps, 'ripple') {
  final iseq = <T>[];

  inps.forEachIndexed((i, el) {
    final input = addTypedInput('i$i', el);
    iseq.add(input);
    _oseq.add(addTypedOutput('o$i', input.cloneTyped));
  });

  for (var i = 0; i < iseq.length; ++i) {
    if (i == 0) {
      _oseq[i] <= iseq[i];
    } else {
      _oseq[i] <= _combine(_oseq[i - 1], iseq[i], op);
    }
  }
}