parse_csvΒΆ

Contains functions for parsing CSV files related to the fabric definition.

FunctionsΒΆ

parseFabricCSV(fileName)

Parse a CSV file and returns a fabric object.

parsePortLine(line)

Parse a single line of the port configuration from the CSV file.

parseSupertilesCSV(fileName, tileDic)

Parse a CSV supertile configuration file and returns all SuperTile objects.

parseTilesCSV(fileName)

Parse a CSV tile configuration file and returns all tile objects.

validate_super_tile_matrix(superTile, connections, ...)

Check that a supertile switch matrix only references known names.

Module ContentsΒΆ

parseFabricCSV(fileName) Fabric[source]ΒΆ

Parse a CSV file and returns a fabric object.

Parameters:

fileName (str) – Directory of the CSV file.

Raises:
Returns:

The fabric object.

parsePortLine(line) tuple[list[Port], tuple[str, str] | None][source]ΒΆ

Parse a single line of the port configuration from the CSV file.

Parameters:

line (str) – CSV line containing port configuration data.

Raises:

InvalidPortType – If the port definition is invalid.

Returns:

A tuple containing a list of parsed ports and an optional common wire pair.

parseSupertilesCSV(fileName, tileDic) list[SuperTile][source]ΒΆ

Parse a CSV supertile configuration file and returns all SuperTile objects.

Parameters:
  • fileName (Path) – The path to the CSV file.

  • tileDic (dict[str, Tile]) – Dict of tiles.

Raises:
Returns:

List of SuperTile objects.

parseTilesCSV(fileName) tuple[list[Tile], list[tuple[str, str]]][source]ΒΆ

Parse a CSV tile configuration file and returns all tile objects.

Parameters:

fileName (Path) – The path to the CSV file.

Returns:

A tuple containing a list of Tile objects and a list of common wire pairs.

Raises:
validate_super_tile_matrix(superTile, connections, matrix_path) None[source]ΒΆ

Check that a supertile switch matrix only references known names.

Every mux output (sink) must be a BEL input or a child-tile INPUT SJUMP wire, and every mux input (source) must be a BEL output, a child-tile OUTPUT SJUMP wire, or a switch-matrix constant. An unknown name is almost always a typo and would otherwise emit RTL referencing an undeclared signal.

Parameters:
  • superTile (SuperTile) – The supertile whose ports and BELs define the legal names.

  • connections (dict[str, list[str]]) – Parsed matrix, mapping each sink (destination) to its sources.

  • matrix_path (Path) – Path to the matrix file, used in the error message.

Raises:

InvalidSwitchMatrixDefinition – If any sink or source is not a known port, BEL pin, or constant.