connectUpTo method

void connectUpTo(
  1. InterfaceReference<PairInterface> other
)

Establishes a hierarchical "upward" connection to a parent interface.

Connects this interface to other, where other represents the same interface in the parent module. This sets up the proper signal flow based on the interface role:

  • For provider interfaces: outputs flow up, inputs flow down
  • For consumer interfaces: inputs flow up, outputs flow down
  • Shared and common ports follow interface-specific rules

The other must be on this reference's module's parent.

Implementation

void connectUpTo(InterfaceReference other) {
  // TODO(mkorbel1): remove restriction that it must be adjacent (https://github.com/intel/rohd-bridge/issues/13)
  if (module.parent != other.module) {
    throw RohdBridgeException(
        "The other interface must be on the parent module of this interface's"
        ' module.');
  }

  if (other.internalInterface == null) {
    other._introduceInternalInterface();
  }

  _connectAllPortMaps(exceptPorts: null);
  other._connectAllPortMaps(exceptPorts: null);

  switch (role) {
    case (PairRole.provider):
      other.internalInterface!
        ..receiveOther(interface, const [
          PairDirection.fromProvider,
        ])
        ..driveOther(interface, const [
          PairDirection.fromConsumer,
          PairDirection.sharedInputs,
          PairDirection.commonInOuts,
        ]);
    case (PairRole.consumer):
      other.internalInterface!
        ..receiveOther(interface, const [
          PairDirection.fromConsumer,
        ])
        ..driveOther(interface, const [
          PairDirection.fromProvider,
          PairDirection.sharedInputs,
          PairDirection.commonInOuts,
        ]);
  }
}