port¶
Port definition module for FPGA fabric.
This module contains the Port class, which represents a connection point on a tile
in the FPGA fabric. Ports define the physical and logical characteristics of wires
entering or leaving a tile, including their direction, source and destination names,
offsets, and wire counts. These definitions are typically parsed from a CSV file
that describes the fabric architecture.
Classes¶
Store all the port information defined in the CSV file. |
Module Contents¶
Port¶
- class Port[source]¶
Store all the port information defined in the CSV file.
The
name,inOutandsideOfTileare added attributes to aid the generation of the fabric.The
nameandinOutare related. If theinOutisINPUT, then the name is the source name of the port on the tile. Otherwise, the name is the destination name of the port on the tile.The
sideOfTiledefines where the port is physically located on the tile, since for a north direction wire, the input will be physically located on the south side of the tile. ThesideOfTilewill make determining where the port is located much easier.- Variables:
wireDirection (Direction) â The direction attribute in the CSV file
sourceName (str) â The source_name attribute in the CSV file
xOffset (int) â The X-offset attribute in the CSV file
yOffset (int) â The Y-offset attribute in the CSV file
destinationName (str) â The destination_name attribute in the CSV file
wireCount (int) â The wires attribute in the CSV file
name (str) â The name of the port
inOut (IO) â The IO direction of the port
sideOfTile (Side) â The side on which the port is physically located in the tile
Methods¶
- expandPortInfo(mode='SwitchMatrix') tuple[list[str], list[str]][source]¶
Expand the port information to the individual bit signal.
If âIndexedâ is in the mode, then brackets are added to the signal name.
- Parameters:
mode (str, optional) â Mode for expansion. Defaults to âSwitchMatrixâ. Possible modes are âallâ, âallIndexedâ, âTopâ, âTopIndexedâ, âAutoTopâ, âAutoTopIndexedâ, âSwitchMatrixâ, âSwitchMatrixIndexedâ, âAutoSwitchMatrixâ, âAutoSwitchMatrixIndexedâ
- Returns:
A tuple of two lists. The first list contains the source names of the ports and the second list contains the destination names of the ports.
- expandPortInfoByName(indexed=False, prefix='', escape=False) list[str][source]¶
Expand port information to individual wire names.
Generates a list of individual wire names for this port, accounting for wire count and offset calculations. For termination ports (NULL), the wire count is multiplied by the Manhattan distance.
- Parameters:
indexed (bool, optional) â If True, wire names use bracket notation (e.g.,
port[0]). If False, wire names use simple concatenation (e.g.,port0). Defaults to False.prefix (str, optional) â A prefix to prepend to the port name, by default ââ.
escape (bool, optional) â If True, escape special characters in the port names (e.g., for regex), by default False.
- Returns:
List of individual wire names for this port.
- expandPortInfoByNameTop(indexed=False, prefix='', escape=False) list[str][source]¶
Expand port information for top-level connections.
Similar to expandPortInfoByName but specifically for top-level tile connections. The start index is calculated differently to handle the top slice of wires for routing fabric connections.
- Parameters:
indexed (bool, optional) â If True, wire names use bracket notation (e.g.,
port[0]). If False, wire names use simple concatenation (e.g.,port0). Defaults to False.prefix (str, optional) â A prefix to prepend to the port name, by default ââ.
escape (bool, optional) â If True, escape special characters in the port names (e.g., for regex), by default False.
- Returns:
List of individual wire names for top-level connections.