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¶
Class for managing fabric and geometry generation. |
Module Contents¶
FABulous_API¶
- class FABulous_API(writer, fabricCSV='')[source]¶
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’.
- Parameters:
writer (CodeGenerator) – Object responsible for generating code from code_generator.py
fabricCSV (str, optional) – Path to the CSV file containing fabric data, by default “”
- Variables:
geometryGenerator (GeometryGenerator) – Object responsible for generating geometry-related outputs.
fabric (Fabric) – Represents the parsed fabric data.
fileExtension (str) – Default file extension for generated output files (‘.v’ or ‘.vhdl’).
Methods¶
- addList2Matrix(listFile, matrix) None[source]¶
Convert list into CSV matrix and save it.
Using ‘list2CSV’ defined in ‘fabric_gen.py’.
- Parameters:
listFile (Path) – List data to be converted.
matrix (Path) – File path where the matrix data will be saved.
- bootstrapSwitchMatrix(tileName, outputDir) None[source]¶
Bootstrap the switch matrix for the specified tile.
Using ‘bootstrapSwitchMatrix’ defined in ‘fabric_gen.py’.
- Parameters:
tileName (str) – Name of the tile for which the switch matrix will be bootstrapped.
outputDir (Path) – Directory path where the switch matrix will be generated.
- Raises:
ValueError – If tile is not found in fabric.
- fabric_stitching(tile_macro_paths, fabric_path, out_folder, pdk, pdk_root, *, base_config_path=None, config_override_path=None, **custom_config_overrides) None[source]¶
Run the stitching flow to assemble tile macros into a fabric-level GDS.
- Parameters:
tile_macro_paths (dict[str, Path]) – Dictionary mapping tile names to their macro output directories.
fabric_path (Path) – Path to the fabric-level Verilog file.
out_folder (Path) – Output directory for the stitched fabric.
pdk (str) – PDK name to use.
pdk_root (Path) – Path to PDK root directory.
base_config_path (Path | None) – Path to base configuration YAML file.
config_override_path (Path | None, optional) – Additional configuration overrides.
**custom_config_overrides (dict) – software configuration overrides.
- full_fabric_automation(project_dir, out_folder, pdk, pdk_root, *, base_config_path=None, config_override_path=None, tile_opt_config=None, **config_overrides) None[source]¶
Run the stitching flow to assemble tile macros into a fabric-level GDS.
- genBitStreamSpec() dict[source]¶
Generate the bitstream specification object.
- Returns:
Bitstream specification object generated by ‘fabricGenerator’.
- genConfigMem(tileName, configMem) None[source]¶
Generate configuration memory for specified tile.
- Parameters:
tileName (str) – Name of the tile for which configuration memory will be generated.
configMem (Path) – File path where the configuration memory will be saved.
- Raises:
ValueError – If tile is not found in fabric.
- genFabric() None[source]¶
Generate the entire fabric layout.
Via ‘generateFabric’ defined in ‘fabric_gen.py’.
- genGeometry(geomPadding=8) None[source]¶
Generate geometry based on the fabric data and save it to CSV.
- Parameters:
geomPadding (int, optional) – Padding value for geometry generation, by default 8.
- genIOBelForTile(tile_name) list[Bel][source]¶
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.
- Parameters:
tile_name (str) – Name of the tile to generate IO Bels.
- Returns:
The bel object representing the generative IOs.
- 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() tuple[str, str, str, str][source]¶
Generate model for Nextpnr based on fabric data.
- Returns:
Model generated by ‘model_gen_npnr.genNextpnrModel’.
- genSuperTile(tileName) None[source]¶
Generate a super tile based on its name.
Using ‘generateSuperTile’ defined in ‘fabric_gen.py’.
- Parameters:
tileName (str) – Name of the super tile generated.
- Raises:
ValueError – If super tile is not found in fabric.
- genSwitchMatrix(tileName, csv_output_dir=None) None[source]¶
Generate switch matrix for specified tile.
Using ‘genTileSwitchMatrix’ defined in ‘fabric_gen.py’.
- Parameters:
tileName (str) – Name of the tile for which the switch matrix will be generated.
csv_output_dir (Path | None) – Optional directory to write the generated CSV file when converting from
.listformat. If None, the CSV is written to the same directory as the source.listfile. This parameter is ignored when the input is already a.csvfile.
- Raises:
ValueError – If tile is not found in fabric.
- genTile(tileName) None[source]¶
Generate a tile based on its name.
Using ‘generateTile’ defined in ‘fabric_gen.py’.
- Parameters:
tileName (str) – Name of the tile generated.
- Raises:
ValueError – If tile is not found in fabric.
- genTileMacro(tile_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) None[source]¶
Run the macro flow to generate the macro Verilog files.
- genTopWrapper() None[source]¶
Generate the top wrapper for the fabric.
Using ‘generateTopWrapper’ defined in ‘fabric_gen.py’.
- gen_io_pin_order_config(tile, outfile) None[source]¶
Generate IO pin order configuration YAML for a tile or super tile.
- generateUserDesignTopWrapper(userDesign, topWrapper) None[source]¶
Generate the top wrapper for the user design.
- Parameters:
userDesign (Path) – Path to the user design file.
topWrapper (Path) – Path to the output top wrapper file.
- getBels() list[Bel][source]¶
Return all unique Bels within a fabric.
- Returns:
List of all unique Bel objects in the fabric.
- getSuperTile(tileName, raises_on_miss=False) SuperTile | None[source]¶
Return ‘SuperTile’ object based on ‘tileName’.
- Parameters:
- Returns:
SuperTile object based on tile name, or None if not found.
- Raises:
KeyError – If the supertile specified by ‘tileName’ is not found and ‘raises_on_miss’ is ‘True’.
- getSuperTiles() Iterable[SuperTile][source]¶
Return all SuperTiles within a fabric.
- Returns:
Collection of all SuperTile objects in the fabric.
- getTile(tileName, raises_on_miss=False) Tile | SuperTile | None[source]¶
Return ‘Tile’ or ‘SuperTile’ object based on ‘tileName’.
- Parameters:
- Returns:
‘Tile’ or ‘SuperTile’ object based on tile name, or ‘None’ if not found.
- Raises:
KeyError – If the tile specified by ‘tileName’ is not found and ‘raises_on_miss’ is ‘True’.
- getTiles() Iterable[Tile][source]¶
Return all Tiles within a fabric.
- Returns:
Collection of all Tile objects in the fabric.
- loadFabric(fabric_dir) None[source]¶
Load fabric data from ‘fabric.csv’.
- Parameters:
fabric_dir (Path) – Path to CSV file containing fabric data.
- Raises:
ValueError – If ‘fabric_dir’ does not end with ‘.csv’
- setWriterOutputFile(outputDir) None[source]¶
Set the output file directory for the write object.
- Parameters:
outputDir (Path) – Directory path where output files will be saved.
- timing_model_interface(mode, output_file, debug, manual_config=None) TimingModelConfig[source]¶
Initialise timing model interface, generate nextpnr pip file for the fabric.
- Parameters:
mode (str) – The mode in which to run the timing model interface.
output_file (Path) – The path where the generated nextpnr pip file will be saved.
debug (bool) – Whether to enable debug mode for the timing model interface, which may provide more verbose logging.
manual_config (TimingModelConfig | None) – Optional manual configuration for the timing model interface. If provided, this configuration will be used instead of the default PDK-based configuration.
- Returns:
The configuration used for the timing model interface, which may be the default PDK-based configuration or the provided manual configuration.
- Raises:
ValueError – If no default timing model configuration is available for the current PDK and no manual configuration is provided.