hlsfactory.scripts.generate_design_configs

Migration script to generate hlsfactory.toml files for existing designs.

This script scans all design directories under hls_dataset_sources/ and generates hlsfactory.toml configuration files based on the detected TCL files.

Usage Examples:

# Preview what would be created (recommended first step) uv run python -m hlsfactory.scripts.generate_design_configs –dry-run

# Preview with verbose output showing each design uv run python -m hlsfactory.scripts.generate_design_configs –dry-run –verbose

# Generate configs for all designs uv run python -m hlsfactory.scripts.generate_design_configs

# Generate configs for a specific dataset only uv run python -m hlsfactory.scripts.generate_design_configs –dataset polybench

# Generate configs for a specific dataset with preview uv run python -m hlsfactory.scripts.generate_design_configs

–dataset machsuite –dry-run

TCL File Detection:

The script automatically detects the following TCL files and maps them to flows:

  • dataset_hls.tcl -> VitisHLSSynthFlow (synth_tcl)

  • dataset_hls_ip_export.tcl -> VitisHLSImplFlow (impl_tcl)

  • dataset_hls_csim.tcl -> VitisHLSCsimFlow (csim_tcl)

  • dataset_hls_cosim_setup.tcl -> VitisHLSCosimSetupFlow (cosim_setup_tcl)

  • dataset_hls_cosim.tcl -> VitisHLSCosimFlow (cosim_tcl)

  • opt_template.tcl -> OptDSLv2 (opt_dsl_file)

Generated Config Format:

design_name = “<directory_name>” dataset_name = “<parent_dataset_name>” tags = []

[[flow_configs]] flow_name = “VitisHLSSynthFlow” synth_tcl = “dataset_hls.tcl”

[[flow_configs]] flow_name = “OptDSLv2” opt_dsl_file = “opt_template.tcl”

Notes:
  • Existing hlsfactory.toml files are never overwritten (skipped)

  • Designs without any recognized TCL files generate warnings

  • Use –dry-run first to preview changes before generating

Module Contents

Functions

detect_tcl_files

Detect which TCL files exist in a design directory.

generate_flow_configs

Generate FlowConfig objects based on detected TCL files.

process_design_directory

Process a single design directory.

main

Main entry point for the migration script.

Data

API

hlsfactory.scripts.generate_design_configs.DATASET_NAME_MAP: dict[str, str] = None
hlsfactory.scripts.generate_design_configs.TCL_PATTERNS: dict[str, list[str]] = None
hlsfactory.scripts.generate_design_configs.detect_tcl_files(design_dir: pathlib.Path) → dict[str, str][source]

Detect which TCL files exist in a design directory.

Returns:

Dictionary mapping setting keys to found filenames.

hlsfactory.scripts.generate_design_configs.generate_flow_configs(tcl_files: dict[str, str]) → list[hlsfactory.design_config.FlowConfig][source]

Generate FlowConfig objects based on detected TCL files.

Args:

tcl_files: Dictionary mapping setting keys to filenames.

Returns:

List of FlowConfig objects for the detected flows.

hlsfactory.scripts.generate_design_configs.process_design_directory(design_dir: pathlib.Path, dataset_name: str, dry_run: bool = False) → tuple[bool, str][source]

Process a single design directory.

Args:

design_dir: Path to the design directory. dataset_name: Name of the parent dataset. dry_run: If True, don’t write files, just show what would be done.

Returns:

Tuple of (was_created, status_message).

hlsfactory.scripts.generate_design_configs.main() → int[source]

Main entry point for the migration script.