hlsfactory.flow_xls

Google XLS HLS synthesis flow for DSLX designs.

Module Contents

Classes

DesignHLSSynthData

Artifacts and code-generation settings from an XLS synthesis run.

XLSBlockMetrics

Target-independent metrics emitted by XLS code generation.

XLSHLSSynthFlow

Compile a DSLX function to optimized XLS IR and synthesizable Verilog.

Functions

get_xls_install_dir

Resolve the XLS installation directory.

find_dslx_stdlib

Locate the DSLX standard library shipped with an XLS installation.

find_xls_binary

Find an XLS binary in a release bundle or Bazel source build.

parse_xls_bool_setting

Parse a string-valued boolean from an XLS flow configuration.

_extract_textproto_blocks

Return the contents of all field_name { ... } textproto blocks.

_parse_textproto_int

_parse_textproto_bool

_parse_textproto_string

_parse_textproto_enum

parse_xls_module_signature

Read pipeline latency and initiation interval from an XLS signature.

parse_xls_block_metrics

Read code-generation metrics and aggregate XLS BOM entries.

Data

API

hlsfactory.flow_xls.HLSFACTORY_XLS_PATH_ENV_VAR = 'HLSFACTORY_XLS_PATH'
hlsfactory.flow_xls.DEFAULT_XLS_PATH = 'Path(...)'
hlsfactory.flow_xls._XLS_BINARY_LOCATIONS = None
hlsfactory.flow_xls.get_xls_install_dir(xls_install_dir: str | pathlib.Path | None = None) → pathlib.Path[source]

Resolve the XLS installation directory.

An explicit argument takes precedence over HLSFACTORY_XLS_PATH. The final fallback is the shared XLS installation used by the HLSFactory server.

hlsfactory.flow_xls.find_dslx_stdlib(xls_install_dir: pathlib.Path) → pathlib.Path | None[source]

Locate the DSLX standard library shipped with an XLS installation.

ir_converter_main defaults --dslx_stdlib_path to the relative path xls/dslx/stdlib, which only resolves when the tool is run from the installation root. The flow runs with cwd set to the design directory, so the path has to be passed explicitly or every import std-style design fails to convert.

Returns None when the directory is absent, in which case the tool default is left alone.

hlsfactory.flow_xls.find_xls_binary(xls_install_dir: pathlib.Path, binary_name: str) → pathlib.Path[source]

Find an XLS binary in a release bundle or Bazel source build.

hlsfactory.flow_xls.parse_xls_bool_setting(value: str | None, setting_name: str) → bool[source]

Parse a string-valued boolean from an XLS flow configuration.

class hlsfactory.flow_xls.DesignHLSSynthData[source]

Artifacts and code-generation settings from an XLS synthesis run.

dslx_file: str = None
top: str = None
generator: str = None
pipeline_stages: int | None = None
delay_model: str | None = None
reset: str | None = None
ir_file: str = None
optimized_ir_file: str = None
rtl_file: str = None
module_signature_file: str = None
block_metrics_file: str = None
interface_proto_file: str = None
interface_textproto_file: str = None
ir_converter_options_file: str = None
optimizer_options_file: str = None
optimization_pass_metrics_file: str = None
schedule_file: str | None = None
scheduled_ir_file: str = None
block_ir_file: str = None
verilog_line_map_file: str = None
scheduling_options_file: str = None
codegen_options_file: str = None
scheduling_pass_metrics_file: str = None
codegen_pass_metrics_file: str = None
dump_optimizer_ir: bool = None
optimizer_ir_dump_dir: str | None = None
dump_codegen_ir: bool = None
codegen_ir_dump_dir: str | None = None
profile_passes: bool = None
optimizer_pass_profile_file: str | None = None
codegen_pass_profile_file: str | None = None
latency_cycles: int | None = None
initiation_interval: int | None = None
flop_count: int = None
feedthrough_path_exists: bool = None
metrics_delay_model: str | None = None
max_reg_to_reg_delay_ps: int | None = None
max_input_to_reg_delay_ps: int | None = None
max_reg_to_output_delay_ps: int | None = None
max_feedthrough_path_delay_ps: int | None = None
operation_counts: dict[str, int] = None
operation_kind_counts: dict[str, int] = None
class hlsfactory.flow_xls.XLSBlockMetrics[source]

Target-independent metrics emitted by XLS code generation.

flop_count: int = None
feedthrough_path_exists: bool = None
delay_model: str | None = None
max_reg_to_reg_delay_ps: int | None = None
max_input_to_reg_delay_ps: int | None = None
max_reg_to_output_delay_ps: int | None = None
max_feedthrough_path_delay_ps: int | None = None
operation_counts: dict[str, int] = None
operation_kind_counts: dict[str, int] = None
hlsfactory.flow_xls._extract_textproto_blocks(text: str, field_name: str) → list[str][source]

Return the contents of all field_name { ... } textproto blocks.

hlsfactory.flow_xls._parse_textproto_int(text: str, field_name: str) → int | None[source]
hlsfactory.flow_xls._parse_textproto_bool(text: str, field_name: str) → bool | None[source]
hlsfactory.flow_xls._parse_textproto_string(text: str, field_name: str) → str | None[source]
hlsfactory.flow_xls._parse_textproto_enum(text: str, field_name: str) → str | None[source]
hlsfactory.flow_xls.parse_xls_module_signature(path: pathlib.Path) → tuple[int | None, int | None][source]

Read pipeline latency and initiation interval from an XLS signature.

hlsfactory.flow_xls.parse_xls_block_metrics(path: pathlib.Path) → hlsfactory.flow_xls.XLSBlockMetrics[source]

Read code-generation metrics and aggregate XLS BOM entries.

class hlsfactory.flow_xls.XLSHLSSynthFlow(xls_install_dir: str | pathlib.Path | None = None, log_output: bool = False, log_execution_time: bool = True)[source]

Bases: hlsfactory.framework.ToolFlow

Compile a DSLX function to optimized XLS IR and synthesizable Verilog.

Initialization

name = 'XLSHLSSynthFlow'
execute(design: hlsfactory.framework.Design, timeout: float | None = None) → list[hlsfactory.framework.Design][source]
static _remaining_timeout(start_time: float, timeout: float | None) → float | None[source]
_log_execution_time(design_dir: pathlib.Path, start_time: float, status: hlsfactory.utils.ExecutionDataStatus = ExecutionDataStatus.SUCCESS, error_message: str | None = None) → None[source]
hlsfactory.flow_xls.__all__ = ['DEFAULT_XLS_PATH', 'DesignHLSSynthData', 'XLSBlockMetrics', 'XLSHLSSynthFlow', 'HLSFACTORY_XLS_PAT...