piel.tools.openlane#

Subpackages#

Submodules#

Package Contents#

Functions#

get_design_from_openlane_migration(v1, design_name_v1, ...)

This function provides the integration mechanism for easily migrating the interconnection with other toolsets from an OpenLane v1 design to an OpenLane v2 design.

extract_datetime_from_path(→ str)

Extracts the datetime from a given run_path and returns it as a string.

find_all_design_runs(→ list[pathlib.Path])

For a given design_directory, the openlane output can be found in the runs subdirectory. This function sorts the runs according to the default notations between both openlane and openlane2 run formats.

find_latest_design_run(design_directory, run_name, ...)

For a given design_directory, the openlane output can be found in the runs subdirectory. This function sorts the runs according to the default notations between both openlane and openlane2 run formats.

get_gds_path_from_design_run(→ pathlib.Path)

Returns the path to the final GDS generated by OpenLane.

get_design_run_version(→ Literal[v1, v2])

Returns the version of the design run.

sort_design_runs(→ dict[str, list[pathlib.Path]])

For a given design_directory, the openlane output can be found in the runs subdirectory. This function sorts the runs according to the default notations between both openlane and openlane2 run formats.

check_config_json_exists_openlane_v1(→ bool)

Checks if a design has a config.json file.

check_design_exists_openlane_v1(→ bool)

Checks if a design exists in the OpenLane v1 design folder.

configure_and_run_design_openlane_v1(→ None)

Configures and runs an OpenLane v1 design.

configure_parametric_designs_openlane_v1(→ list)

For a given source_design_directory, this function reads in the config.json file and returns a set of parametric sweeps that gets used when creating a set of parametric designs.

configure_flow_script_openlane_v1(→ None)

Configures the OpenLane v1 flow script after checking that the design directory exists.

create_parametric_designs_openlane_v1(→ None)

Takes a OpenLane v1 source directory and creates a parametric combination of these designs.

get_design_directory_from_root_openlane_v1(→ pathlib.Path)

Gets the design directory from the root directory.

get_latest_version_root_openlane_v1(→ pathlib.Path)

Gets the latest version root of OpenLane v1.

read_configuration_openlane_v1(→ dict)

Reads a config.json from a design directory.

write_configuration_openlane_v1(→ None)

Writes a config.json onto a design_directory

filter_timing_sta_files(file_list)

Filter the timing sta files from the list of files

filter_power_sta_files(file_list)

Filter the power sta files from the list of files

get_all_timing_sta_files(run_directory)

This function aims to list and perform analysis on all the relevant files in a particular run between all the corners.

get_all_power_sta_files(run_directory)

This function aims to list and perform analysis on all the relevant files in a particular run between all the corners.

calculate_max_frame_amount(file_lines_data)

Calculate the maximum frame amount based on the frame IDs in the DataFrame

calculate_propagation_delay_from_file(file_path)

Calculate the propagation delay for each frame in the file

calculate_propagation_delay_from_timing_data(...)

Calculate the propagation delay between two nets

configure_timing_data_rows(file_lines_data)

Identify the timing data lines for each frame and creates a metadata dictionary for frames.

configure_frame_id(file_lines_data)

Identify the frame delimiters and assign frame ID to each line in the file

filter_timing_data_by_net_name_and_type(timing_data, ...)

Filter the timing data by net name and type

get_frame_meta_data(file_lines_data)

Get the frame metadata

get_frame_lines_data(file_path)

Calculate the timing data for each frame in the file

get_frame_timing_data(file, frame_meta_data[, frame_id])

Extract the timing data from the file

get_all_timing_data_from_file(file_path)

Calculate the timing data for each frame in the file

read_sta_rpt_fwf_file(file, frame_meta_data[, frame_id])

Read the fixed width file and return a DataFrame

contains_in_lines(file_lines_data, keyword)

Check if the keyword is contained in the file lines

create_file_lines_dataframe(file_lines_raw)

Create a DataFrame from the raw lines of a file

get_file_line_by_keyword(file_lines_data, keyword, regex)

Extract the data from the file lines using the given keyword and regex

read_file_lines(file_path)

Extract lines from the file

get_all_designs_metrics_openlane_v2(output_directory, ...)

Returns a dictionary of all the metrics for all the designs in the output directory.

read_metrics_openlane_v2(→ dict)

Read design metrics from OpenLane v2 run files.

run_openlane_flow([configuration, design_directory, ...])

Runs the OpenLane v2 flow.

get_design_from_openlane_migration(v1: bool = True, design_name_v1: str | None = None, design_directory: str | pathlib.Path | None = None, root_directory_v1: str | pathlib.Path | None = None)[source]#

This function provides the integration mechanism for easily migrating the interconnection with other toolsets from an OpenLane v1 design to an OpenLane v2 design.

This function checks if the inputs are to be treated as v1 inputs. If so, and a design_name is provided then it will set the design_directory to the corresponding design_name directory in the corresponding root_directory_v1 / designs. If no root_directory is provided then it returns $OPENLANE_ROOT/”<latest>”/. If a `design_directory is provided then this will always take precedence even with a v1 flag.

Parameters:
  • v1 (bool) – If True, it will migrate from v1 to v2.

  • design_name_v1 (str) – Design name of the v1 design that can be found within $OPENLANE_ROOT/”<latest>”/designs.

  • design_directory (str) – Design directory PATH. Optional path for v2-based designs.

  • root_directory_v1 (str) – Root directory of OpenLane v1. If set to None it will return $OPENLANE_ROOT/”<latest>”

Returns:

None

extract_datetime_from_path(run_path: pathlib.Path) str[source]#

Extracts the datetime from a given run_path and returns it as a string.

find_all_design_runs(design_directory: piel.types.piel_path_types, run_name: str | None = None) list[pathlib.Path][source]#

For a given design_directory, the openlane output can be found in the runs subdirectory. This function sorts the runs according to the default notations between both openlane and openlane2 run formats.

If a run_name is specified, then the function will return the exact run if it exists. Otherwise, it will return the latest run

Parameters:
  • design_directory (piel_path_types) – The path to the design directory

  • run_name (str, optional) – The name of the run to return. Defaults to None.

  • version (Literal["v1", "v2"], optional) – The version of OpenLane to use. Defaults to None.

Raises:

ValueError – If the run_name is specified but not found in the design_directory

Returns:

A list of pathlib.Path objects corresponding to the runs

Return type:

list[pathlib.Path]

find_latest_design_run(design_directory: piel.types.piel_path_types, run_name: str | None = None, version: Literal[v1, v2] | None = None)[source]#

For a given design_directory, the openlane output can be found in the runs subdirectory. This function sorts the runs according to the default notations between both openlane and openlane2 run formats.

If a run_name is specified, then the function will return the exact run if it exists. Otherwise, it will return the latest run.

Parameters:
  • design_directory (piel_path_types) – The path to the design directory

  • run_name (str, optional) – The name of the run to return. Defaults to None.

  • version (Literal["v1", "v2"], optional) – The version of the run to return. Defaults to None.

Raises:

ValueError – If the run_name is specified but not found in the design_directory

Returns:

A tuple of the latest run path and the version

Return type:

(pathlib.Path, str)

get_gds_path_from_design_run(design_directory: piel.types.piel_path_types, run_directory: piel.types.piel_path_types | None = None) pathlib.Path[source]#

Returns the path to the final GDS generated by OpenLane.

Parameters:
  • design_directory (piel_path_types) – The path to the design directory

  • run_directory (piel_path_types, optional) – The path to the run directory. Defaults to None. Otherwise gets the latest run.

Returns:

The path to the final GDS

Return type:

pathlib.Path

get_design_run_version(run_directory: piel.types.piel_path_types) Literal[v1, v2][source]#

Returns the version of the design run.

sort_design_runs(path_list: list[pathlib.Path]) dict[str, list[pathlib.Path]][source]#

For a given design_directory, the openlane output can be found in the runs subdirectory. This function sorts the runs according to the default notations between both openlane and openlane2 run formats.

Parameters:

path_list (list[pathlib.Path]) – A list of pathlib.Path objects corresponding to the runs

Returns:

A dictionary of sorted runs

Return type:

dict[str, list[pathlib.Path]]

check_config_json_exists_openlane_v1(design_name: str, root_directory: str | pathlib.Path | None = None) bool[source]#

Checks if a design has a config.json file.

Parameters:

design_name (str) – Name of the design.

Returns:

True if config.json exists.

Return type:

config_json_exists(bool)

check_design_exists_openlane_v1(design_name: str, root_directory: str | pathlib.Path | None = None) bool[source]#

Checks if a design exists in the OpenLane v1 design folder.

Lists all designs inside the Openlane V1 design root.

Parameters:

design_name (str) – Name of the design.

Returns:

True if design exists.

Return type:

design_exists(bool)

configure_and_run_design_openlane_v1(design_name: str, configuration: dict | None = None, root_directory: str | pathlib.Path | None = None) None[source]#

Configures and runs an OpenLane v1 design.

This function does the following: 1. Check that the design_directory provided is under $OPENLANE_ROOT/<latestversion>/designs 2. Check if config.json has already been provided for this design. If a configuration dictionary is inputted into the function parameters, then it overwrites the default config.json. 3. Create a script directory, a script is written and permissions are provided for it to be executable. 4. Permit and execute the openlane_flow.sh script in the scripts directory.

Parameters:
  • design_name (str) – Name of the design.

  • configuration (dict | None) – Configuration dictionary.

  • root_directory (str | pathlib.Path) – Design directory.

Returns:

None

configure_parametric_designs_openlane_v1(design_name: str, parameter_sweep_dictionary: dict, add_id: bool = True) list[source]#

For a given source_design_directory, this function reads in the config.json file and returns a set of parametric sweeps that gets used when creating a set of parametric designs.

Parameters:
  • add_id (bool) – Add an ID to the design name. Defaults to True.

  • parameter_sweep_dictionary (dict) – Dictionary of parameters to sweep.

  • source_design_directory (str | pathlib.Path) – Source design directory.

Returns:

List of configurations to sweep.

Return type:

configuration_sweep(list)

configure_flow_script_openlane_v1(design_name: str, root_directory: str | pathlib.Path | None = None) None[source]#

Configures the OpenLane v1 flow script after checking that the design directory exists.

Parameters:

design_directory (str | pathlib.Path | None) – Design directory. Defaults to latest OpenLane root.

Returns:

None

create_parametric_designs_openlane_v1(design_name: str, parameter_sweep_dictionary: dict, target_directory: str | pathlib.Path | None = None) None[source]#

Takes a OpenLane v1 source directory and creates a parametric combination of these designs.

Parameters:
  • design_name (str) – Name of the design.

  • parameter_sweep_dictionary (dict) – Dictionary of parameters to sweep.

  • target_directory (str | pathlib.Path | None) – Optional target directory.

Returns:

None

get_design_directory_from_root_openlane_v1(design_name: str, root_directory: str | pathlib.Path | None = None) pathlib.Path[source]#

Gets the design directory from the root directory.

Parameters:
  • design_name (str) – Name of the design.

  • root_directory (str | pathlib.Path) – Design directory.

Returns:

Design directory.

Return type:

design_directory(pathlib.Path)

get_latest_version_root_openlane_v1() pathlib.Path[source]#

Gets the latest version root of OpenLane v1.

read_configuration_openlane_v1(design_name: str, root_directory: str | pathlib.Path | None = None) dict[source]#

Reads a config.json from a design directory.

Parameters:
  • design_name (str) – Design name.

  • root_directory (str | pathlib.Path) – Design directory.

Returns:

Configuration dictionary.

Return type:

configuration(dict)

write_configuration_openlane_v1(configuration: dict, design_directory: piel.types.piel_path_types) None[source]#

Writes a config.json onto a design_directory

Parameters:
  • configuration (dict) – OpenLane configuration dictionary.

  • design_directory (str) – Design directory PATH.

Returns:

None

filter_timing_sta_files(file_list)[source]#

Filter the timing sta files from the list of files

Parameters:

file_list (list) – List containing the file paths

Returns:

List containing the timing sta files

Return type:

timing_sta_files (list)

filter_power_sta_files(file_list)[source]#

Filter the power sta files from the list of files

Parameters:

file_list (list) – List containing the file paths

Returns:

List containing the power sta files

Return type:

power_sta_files (list)

get_all_timing_sta_files(run_directory)[source]#

This function aims to list and perform analysis on all the relevant files in a particular run between all the corners.

Parameters:

run_directory (str, optional) – The run directory to perform the analysis on. Defaults to None.

Returns:

List of all the .rpt files in the run directory.

Return type:

timing_sta_files_list (list)

get_all_power_sta_files(run_directory)[source]#

This function aims to list and perform analysis on all the relevant files in a particular run between all the corners.

Parameters:

run_directory (str, optional) – The run directory to perform the analysis on. Defaults to None.

Returns:

List of all the .rpt files in the run directory.

Return type:

power_sta_files_list (list)

calculate_max_frame_amount(file_lines_data: pandas.DataFrame)[source]#

Calculate the maximum frame amount based on the frame IDs in the DataFrame

Parameters:

file_lines_data (pd.DataFrame) – Dataframe containing the file lines

Returns:

Maximum number of frames in the file

Return type:

maximum_frame_amount (int)

calculate_propagation_delay_from_file(file_path: str | pathlib.Path)[source]#

Calculate the propagation delay for each frame in the file

Parameters:

file_path (str | pathlib.Path) – Path to the file

Returns:

Dictionary containing the propagation delay

Return type:

propagation_delay (dict)

calculate_propagation_delay_from_timing_data(net_name_in: str, net_name_out: str, timing_data: pandas.DataFrame)[source]#

Calculate the propagation delay between two nets

Parameters:
  • net_name_in (str) – Name of the input net

  • net_name_out (str) – Name of the output net

  • timing_data (pd.DataFrame) – Dataframe containing the timing data

Returns:

Dataframe containing the propagation delay

Return type:

propagation_delay_dataframe (pd.DataFrame)

configure_timing_data_rows(file_lines_data: pandas.DataFrame)[source]#

Identify the timing data lines for each frame and creates a metadata dictionary for frames.

Parameters:

file_lines_data (pd.DataFrame) – Dataframe containing the file lines

Returns:

Dictionary containing the frame metadata

Return type:

frame_meta_data (dict)

configure_frame_id(file_lines_data: pandas.DataFrame)[source]#

Identify the frame delimiters and assign frame ID to each line in the file

Parameters:

file_lines_data (pd.DataFrame) – Dataframe containing the file lines

Returns:

Dataframe containing the file lines

Return type:

file_lines_data (pd.DataFrame)

filter_timing_data_by_net_name_and_type(timing_data: pandas.DataFrame, net_name: str, net_type: str)[source]#

Filter the timing data by net name and type

Parameters:
  • timing_data (pd.DataFrame) – DataFrame containing the timing data

  • net_name (str) – Net name to be filtered

  • net_type (str) – Net type to be filtered

Returns:

DataFrame containing the timing data

Return type:

timing_data (pd.DataFrame)

get_frame_meta_data(file_lines_data)[source]#

Get the frame metadata

Parameters:

file_lines_data (pd.DataFrame) – DataFrame containing the file lines

Returns:

DataFrame containing the start point name end_point_name (pd.DataFrame): DataFrame containing the end point name path_group_name (pd.DataFrame): DataFrame containing the path group name path_type_name (pd.DataFrame): DataFrame containing the path type name

Return type:

start_point_name (pd.DataFrame)

get_frame_lines_data(file_path: str | pathlib.Path)[source]#

Calculate the timing data for each frame in the file

Parameters:

file_path (str | pathlib.Path) – Path to the file

Returns:

DataFrame containing the file lines

Return type:

file_lines_data (pd.DataFrame)

get_frame_timing_data(file: str | pathlib.Path, frame_meta_data: dict, frame_id: int = 0)[source]#

Extract the timing data from the file

Parameters:
  • file (str | pathlib.Path) – Address of the file

  • frame_meta_data (dict) – Dictionary containing the frame metadata

  • frame_id (int) – Frame ID to be read

Returns:

DataFrame containing the timing data

Return type:

timing_data (pd.DataFrame)

get_all_timing_data_from_file(file_path: str | pathlib.Path)[source]#

Calculate the timing data for each frame in the file

Parameters:

file_path (str | pathlib.Path) – Path to the file

Returns:

Dictionary containing the timing data for each frame

Return type:

frame_timing_data (dict)

read_sta_rpt_fwf_file(file: str | pathlib.Path, frame_meta_data: dict, frame_id: int = 0)[source]#

Read the fixed width file and return a DataFrame

Parameters:
  • file (str | pathlib.Path) – Address of the file

  • frame_meta_data (dict) – Dictionary containing the frame metadata

  • frame_id (int) – Frame ID to be read

Returns:

DataFrame containing the file data

Return type:

file_data (pd.DataFrame)

contains_in_lines(file_lines_data: pandas.DataFrame, keyword: str)[source]#

Check if the keyword is contained in the file lines

Parameters:
  • file_lines_data (pd.DataFrame) – Dataframe containing the file lines

  • keyword (str) – Keyword to search for

Returns:

Dataframe containing the file lines

Return type:

file_lines_data (pd.DataFrame)

create_file_lines_dataframe(file_lines_raw)[source]#

Create a DataFrame from the raw lines of a file

Parameters:

file_lines_raw (list) – list containing the file lines

Returns:

Dataframe containing the file lines

Return type:

file_lines_data (pd.DataFrame)

get_file_line_by_keyword(file_lines_data: pandas.DataFrame, keyword: str, regex: str)[source]#

Extract the data from the file lines using the given keyword and regex

Parameters:
  • file_lines_data (pd.DataFrame) – Dataframe containing the file lines

  • keyword (str) – Keyword to search for

  • regex (str) – Regex to extract the data

Returns:

Dataframe containing the extracted values

Return type:

extracted_values (pd.DataFrame)

read_file_lines(file_path: str | pathlib.Path)[source]#

Extract lines from the file

Parameters:

file_path (str | pathlib.Path) – Path to the file

Returns:

list containing the file lines

Return type:

file_lines_raw (list)

get_all_designs_metrics_openlane_v2(output_directory: piel.types.piel_path_types, target_prefix: str)[source]#

Returns a dictionary of all the metrics for all the designs in the output directory.

Usage:

```python from piel.tools.openlane import get_all_designs_metrics_v2

metrics = get_all_designs_metrics_v2(

output_directory=”output”, target_prefix=”design”,

Parameters:
  • output_directory (piel_path_types) – The path to the output directory.

  • target_prefix (str) – The prefix of the designs to get the metrics for.

Returns:

A dictionary of all the metrics for all the designs in the output directory.

Return type:

dict

read_metrics_openlane_v2(design_directory: piel.types.piel_path_types) dict[source]#

Read design metrics from OpenLane v2 run files.

Parameters:

design_directory (piel_path_types) – Design directory PATH.

Returns:

Metrics dictionary.

Return type:

dict

run_openlane_flow(configuration: dict | None = None, design_directory: piel.types.piel_path_types = '.', parallel_asynchronous_run: bool = False, only_generate_flow_setup: bool = False)[source]#

Runs the OpenLane v2 flow.

Parameters:
  • configuration (dict) – OpenLane configuration dictionary. If none is present it will default to the config.json file on the design_directory.

  • design_directory (piel_path_types) – Design directory PATH.

  • parallel_asynchronous_run (bool) – Run the flow in parallel.

  • only_generate_flow_setup (bool) – Only generate the flow setup.

Returns: