FABulous.geometry_generator.bel_geometry

Class for generating and managing the geometry of BELs.

Classes

class BelGeometry[source]

A data structure representing the geometry of a bel.

Sets all attributes to default values: None for names/sources, zero for dimensions and coordinates, and empty lists for port names and geometries.

name[source]

Name of the bel

Type:

str | None

src[source]

File path of the bel HDL source file

Type:

str | None

width[source]

Width of the bel

Type:

int

height[source]

Height of the bel

Type:

int

relX[source]

X coordinate of the bel, relative within the tile

Type:

int

relY[source]

Y coordinate of the bel, relative within the tile

Type:

int

internalInputs[source]

Internal input port names of the bel

Type:

list[str]

internalOutputs[source]

Internal output port names of the bel

Type:

list[str]

externalInputs[source]

External input port names of the bel

Type:

list[str]

externalOutputs[source]

External output port names of the bel

Type:

list[str]

internalPortGeoms[source]

List of geometries of the internal ports of the bel

Type:

list[PortGeometry]

externalPortGeoms[source]

List of geometries of the external ports of the bel

Type:

list[PortGeometry]

Methods:

adjustPos(relX, relY)[source]

Adjust the position of the BEL within its containing tile.

Updates the relative X and Y coordinates of the BEL to position it correctly within the tile layout.

Parameters:
  • relX (int) – New relative X coordinate within the tile

  • relY (int) – New relative Y coordinate within the tile

Return type:

None

generateGeometry(bel, padding)[source]

Generate the geometry for a BEL (Basic Element).

Creates the geometric representation of a BEL including its dimensions and port layout. The height is determined by the maximum number of ports on either side plus padding, while width is currently fixed.

Parameters:
  • bel (Bel) – The BEL object to generate the geometry for

  • padding (int) – The padding space to add around the BEL

Return type:

None

generatePortsGeometry(bel, padding)[source]

Generate the geometry for all ports of the BEL.

Creates PortGeometry objects for all internal and external input/output ports of the BEL. Internal ports are positioned on the left side (X=0), while external ports are positioned on the right side (X=width).

Parameters:
  • bel (Bel) – The BEL object containing port information

  • padding (int) – The padding space to add around ports

Return type:

None

saveToCSV(writer)[source]

Save BEL geometry data to CSV format.

Writes the BEL geometry information including name, source file, position, dimensions, and all port geometries to a CSV file using the provided writer.

Parameters:

writer (object) – The CSV writer object to use for output

Return type:

None