fabric_gen.py

class fabric_generator.fabric_gen.FabricGenerator(fabric: fabric_generator.fabric.Fabric, writer: fabric_generator.code_generator.codeGenerator)

This class contains all the function require to generate a fabric from csv files to RTL file. To use the class the information will need to be parsed first using the function from file_parser.py.

fabric

The parsed fabric object from CSV definition files

Type

Fabric

writer

The code generator object to write the RTL files

Type

codeGenerator

static CSV2list(InFileName: str, OutFileName: str) None

this function is export a given CSV switch matrix description into its equivalent list description

Parameters
  • InFileName (str) – The input file name of the CSV file

  • OutFileName (str) – The directory of the list file to be written

static bootstrapSwitchMatrix(tile: fabric_generator.fabric.Tile, outputDir: str) None

Generates a blank switch matrix csv file for the given tile. The top left corner will contain the name of the tile. Columns are the source signals and rows are the destination signals. The order of the signal will be: * standard wire * BEL signal with prefix * jump wire

The order is important as this order will be used during switch matrix generation

Parameters
  • tile (Tile) – The tile to generate the switch matrix for

  • outputDir (str) – The output directory to write the switch matrix to

genTileSwitchMatrix(tile: fabric_generator.fabric.Tile) None

This function will generate the RTL code for the tile switch matrix of the given tile. The switch matrix generated will be based on matrixDir attribute of the tile. If the given file format is CSV type it will be parsed as a switch matrix CSV file. If the given file format is a .list file, the tool will convert the .list file into a switch matrix with specific ordering first before progressing. If the given file format is Verilog of VHDL, then the function will not generate anything.

Parameters

tile (Tile) – _description_

Raises

ValueError – If matrixDir do not contain a valid file format

generateBitsStreamSpec() Dict[str, Dict]

Generate the bits stream specification of the fabric. This is need and will be further parsed by the bit_gen.py

Returns

The bits stream specification of the fabric

Return type

dict[str, dict]

generateConfigMem(tile: fabric_generator.fabric.Tile, configMemCsv: str) None

This function will generate the RTL code for configuration memory of the given tile. It the given configMemCsv file does not exist, it will be created using generateConfigMemInit.

Parameters
  • tile (Tile) – A tile object

  • configMemCsv (str) – The directory of the config memory csv file

generateConfigMemInit(file: str, globalConfigBitsCounter: int) None

This function is used to generate the config memory initialization file for a given amount of configuration bits. THe amount of configuration bits is determined by the frameBitsPerRow attribute of the fabric. The function will pack the configuration bit from the highest to the lowest bit in the config memory. ie. if have 100 configuration bits, with 32 frame bit per row, the function will pack from bit 99 starting from bit 31 of frame 0 to bit 28 of frame 3.

Parameters
  • file (str) – The output file of the config memory initialization file

  • globalConfigBitsCounter (int) – The number of global config bits of the tile

generateFabric() None

Generate the fabric. The fabric description will be a flat description.

generateSuperTile(superTile: fabric_generator.fabric.SuperTile) None

Generate a super tile wrapper for given super tile.

Parameters

superTile (SuperTile) – Super tile object

generateTile(tile: fabric_generator.fabric.Tile) None

Generate the RTL code for a tile given the tile object.

Parameters

tile (Tile) – The tile object

generateTopWrapper() None

Generate the top wrapper of the fabric including feature that are not located inside the fabric such as BRAM.

static list2CSV(InFileName: str, OutFileName: str) None

This function is export a given list description into its equivalent CSV switch matrix description. A comment will be appended to the end of the column and row of the matrix, which will indicate the number of signal in a given row.

Parameters
  • InFileName (str) – The input file name of the list file

  • OutFileName (str) – The directory of the CSV file to be written

Raises

ValueError – If the list file contains signals that are not in the matrix file