FABulous.FABulous_API ===================== .. py:module:: FABulous.FABulous_API .. autoapi-nested-parse:: FABulous API module for fabric and geometry generation. This module provides the main API class for managing FPGA fabric generation, including parsing fabric definitions, generating HDL code, creating geometries, and handling various fabric-related operations. Classes ------- .. py:class:: FABulous_API(writer, fabricCSV = '') Class for managing fabric and geometry generation. This class parses fabric data from 'fabric.csv', generates fabric layouts, geometries, models for nextpnr, as well as other fabric-related functions. .. attribute:: geometryGenerator Object responsible for generating geometry-related outputs. :type: GeometryGenerator .. attribute:: fabric Represents the parsed fabric data. :type: Fabric .. attribute:: fileExtension Default file extension for generated output files ('.v' or '.vhdl'). :type: str .. attribute:: Initialise FABulous object. .. attribute:: If 'fabricCSV' is provided, parses fabric data and initialises .. attribute:: 'fabricGenerator' and 'geometryGenerator' with parsed data. .. attribute:: If using VHDL, changes the extension from '.v' to'.vhdl'. .. attribute:: :type: param writer: Object responsible for generating code from code_generator.py .. attribute:: :type: type writer: CodeGenerator .. attribute:: :type: param fabricCSV: Path to the CSV file containing fabric data, by default "" .. attribute:: :type: type fabricCSV: str, optional **Methods:** .. py:method:: addList2Matrix(listFile, matrix) Convert list into CSV matrix and save it. Using 'list2CSV' defined in 'fabric_gen.py'. :param list: List data to be converted. :type list: str :param matrix: File path where the matrix data will be saved. :type matrix: str .. py:method:: bootstrapSwitchMatrix(tileName, outputDir) Bootstrap the switch matrix for the specified tile. Using 'bootstrapSwitchMatrix' defined in 'fabric_gen.py'. :param tileName: Name of the tile for which the switch matrix will be bootstrapped. :type tileName: str :param outputDir: Directory path where the switch matrix will be generated. :type outputDir: str .. py:method:: genBitStreamSpec() Generate the bitstream specification object. :returns: Bitstream specification object generated by 'fabricGenerator'. :rtype: Object .. py:method:: genConfigMem(tileName, configMem) Generate configuration memory for specified tile. :param tileName: Name of the tile for which configuration memory will be generated. :type tileName: str :param configMem: File path where the configuration memory will be saved. :type configMem: str .. py:method:: genFabric() Generate the entire fabric layout. Via 'generatreFabric' defined in 'fabric_gen.py'. .. py:method:: genFabricIOBels() Generate the IO BELs for the generative IOs of the fabric. .. py:method:: genGeometry(geomPadding = 8) Generate geometry based on the fabric data and save it to CSV. :param geomPadding: Padding value for geometry generation, by default 8. :type geomPadding: int, optional .. py:method:: genIOBelForTile(tile_name) Generate the IO BELs for the generative IOs of a tile. Config Access Generative IOs will be a separate Bel. Updates the tileDic with the generated IO BELs. :param tile_name: Name of the tile to generate IO Bels. :type tile_name: str :returns: **bels** -- The bel object representing the generative IOs. :rtype: List[Bel] :raises ValueError: If tile not found in fabric. In case of an invalid IO type for generative IOs. If the number of config access ports does not match the number of config bits. .. py:method:: genRoutingModel() Generate model for Nextpnr based on fabric data. :returns: Model generated by 'model_gen_npnr.genNextpnrModel'. :rtype: Object .. py:method:: genSuperTile(tileName) Generate a super tile based on its name. Using 'generateSuperTile' defined in 'fabric_gen.py'. :param tileName: Name of the super tile generated. :type tileName: str .. py:method:: genSwitchMatrix(tileName) Generate switch matrix for specified tile. Using 'genTileSwitchMatrix' defined in 'fabric_gen.py'. :param tileName: Name of the tile for which the switch matrix will be generated. :type tileName: str .. py:method:: genTile(tileName) Generate a tile based on its name. Using 'generateTile' defined in 'fabric_gen.py'. :param tileName: Name of the tile generated. :type tileName: str .. py:method:: genTopWrapper() Generate the top wrapper for the fabric. Using 'generateTopWrapper' defined in 'fabric_gen.py'. .. py:method:: generateUserDesignTopWrapper(userDesign, topWrapper) Generate the top wrapper for the user design. :param userDesign: Path to the user design file. :type userDesign: Path :param topWrapper: Path to the output top wrapper file. :type topWrapper: Path .. py:method:: getBels() Return all unique Bels within a fabric. :returns: Bel object based on bel name. :rtype: Bel .. py:method:: getSuperTile(tileName) Return SuperTile object based on tile name. :param tileName: Name of the SuperTile. :type tileName: str :returns: SuperTile object based on tile name. :rtype: SuperTile .. py:method:: getSuperTiles() Return all SuperTiles within a fabric. :returns: SuperTile object based on tile name. :rtype: SuperTile .. py:method:: getTile(tileName) Return Tile object based on tile name. :param tileName: Name of the Tile. :type tileName: str :returns: Tile object based on tile name. :rtype: Tile .. py:method:: getTiles() Return all Tiles within a fabric. :returns: Tile object based on tile name. :rtype: Tile .. py:method:: loadFabric(fabric_dir) Load fabric data from 'fabric.csv'. :param dir: Path to CSV file containing fabric data. :type dir: str :raises ValueError: If 'dir' does not end with '.csv' .. py:method:: setWriterOutputFile(outputDir) Set the output file directory for the write object. :param outputDir: Directory path where output files will be saved. :type outputDir: Path Functions ---------