execute method Null safety

  1. @override
void execute(
  1. Set<Logic> drivenSignals
)
override

Executes the functionality of this Conditional and populates drivenSignals with all Logics that were driven during execution.

The drivenSignals are used by the caller to determine if signals were driven an appropriate number of times.

Implementation

@override
void execute(Set<Logic> drivenSignals) {
  if (driverValue(condition)[0] == LogicValue.one) {
    for (final conditional in then) {
      conditional.execute(drivenSignals);
    }
  } else if (driverValue(condition)[0] == LogicValue.zero) {
    for (final conditional in orElse) {
      conditional.execute(drivenSignals);
    }
  } else {
    // x and z propagation
    for (final receiver in getReceivers()) {
      receiverOutput(receiver).put(driverValue(condition)[0]);
      if (!drivenSignals.contains(receiver) || receiver.value.isValid) {
        drivenSignals.add(receiver);
      }
    }
  }
}