bel_geometryΒΆ

Class for generating and managing the geometry of BELs.

ClassesΒΆ

BelGeometry

A data structure representing the geometry of a bel.

Module ContentsΒΆ

BelGeometryΒΆ

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.

Variables:
  • name (str | None) – Name of the bel

  • src (str | None) – File path of the bel HDL source file

  • width (int) – Width of the bel

  • height (int) – Height of the bel

  • relX (int) – X coordinate of the bel, relative within the tile

  • relY (int) – Y coordinate of the bel, relative within the tile

  • internalInputs (list[str]) – Internal input port names of the bel

  • internalOutputs (list[str]) – Internal output port names of the bel

  • externalInputs (list[str]) – External input port names of the bel

  • externalOutputs (list[str]) – External output port names of the bel

  • internalPortGeoms (list[PortGeometry]) – List of geometries of the internal ports of the bel

  • externalPortGeoms (list[PortGeometry]) – List of geometries of the external ports of the bel

MethodsΒΆ

adjustPos(relX, relY) None[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

generateGeometry(bel, padding) None[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

generatePortsGeometry(bel, padding) None[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

saveToCSV(writer) None[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