fabulous_api

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

FABulous_API

Class for managing fabric and geometry generation.

Module Contents

FABulous_API

FABulous_API(writer, fabricCSV = '')   :module:

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.

If ‘fabricCSV’ is provided, parses fabric data and initialises ‘fabricGenerator’ and ‘geometryGenerator’ with parsed data.

If using VHDL, changes the extension from ‘.v’ to’.vhdl’.

param writer:

Object responsible for generating code from code_generator.py

type writer:

CodeGenerator

param fabricCSV:

Path to the CSV file containing fabric data, by default “”

type fabricCSV:

str, optional

ivar geometryGenerator:

Object responsible for generating geometry-related outputs.

vartype geometryGenerator:

GeometryGenerator

ivar fabric:

Represents the parsed fabric data.

vartype fabric:

Fabric

ivar fileExtension:

Default file extension for generated output files (‘.v’ or ‘.vhdl’).

vartype fileExtension:

str

addList2MatrixlistFile, matrix      :module:

Convert list into CSV matrix and save it.

Using ‘list2CSV’ defined in ‘fabric_gen.py’.

param listFile:

List data to be converted.

type listFile:

Path

param matrix:

File path where the matrix data will be saved.

type matrix:

Path

bootstrapSwitchMatrixtileName, outputDir      :module:

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:

Path

raises ValueError:

If tile is not found in fabric.

fabric_stitchingtile_macro_paths, fabric_path, out_folder, pdk, pdk_root, *, base_config_path = None, config_override_path = None, **custom_config_overrides      :module:

Run the stitching flow to assemble tile macros into a fabric-level GDS.

param tile_macro_paths:

Dictionary mapping tile names to their macro output directories.

type tile_macro_paths:

dict[str, Path]

param fabric_path:

Path to the fabric-level Verilog file.

type fabric_path:

Path

param out_folder:

Output directory for the stitched fabric.

type out_folder:

Path

param base_config_path:

Path to base configuration YAML file.

type base_config_path:

Path | None

param config_override_path:

Additional configuration overrides.

type config_override_path:

Path | None, optional

param pdk_root:

Path to PDK root directory.

type pdk_root:

Path | None, optional

param pdk:

PDK name to use.

type pdk:

str | None, optional

param **custom_config_overrides:

software configuration overrides.

type **custom_config_overrides:

dict

raises ValueError:

If PDK root or PDK is not specified.

full_fabric_automationproject_dir, out_folder, pdk, pdk_root, *, base_config_path = None, config_override_path = None, tile_opt_config = None, **config_overrides      :module:

Run the stitching flow to assemble tile macros into a fabric-level GDS.

genBitStreamSpec      :module:

Generate the bitstream specification object.

returns:

Bitstream specification object generated by ‘fabricGenerator’.

rtype:

dict

genConfigMemtileName, configMem      :module:

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:

Path

raises ValueError:

If tile is not found in fabric.

genFabric      :module:

Generate the entire fabric layout.

Via ‘generatreFabric’ defined in ‘fabric_gen.py’.

genFabricIOBels      :module:

Generate the IO BELs for the generative IOs of the fabric.

genGeometrygeomPadding = 8      :module:

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

genIOBelForTiletile_name      :module:

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:

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.

genRoutingModel      :module:

Generate model for Nextpnr based on fabric data.

returns:

Model generated by ‘model_gen_npnr.genNextpnrModel’.

rtype:

tuple[str, str, str, str]

genSuperTiletileName      :module:

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

raises ValueError:

If super tile is not found in fabric.

genSwitchMatrixtileName, csv_output_dir = None      :module:

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

param csv_output_dir:

Optional directory to write the generated CSV file when converting from .list format. If None, the CSV is written to the same directory as the source .list file. This parameter is ignored when the input is already a .csv file.

type csv_output_dir:

Path | None

raises ValueError:

If tile is not found in fabric.

genTiletileName      :module:

Generate a tile based on its name.

Using ‘generateTile’ defined in ‘fabric_gen.py’.

param tileName:

Name of the tile generated.

type tileName:

str

raises ValueError:

If tile is not found in fabric.

genTileMacrotile_dir, io_pin_config, out_folder, pdk, pdk_root, *, final_view = None, optimisation = OptMode.BALANCE, base_config_path = None, config_override_path = None, custom_config_overrides = None      :module:

Run the macro flow to generate the macro Verilog files.

genTopWrapper      :module:

Generate the top wrapper for the fabric.

Using ‘generateTopWrapper’ defined in ‘fabric_gen.py’.

gen_io_pin_order_configtile, outfile      :module:

Generate IO pin order configuration YAML for a tile or super tile.

param tile:

The fabric element for which to generate the configuration.

type tile:

Tile | SuperTile

param outfile:

Output YAML path.

type outfile:

Path

generateUserDesignTopWrapperuserDesign, topWrapper      :module:

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

getBels      :module:

Return all unique Bels within a fabric.

returns:

List of all unique Bel objects in the fabric.

rtype:

list[Bel]

getSuperTiletileName, raises_on_miss = False      :module:

Return ‘SuperTile’ object based on ‘tileName’.

param tileName:

Name of the SuperTile.

type tileName:

str

param raises_on_miss:

Whether to raise an error if the supertile is not found, by default ‘False’.

type raises_on_miss:

bool, optional

returns:

SuperTile object based on tile name, or None if not found.

rtype:

SuperTile | None

raises KeyError:
If the supertile specified by ‘tileName’ is not found and ‘raises_on_miss’

is ‘True’.

getSuperTiles      :module:

Return all SuperTiles within a fabric.

returns:

Collection of all SuperTile objects in the fabric.

rtype:

Iterable[SuperTile]

getTiletileName, raises_on_miss = False      :module:

Return ‘Tile’ or ‘SuperTile’ object based on ‘tileName’.

param tileName:

Name of the Tile.

type tileName:

str

param raises_on_miss:

Whether to raise an error if the tile is not found, by default ‘False’.

type raises_on_miss:

bool, optional

returns:

‘Tile’ or ‘SuperTile’ object based on tile name, or ‘None’ if not found.

rtype:

Tile | SuperTile | None

raises KeyError:
If the tile specified by ‘tileName’ is not found and ‘raises_on_miss’

is ‘True’.

getTiles      :module:

Return all Tiles within a fabric.

returns:

Collection of all Tile objects in the fabric.

rtype:

Iterable[Tile]

loadFabricfabric_dir      :module:

Load fabric data from ‘fabric.csv’.

param fabric_dir:

Path to CSV file containing fabric data.

type fabric_dir:

Path

raises ValueError:

If ‘fabric_dir’ does not end with ‘.csv’

setWriterOutputFileoutputDir      :module:

Set the output file directory for the write object.

param outputDir:

Directory path where output files will be saved.

type outputDir:

Path