PortReference.fromString constructor

PortReference.fromString(
  1. BridgeModule module,
  2. String portRef
)

Creates a PortReference from a BridgeModule and a port reference string.

The portRef string can be either a simple port name (e.g., "myPort") or include slicing/indexing (e.g., "myPort3:0", "myPort5").

Returns either a StandardPortReference for simple names or a SlicePortReference for complex port access patterns.

Implementation

factory PortReference.fromString(BridgeModule module, String portRef) {
  if (SlicePortReference._isSliceAccess(portRef)) {
    return SlicePortReference.fromString(module, portRef);
  }

  if (StandardPortReference._isStandardAccess(portRef)) {
    return StandardPortReference(module, portRef);
  }

  throw RohdBridgeException('Invalid port access string: $portRef');
}