fabric.py

class fabric_generator.fabric.Bel(src: str, prefix: str, internal, external, configPort, sharedPort, configBit: int, belMap: Dict[str, dict], userCLK: bool)

Contains all the information about a single BEL. The information is parsed from the directory of the BEL in the CSV definition file. There are something to be noted.

  • The parsed name will contains the prefix of the bel.

  • The sharedPort attribute is a list of Tuples with name of the port and IO information which is not expanded out yet.

  • If a port is marked as both shared and external, the port is considered as shared. As a result signal like UserCLK will be in shared port list, but not in external port list.

src

The source directory of the BEL given in the CSV file.

Type

str

prefix

The prefix of the BEL given in the CSV file.

Type

str

name

The name of the BEL, extracted from the source directory.

Type

str

inputs

All the normal input ports of the BEL.

Type

list[str]

outputs

All the normal output ports of the BEL.

Type

list[str]

externalInput

ALL the external input ports of the BEL.

Type

list[str]

externalOutput

(List[str]) : All the external output ports of the BEL.

Type

List[str]

configPort

All the config ports of the BEL.

Type

List[str]

sharedPort

All the shared ports of the BEL.

Type

List[Tuple[str, IO]]

configBit

The number of config bits of the BEL have.

Type

int

belFeatureMap

The feature map of the BEL.

Type

Dict[str, dict]

withUserCLK

Whether the BEL has userCLK port. Default is False.

Type

bool

class fabric_generator.fabric.ConfigBitMode(value)

An enumeration.

class fabric_generator.fabric.ConfigMem(frameName: str, frameIndex: int, bitsUsedInFrame: int, usedBitMask: str, configBitRanges: List[int] = <factory>)

Data structure to store the information about a config memory. Each structure represent a row of entry in the config memory csv file.

frameName

The name of the frame

Type

str

frameIndex

The index of the frame

Type

int

bitUsedInFrame

The number of bits used in the frame

Type

int

usedBitMask

The bit mask of the bits used in the frame

Type

int

configBitRanges

A list of config bit mapping values

Type

List[int]

class fabric_generator.fabric.Direction(value)

An enumeration.

class fabric_generator.fabric.Fabric(tile: List[List[fabric_generator.fabric.Tile]] = <factory>, name: str = 'eFPGA', numberOfRows: int = 15, numberOfColumns: int = 15, configBitMode: fabric_generator.fabric.ConfigBitMode = ConfigBitMode.FRAME_BASED, frameBitsPerRow: int = 32, maxFramesPerCol: int = 20, package: str = 'use work.my_package.all', generateDelayInSwitchMatrix: int = 80, multiplexerStyle: fabric_generator.fabric.MultiplexerStyle = MultiplexerStyle.CUSTOM, frameSelectWidth: int = 5, rowSelectWidth: int = 5, desync_flag: int = 20, numberOfBRAMs: int = 10, superTileEnable: bool = True, tileDic: Dict[str, fabric_generator.fabric.Tile] = <factory>, superTileDic: Dict[str, fabric_generator.fabric.SuperTile] = <factory>, commonWirePair: List[Tuple[str, str]] = <factory>)

This class is for storing the information and hyper parameter of the fabric. All the information is parsed from the CSV file.

tile

The tile map of the fabric

Type

List[List[Tile]]

name

The name of the fabric

Type

str

numberOfRow

The number of row of the fabric

Type

int

numberOfColumn

The number of column of the fabric

Type

int

configMitMode

The configuration bit mode of the fabric. Currently support frame based or ff chain

Type

ConfigBitMode

frameBitsPerRow

The number of frame bits per row of the fabric

Type

int

maxFramesPerCol

The maximum number of frames per column of the fabric

Type

int

package

The extra package used by the fabric. Only useful for VHDL output.

Type

str

generateDelayInSwitchMatrix

The amount of delay in a switch matrix.

Type

int

multiplexerStyle

The style of the multiplexer used in the fabric. Currently support custom or generic

Type

MultiplexerStyle

frameSelectWidth

The width of the frame select signal.

Type

int

rowSelectWidth

The width of the row select signal.

Type

int

desync_flag
Type

int

numberOfBRAMs

The number of BRAMs in the fabric.

Type

int

superTileEnable

Whether the fabric has super tile.

Type

bool

tileDic

A dictionary of tiles used in the fabric. The key is the name of the tile and the value is the tile.

Type

Dict[str, Tile]

superTileDic

A dictionary of super tiles used in the fabric. The key is the name of the super tile and the value is the super tile.

Type

Dict[str, SuperTile]

__post_init__() None

Generate all the wire pair in the fabric and get all the wire in the fabric. The wire pair are used during model generation when some of the signals have source or destination of “NULL”. The wires are used during model generation to work with wire that going cross tile.

class fabric_generator.fabric.IO(value)

An enumeration.

class fabric_generator.fabric.MultiplexerStyle(value)

An enumeration.

class fabric_generator.fabric.Port(wireDirection: fabric_generator.fabric.Direction, sourceName: str, xOffset: int, yOffset: int, destinationName: str, wireCount: int, name: str, inOut: fabric_generator.fabric.IO, sideOfTile: fabric_generator.fabric.Side)

The port data class contains all the port information from the CSV file. The name, inOut and sideOfTile are added attributes to aid the generation of the fabric. The name and inOut are related. If the inOut is “INPUT” 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 sideOfTile is where the port physically located on the tile, since for a north direction wire, the input will be physical located on the south side of the tile. The sideOfTile will make determine where the port is located much easier.

wireDirection

The direction attribute in the CSV file

Type

Direction

sourceName

The source_name attribute in the CSV file

Type

str

xOffset

The X-offset attribute in the CSV file

Type

int

yOffset

The Y-offset attribute in the CSV file

Type

int

destinationName

The destination_name attribute in the CSV file

Type

str

wireCount

The wires attribute in the CSV file

Type

int

name

The name of the port

Type

str

inOut

The IO direction of the port

Type

IO

sideOfTile

The side which the port is physically located on the tile

Type

Side

expandPortInfo(mode='SwitchMatrix') Tuple[List[str], List[str]]

Expanding the port information to 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.

Return type

Tuple[List[str], List[str]]

class fabric_generator.fabric.Side(value)

An enumeration.

class fabric_generator.fabric.SuperTile(name: str, tiles: List[fabric_generator.fabric.Tile], tileMap: List[List[fabric_generator.fabric.Tile]], bels: List[fabric_generator.fabric.Bel] = <factory>, withUserCLK: bool = False)

This class is for storing the information about a super tile.

name

The name of the super tile

Type

str

tiles

The list of tiles of that build the super tile

Type

List[Tile]

tileMap

The map of the tiles of which build the super tile

Type

List[List[Tile]]

bels

The list of bels of that the super tile have

Type

List[Bel]

withUserCLK

Whether the super tile has userCLK port. Default is False.

Type

bool

getInternalConnections() List[Tuple[List[fabric_generator.fabric.Port], int, int]]

Return all the internal connections of the super tile.

Returns

A list of tuple which contains the internal connected port and the

x and y coordinate of the tile.

Return type

List[Tuple[List[Port], int, int]]

getPortsAroundTile() Dict[str, List[List[fabric_generator.fabric.Port]]]

Return all the ports that are around the super tile. The dictionary key is the location of where the tile located in the super tile map with the format of “X{x}Y{y}” where x is the x coordinate of the tile and y is the y coordinate of the tile. The top left tile will have key “00”.

Returns

The dictionary of the ports around the super tile

Return type

Dict[str, List[List[Port]]]

class fabric_generator.fabric.Tile(name: str, ports: List[fabric_generator.fabric.Port], bels: List[fabric_generator.fabric.Bel], matrixDir: str, userCLK: bool, configBit: int = 0)

This class is for storing the information about a tile.

name

The name of the tile

Type

str

portsInfo

The list of ports of the tile

Type

List[Port]

matrixDir

The directory of the tile matrix

Type

str

globalConfigBits

The number of config bits the tile have

Type

int

withUserCLK

Whether the tile has userCLK port. Default is False.

Type

bool

wireList

The list of wires of the tile

Type

List[Wire]

filePath

The path of the matrix file

Type

str

class fabric_generator.fabric.Wire(direction: fabric_generator.fabric.Direction, source: str, xOffset: int, yOffset: int, destination: str, sourceTile: str, destinationTile: str)

This class is for wire connection that span across multiple tiles. If working for connection between two adjacent tiles, the Port class should have all the required information. The main use of this class is to assist model generation, where information at individual wire level is needed.

direction

The direction of the wire

Type

Direction

source

The source name of the wire

Type

str

xOffset

The X-offset of the wire

Type

int

yOffset

The Y-offset of the wire

Type

int

destination

The destination name of the wire

Type

str

sourceTile

The source tile name of the wire

Type

str

destinationTile

The destination tile name of the wire

Type

str