ofPort static method

PortDirection ofPort(
  1. Logic port
)

Identifies a Module's port into a PortDirection.

Implementation

static PortDirection ofPort(Logic port) {
  if (!port.isPort) {
    throw RohdBridgeException('$port is not a port.');
  }
  return port.isInput
      ? input
      : port.isOutput
          ? output
          : port.isInOut
              ? inOut
              : throw RohdBridgeException('Invalid PortDirection');
}