connectUpTo method

void connectUpTo(
  1. InterfaceReference<PairInterface> other, {
  2. Set<String>? exceptPorts,
})

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, {Set<String>? exceptPorts}) {
  // 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: exceptPorts);
  other._connectAllPortMaps(exceptPorts: exceptPorts);

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