FABulous.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 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.

Parameters:
  • writer (FABulous.fabric_generator.code_generator.CodeGenerator)

  • fabricCSV (str)

geometryGenerator[source]#

Object responsible for generating geometry-related outputs.

Type:

GeometryGenerator

fabric[source]#

Represents the parsed fabric data.

Type:

Fabric

fileExtension[source]#

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

Type:

str

Initialise FABulous object.
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'.

Methods:

addList2Matrix(listFile, matrix)[source]#

Convert list into CSV matrix and save it.

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

Parameters:
  • list (str) – List data to be converted.

  • matrix (str) – File path where the matrix data will be saved.

  • listFile (Path)

Return type:

None

bootstrapSwitchMatrix(tileName, outputDir)[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 (str) – Directory path where the switch matrix will be generated.

Return type:

None

genBitStreamSpec()[source]#

Generate the bitstream specification object.

Returns:

Bitstream specification object generated by ‘fabricGenerator’.

Return type:

Object

genConfigMem(tileName, configMem)[source]#

Generate configuration memory for specified tile.

Parameters:
  • tileName (str) – Name of the tile for which configuration memory will be generated.

  • configMem (str) – File path where the configuration memory will be saved.

Return type:

None

genFabric()[source]#

Generate the entire fabric layout.

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

Return type:

None

genFabricIOBels()[source]#

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

Return type:

None

genGeometry(geomPadding=8)[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.

Return type:

None

genIOBelForTile(tile_name)[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:

bels – The bel object representing the generative IOs.

Return type:

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()[source]#

Generate model for Nextpnr based on fabric data.

Returns:

Model generated by ‘model_gen_npnr.genNextpnrModel’.

Return type:

Object

genSuperTile(tileName)[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.

Return type:

None

genSwitchMatrix(tileName)[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.

Return type:

None

genTile(tileName)[source]#

Generate a tile based on its name.

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

Parameters:

tileName (str) – Name of the tile generated.

Return type:

None

genTopWrapper()[source]#

Generate the top wrapper for the fabric.

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

Return type:

None

generateUserDesignTopWrapper(userDesign, topWrapper)[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.

Return type:

None

getBels()[source]#

Return all unique Bels within a fabric.

Returns:

Bel object based on bel name.

Return type:

Bel

getSuperTile(tileName)[source]#

Return SuperTile object based on tile name.

Parameters:

tileName (str) – Name of the SuperTile.

Returns:

SuperTile object based on tile name.

Return type:

SuperTile

getSuperTiles()[source]#

Return all SuperTiles within a fabric.

Returns:

SuperTile object based on tile name.

Return type:

SuperTile

getTile(tileName)[source]#

Return Tile object based on tile name.

Parameters:

tileName (str) – Name of the Tile.

Returns:

Tile object based on tile name.

Return type:

Tile

getTiles()[source]#

Return all Tiles within a fabric.

Returns:

Tile object based on tile name.

Return type:

Tile

loadFabric(fabric_dir)[source]#

Load fabric data from ‘fabric.csv’.

Parameters:
  • dir (str) – Path to CSV file containing fabric data.

  • fabric_dir (Path)

Raises:

ValueError – If ‘dir’ does not end with ‘.csv’

Return type:

None

setWriterOutputFile(outputDir)[source]#

Set the output file directory for the write object.

Parameters:

outputDir (Path) – Directory path where output files will be saved.

Return type:

None

Functions#