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

generateConfigMem(writer, fabric, tile, configMemCsv)

Generate the RTL code for configuration memory.

generateConfigMemInit(fabric, file, tileConfigBitsCount)

Generate the config memory initialization file.

Module Contents

generateConfigMem(writer, fabric, tile, configMemCsv)[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

  • fabric (Fabric) – The fabric object containing fabric configuration

  • tile (Tile) – A tile object.

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

Raises:

ValueError

  • If the tile config bits exceed the fabric capacity.

  • If the total config bits in the config memory CSV file does not match the tile’s global config bits.

Return type:

None

generateConfigMemInit(fabric, file, tileConfigBitsCount)[source]

Generate the config memory initialization file.

The amount of configuration bits is determined by the frameBitsPerRow attribute of the fabric. 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:
  • fabric (Fabric) – The fabric object containing fabric configuration

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

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

Raises:

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

Return type:

None