FABulous.fabric_generator.gen_fabric.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.
Classes¶
Functions¶
- generateConfigMem(writer, fabric, tile, configMemCsv)[source]¶
- Parameters:
writer (CodeGenerator)
fabric (Fabric)
tile (Tile)
configMemCsv (Path)
- Return type:
None
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
- param writer:
The code generator instance for RTL output
- type writer:
CodeGenerator
- param fabric:
The fabric object containing fabric configuration
- type fabric:
Fabric
- param tile:
A tile object.
- type tile:
Tile
- param configMemCsv:
The directory of the config memory CSV file.
- type configMemCsv:
Path
- 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.
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.
- param fabric:
The fabric object containing fabric configuration
- type fabric:
Fabric
- param file:
The output file of the config memory initialization file.
- type file:
Path
- param tileConfigBitsCount:
The number of tile config bits of the tile.
- type tileConfigBitsCount:
int
- raises ValueError:
If the tile config bits exceed the fabric capacity.