hlsfactory.stratus_flow

Cadence Stratus HLS synthesis flow.

Stratus projects use project.tcl to describe their modules and synthesis configurations. Cadence’s supported batch flow first generates Makefile.prj with bdw_makegen and then executes an hls_* make target. This module follows that flow and reads results through Stratus’s Unified Metrics API.

Module Contents

Classes

DesignHLSSynthData

QoR metrics reported by Stratus HLS.

StratusHLSDesign

Design and tool metadata for a Stratus HLS result.

StratusHLSSynthFlow

Run one Stratus HLS module/configuration and collect its metrics.

Functions

_parse_metric_value

Convert a Stratus metric to an int/float when it is numeric.

parse_metrics_file

Parse the tab-separated file emitted by the metrics Tcl script.

parse_area_metrics_from_synth_log

Read the final allocation area’s seq/comb/black-box/total columns.

auto_find_hls_output_dir

Find the output directory for one Stratus module/configuration pair.

_require_generated_rtl

_tcl_quote

Quote a Python string as a Tcl double-quoted word.

_metrics_tcl

_stratus_environment

Make sibling Stratus executables visible to generated make rules.

Data

API

hlsfactory.stratus_flow._METRICS_TCL_FILENAME = '.hlsfactory_stratus_metrics.tcl'
hlsfactory.stratus_flow._METRICS_TSV_FILENAME = '.hlsfactory_stratus_metrics.tsv'
hlsfactory.stratus_flow.MetricValue = None
hlsfactory.stratus_flow._NUMBER_PATTERN = '[0-9]+(?:\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?|\\.[0-9]+(?:[eE][+-]?[0-9]+)?'
hlsfactory.stratus_flow._TOTAL_AREA_PATTERN = 'compile(...)'
hlsfactory.stratus_flow._parse_metric_value(value: str) → hlsfactory.stratus_flow.MetricValue[source]

Convert a Stratus metric to an int/float when it is numeric.

hlsfactory.stratus_flow.parse_metrics_file(metrics_file: pathlib.Path) → dict[str, hlsfactory.stratus_flow.MetricValue][source]

Parse the tab-separated file emitted by the metrics Tcl script.

hlsfactory.stratus_flow.parse_area_metrics_from_synth_log(synth_log: pathlib.Path) → dict[str, hlsfactory.stratus_flow.MetricValue][source]

Read the final allocation area’s seq/comb/black-box/total columns.

hlsfactory.stratus_flow.auto_find_hls_output_dir(design_dir: pathlib.Path, hls_module: str, hls_config: str) → pathlib.Path[source]

Find the output directory for one Stratus module/configuration pair.

hlsfactory.stratus_flow._require_generated_rtl(output_dir: pathlib.Path) → pathlib.Path[source]
hlsfactory.stratus_flow._tcl_quote(value: str) → str[source]

Quote a Python string as a Tcl double-quoted word.

hlsfactory.stratus_flow._metrics_tcl(project_tcl: pathlib.Path, metrics_file: pathlib.Path, hls_module: str, hls_config: str) → str[source]
class hlsfactory.stratus_flow.DesignHLSSynthData[source]

QoR metrics reported by Stratus HLS.

total_area: float = None
combinational_area: float | None = None
sequential_area: float | None = None
latency_total_cycles: int | float | None = None
latency_cycles: dict[str, int | float] = None
metrics: dict[str, hlsfactory.stratus_flow.MetricValue] = None
classmethod parse_from_metrics_file(metrics_file: pathlib.Path) → hlsfactory.stratus_flow.DesignHLSSynthData[source]
classmethod parse_from_metrics(metrics: dict[str, hlsfactory.stratus_flow.MetricValue], *, source: str) → hlsfactory.stratus_flow.DesignHLSSynthData[source]

Build synthesis data from collected and optionally supplemented metrics.

class hlsfactory.stratus_flow.StratusHLSDesign[source]

Design and tool metadata for a Stratus HLS result.

name: str = None
hls_config: str = None
target_clock_period: float = None
version_stratus: str = None
classmethod parse_from_metrics_file(metrics_file: pathlib.Path, *, hls_module: str, hls_config: str) → hlsfactory.stratus_flow.StratusHLSDesign[source]
hlsfactory.stratus_flow._stratus_environment(*tool_paths: str) → Iterator[None][source]

Make sibling Stratus executables visible to generated make rules.

class hlsfactory.stratus_flow.StratusHLSSynthFlow(stratus_install_dir: str | pathlib.Path | None = None, stratus_bin: str | None = None, bdw_makegen_bin: str | None = None, make_bin: str | None = None, log_output: bool = False, log_execution_time: bool = True)[source]

Bases: hlsfactory.framework.ToolFlow

Run one Stratus HLS module/configuration and collect its metrics.

Initialization

name = 'StratusHLSSynthFlow'
execute(design: hlsfactory.framework.Design, timeout: float | None = None) → list[hlsfactory.framework.Design][source]
_handle_tool_failure(design_dir: pathlib.Path, result: hlsfactory.utils.CallToolResult, timeout: float | None, start_time: float, stage: str) → list[hlsfactory.framework.Design][source]
_write_error(design_dir: pathlib.Path, message: str) → 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.stratus_flow.__all__ = ['DesignHLSSynthData', 'StratusHLSDesign', 'StratusHLSSynthFlow', 'auto_find_hls_output_dir', 'parse...