gen_configmem

Configuration memory generation module.

This module provides functions to generate configuration memory initialization files and RTL code for fabric tiles. It handles the mapping of configuration bits to frames and generates the necessary hardware description language code for memory access and control.

Functions

build_super_tile_config_mem_csv(master_config_mem_csv, ...)

Build a ConfigMem CSV for a supertile SM using free slots from the master tile.

generateConfigMem(writer, name, config_bits_count, ...)

Generate the RTL code for configuration memory.

generateConfigMemInit(file, tileConfigBitsCount[, ...])

Generate the config memory initialization file.

generate_super_tile_config_mem(writer, superTile, ...)

Generate the ConfigMem RTL for a supertile switch matrix.

validate_super_tile_config_mem(...[, ...])

Validate an existing supertile ConfigMem against the master tile.

Module Contents

build_super_tile_config_mem_csv(master_config_mem_csv, num_bits_needed, output_path, frame_bits_per_row=32, max_frames_per_col=20) None[source]

Build a ConfigMem CSV for a supertile SM using free slots from the master tile.

Reads the master tile’s ConfigMem CSV, collects bit positions where the used_bits_mask is '0' (free), and writes a new CSV that maps ST_ConfigBits[0..num_bits_needed-1] to those positions. The output CSV has exactly max_frames_per_col rows so it is accepted by parseConfigMem.

Parameters:
  • master_config_mem_csv (Path) – Path to the master tile’s existing *_ConfigMem.csv.

  • num_bits_needed (int) – Number of supertile configuration bits to place.

  • output_path (Path) – Destination path for the generated supertile ConfigMem CSV.

  • frame_bits_per_row (int) – Number of bits per frame row (must match the fabric setting).

  • max_frames_per_col (int) – Number of frames per column (must match the fabric setting).

Raises:

ValueError – If the master tile’s ConfigMem CSV does not have exactly max_frames_per_col rows, or if there are fewer free slots than num_bits_needed.

generateConfigMem(writer, name, config_bits_count, configMemCsv, frame_bits_per_row=32, max_frame_per_col=20) None[source]

Generate the RTL code for configuration memory.

If the given configMemCsv file does not exist, it will be created using generateConfigMemInit.

We use a file to describe the exact configuration bits to frame mapping the following command generates an init file with a simple enumerated default mapping (e.g. ‘LUT4AB_ConfigMem.init.csv’) if we run this function again, but have such a file (without the .init), then that mapping will be used

Parameters:
  • writer (CodeGenerator) – The code generator instance for RTL output

  • name (str) – Name of the tile or module (used for module naming and log messages).

  • config_bits_count (int) – Total number of configuration bits.

  • configMemCsv (Path) – The directory of the config memory CSV file.

  • frame_bits_per_row (int) – The number of configuration bits per frame row.

  • max_frame_per_col (int) – The number of frames stored per tile column.

Raises:

ValueError

  • If the config bits exceed the fabric capacity.

  • If the total config bits in the config memory CSV file does not match config_bits_count.

generateConfigMemInit(file, tileConfigBitsCount, frame_bits_per_row=32, max_frame_per_col=20) None[source]

Generate the config memory initialization file.

The amount of configuration bits is determined by frame_bits_per_row. The function will pack the configuration bit from the highest to the lowest bit in the config memory. I. e. if there are 100 configuration bits, with 32 frame bits per row, the function will pack from bit 99 starting from bit 31 of frame 0 to bit 28 of frame 3.

Parameters:
  • file (Path) – The output file of the config memory initialization file.

  • tileConfigBitsCount (int) – The number of tile config bits of the tile.

  • frame_bits_per_row (int) – The number of configuration bits per frame row.

  • max_frame_per_col (int) – The number of frames stored per tile column.

Raises:

ValueError – If the tile config bits exceed the fabric capacity.

generate_super_tile_config_mem(writer, superTile, master_config_mem_csv, frame_bits_per_row=32, max_frame_per_col=20) None[source]

Generate the ConfigMem RTL for a supertile switch matrix.

Builds a ConfigMem CSV that places the supertile SM’s config bits into the free slots of the master tile’s frame space, then generates the Verilog/VHDL module via generateConfigMem.

Parameters:
  • writer (CodeGenerator) – Code generator instance for RTL output.

  • superTile (SuperTile) – The supertile whose SM config bits need a ConfigMem.

  • master_config_mem_csv (Path) – Path to the master tile’s existing *_ConfigMem.csv.

  • frame_bits_per_row (int) – Number of bits per frame row.

  • max_frame_per_col (int) – Number of frames per column.

validate_super_tile_config_mem(super_tile_config_mem_csv, master_config_mem_csv, num_bits_needed, frame_bits_per_row=32, max_frames_per_col=20) None[source]

Validate an existing supertile ConfigMem against the master tile.

A supertile ConfigMem reuses the free bit slots of its master tile’s frame space. Reusing an existing file is only safe if it still matches the current supertile bit count and does not overlap any bit the master tile itself uses.

Parameters:
  • super_tile_config_mem_csv (Path) – Path to the existing supertile *_ConfigMem.csv to validate.

  • master_config_mem_csv (Path) – Path to the master tile’s *_ConfigMem.csv.

  • num_bits_needed (int) – Number of supertile configuration bits that must be present.

  • frame_bits_per_row (int) – Number of bits per frame row.

  • max_frames_per_col (int) – Number of frames per column.

Raises:

ValueError – If either file has the wrong row count, the supertile does not use exactly num_bits_needed bits, or any frame bit is used by both ConfigMems.