gen_switchmatrix¶
Switch matrix generation module for FABulous FPGA tiles.
This module generates RTL code for configurable switch matrices within FPGA tiles. Switch matrices handle the routing of signals between tile ports, BEL inputs/outputs, and jump wires. The module supports various configuration modes and multiplexer styles.
Key features:
CSV and list file parsing for switch matrix configurations
Support for custom and generic multiplexer implementations
Configuration bit calculation and management
Debug signal generation for switch matrix analysis
Multiple configuration modes (FlipFlop chain, Frame-based)
Functions¶
|
Generate the RTL code for the tile switch matrix. |
Module Contents¶
- genTileSwitchMatrix(writer, tile, switch_matrix_debug_signal, csv_output_dir=None, config_bit_mode=ConfigBitMode.FRAME_BASED, multiplexer_style=MultiplexerStyle.CUSTOM, default_pip_delay=80, preserve_list_order=False) None[source]¶
Generate the RTL code for the tile switch matrix.
The switch matrix generated will be based on the
matrixDirattribute of the tile. If the given file format is.csv, it will be parsed as a switch matrix.csvfile. If the given file format is.list, the tool will convert the.listfile into a switch matrix with specific ordering first before progressing. If the given file format is Verilog or VHDL, then the function will not generate anything.- Parameters:
writer (CodeGenerator) – The code generator instance for RTL output
tile (Tile) – The tile object containing BELs and port information
switch_matrix_debug_signal (bool) – Whether to generate debug signals for the switch matrix.
csv_output_dir (Path | None) – Optional directory to write the generated CSV file when converting from
.listformat. If None, the CSV is written to the same directory as the source.listfile. This parameter is ignored when the input is already a.csvfile.config_bit_mode (ConfigBitMode) – The configuration-bit mode for the tile (frame-based or flip-flop chain).
multiplexer_style (MultiplexerStyle) – The multiplexer style used to implement switch-matrix muxes.
default_pip_delay (int) – Per-mux delay (ps) emitted on assign statements in the switch matrix.
preserve_list_order (bool) – When True,
list2CSVwrites a per-row 1-based index encoding the connection’s position in the.listfile so the mux input order can be recovered downstream. Defaults to False (legacy behaviour).
- Raises:
InvalidFileType – If
matrixDirdoes not contain a valid file format.ValueError – If any port in the switch matrix is not connected to anything.