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.
- writer¶
The code generator object to write the RTL files
- Type
- static CSV2list(InFileName: str, OutFileName: str) None ¶
this function is export a given CSV switch matrix description into its equivalent list description
- 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
- 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
- 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.
- 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.
- 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
- Raises
ValueError – If the list file contains signals that are not in the matrix file