port method

PortReference port(
  1. String portRefString
)

Creates a port reference from a string representation with advanced parsing.

This method handles both simple ports and complex port references including:

  • Simple port names: "clk", "reset_n"
  • Bit ranges and indices: "data7:0", "addr5"
  • Struct member access: "mystruct.field" (using structMap lookup)
  • Renamed ports: automatically resolves to original port names

For struct ports (containing '.'), the method looks up the actual bit slice in structMap. For renamed ports, it automatically resolves to the original port name while preserving any range specification.

Returns a PortReference that can be used for connections and operations.

Throws an Exception if the port access string is invalid or the port is not found.

Implementation

PortReference port(String portRefString) =>
    tryPort(portRefString) ??
    (throw RohdBridgeException('Port $portRefString not found in $name'));