operator < method

  1. @override
Conditional operator <(
  1. dynamic other
)
override

Conditional assignment operator.

Represents conditionally asigning the value of another signal to this. Returns an instance of ConditionalAssign to be be passed to a Conditional.

Implementation

@override
Conditional operator <(dynamic other) {
  final otherLogic = other is Logic ? other : Const(other, width: width);

  if (otherLogic.width != width) {
    throw SignalWidthMismatchException(otherLogic, width);
  }

  final conditionalAssigns = <Conditional>[];

  var index = 0;
  for (final element in leafElements) {
    conditionalAssigns
        .add(element < otherLogic.getRange(index, index + element.width));
    index += element.width;
  }

  return ConditionalGroup(conditionalAssigns);
}