Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expand synthesis options, initial state elements in cli #604

Merged
merged 18 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,36 @@
## Documentation
-->

# 2.3.0

## Steps

* `OpenROAD.GlobalPlacement`

* Exposed `-routability_check_overflow` argument as new variable
`PL_ROUTABILITY_OVERFLOW_THRESHOLD`.

* `Yosys.*Synthesis`

* Created new variable `SYNTH_HIERARCHY_MODE`, replacing `SYNTH_NO_FLAT`.
There are three options, `flatten`, `deferred_flatten` and `keep`. The first
two correspond to `SYNTH_NO_FLAT` being false and true respectively. The
third keeps the hierarchy in the final netlist.
* Created new variable `SYNTH_TIE_UNDEFINED` to customize whether undefined
and undriven values are tied low, high, or left as-is.
* Created new variable `SYNTH_WRITE_NOATTR` to allow attributes to be
propagated to the final netlist.

* Created `Yosys.Resynthesis`

* Like `Yosys.Synthesis`, but uses the current input state netlist as an input
instead of RTL files

## CLI

* Added new option: `-e`/`--initial-state-element-override`: allows an element
in the initial state to be overridden straight from the commandline.

# 2.2.9

## Steps
Expand Down
23 changes: 11 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
};

inputs.libparse.inputs.nixpkgs.follows = "nix-eda/nixpkgs";
inputs.ioplace-parser.inputs.nixpkgs.follows = "nix-eda/nixpkgs";
inputs.ioplace-parser.inputs.nix-eda.follows = "nix-eda";
kareefardi marked this conversation as resolved.
Show resolved Hide resolved
inputs.volare.inputs.nixpkgs.follows = "nix-eda/nixpkgs";
inputs.devshell.inputs.nixpkgs.follows = "nix-eda/nixpkgs";

Expand Down
5 changes: 3 additions & 2 deletions nix/create-shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
{
extra-packages ? [],
extra-python-packages ? [],
extra-env ? [],
openlane-plugins ? [],
include-openlane ? true
include-openlane ? true,
}: ({
lib,
git,
Expand Down Expand Up @@ -62,7 +63,7 @@ in
name = "NIX_PYTHONPATH";
value = "${openlane-env-sitepackages}";
}
];
] ++ extra-env;
devshell.interactive.PS1 = {
text = ''PS1="${prompt}"'';
};
Expand Down
52 changes: 35 additions & 17 deletions openlane/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@
from functools import partial
from typing import Any, Dict, Sequence, Tuple, Type, Optional, List, Union

from click import (
Parameter,
Context,
Path,
pass_context,
)
import click
from cloup import (
option,
option_group,
Expand All @@ -40,7 +35,7 @@


from .__version__ import __version__
from .state import State
from .state import State, DesignFormat
from .logging import (
debug,
err,
Expand All @@ -56,7 +51,7 @@


def run(
ctx: Context,
ctx: click.Context,
flow_name: Optional[str],
pdk_root: Optional[str],
pdk: str,
Expand All @@ -73,6 +68,7 @@ def run(
config_override_strings: List[str],
_force_run_dir: Optional[str],
design_dir: Optional[str],
initial_state_element_override: Sequence[str],
view_save_path: Optional[str] = None,
ef_view_save_path: Optional[str] = None,
):
Expand All @@ -97,6 +93,27 @@ def run(
if flow_description is None:
flow_description = "Classic"

if len(initial_state_element_override):
if with_initial_state is None:
with_initial_state = State()
overrides = {}
for element in initial_state_element_override:
element_split = element.split("=", maxsplit=1)
if len(element_split) < 2:
err(f"Invalid initial state element override: '{element}'.")
ctx.exit(1)
df_id, path = element_split
design_format = DesignFormat.by_id(df_id)
if design_format is None:
err(f"Invalid design format ID: '{df_id}'.")
ctx.exit(1)
overrides[design_format] = common.Path(path)

with_initial_state = with_initial_state.__class__(
with_initial_state,
overrides=overrides,
)

TargetFlow: Type[Flow]

if isinstance(flow_description, str):
Expand Down Expand Up @@ -170,7 +187,7 @@ def run(
flow._save_snapshot_ef(evsp)


def print_version(ctx: Context, param: Parameter, value: bool):
def print_version(ctx: click.Context, param: click.Parameter, value: bool):
if not value:
return

Expand Down Expand Up @@ -198,8 +215,8 @@ def print_version(ctx: Context, param: Parameter, value: bool):


def print_bare_version(
ctx: Context,
param: Parameter,
ctx: click.Context,
param: click.Parameter,
value: bool,
):
if not value:
Expand All @@ -209,7 +226,7 @@ def print_bare_version(


def run_included_example(
ctx: Context,
ctx: click.Context,
smoke_test: bool,
example: Optional[str],
**kwargs,
Expand Down Expand Up @@ -285,8 +302,8 @@ def run_included_example(


def cli_in_container(
ctx: Context,
param: Parameter,
ctx: click.Context,
param: click.Parameter,
value: bool,
):
if not value:
Expand Down Expand Up @@ -331,14 +348,14 @@ def cli_in_container(
o(
"--save-views-to",
"view_save_path",
type=Path(file_okay=False, dir_okay=True),
type=click.Path(file_okay=False, dir_okay=True),
default=None,
help="A directory to copy the final views to, where each format is saved under a directory named after the corner ID (much like the 'final' directory after running a flow.)",
),
o(
"--ef-save-views-to",
"ef_view_save_path",
type=Path(file_okay=False, dir_okay=True),
type=click.Path(file_okay=False, dir_okay=True),
default=None,
help="A directory to copy the final views to in the Efabless format, compatible with Caravel User Project.",
),
Expand Down Expand Up @@ -401,8 +418,9 @@ def cli_in_container(
_enable_debug_flags=True,
sequential_flow_reproducible=True,
enable_overwrite_flag=True,
enable_initial_state_element=True,
)
@pass_context
@click.pass_context
def cli(ctx, /, **kwargs):
"""
Runs an OpenLane flow via the commandline using a design configuration
Expand Down
12 changes: 11 additions & 1 deletion openlane/flows/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def cloup_flow_opts(
volare_pdk_override: Optional[str] = None,
_enable_debug_flags: bool = False,
enable_overwrite_flag: bool = False,
enable_initial_state_element: bool = False,
) -> Decorator:
"""
Creates a wrapper that appends a number of OpenLane flow-related flags to a
Expand Down Expand Up @@ -214,7 +215,7 @@ def decorate(f):
),
default=None,
callback=initial_state_cb,
help="Use this JSON file as an initial state. If this is not specified, the latest `state_out.json` of the run directory will be used if available.",
help="Use this JSON file as an initial state. If this is not specified, the latest `state_out.json` of the run directory will be used. If none exist, an empty initial state is created.",
)(f)
f = o(
"--design-dir",
Expand Down Expand Up @@ -381,6 +382,15 @@ def decorate(f):
callback=set_worker_count_cb,
expose_value=False,
)(f)
if enable_initial_state_element:
f = o(
"-e",
"--initial-state-element-override",
type=str,
multiple=True,
default=(),
help="Elements to override in the used initial state in the format DESIGN_FORMAT_ID=PATH",
)(f)
if accept_config_files:
f = argument(
"config_files",
Expand Down
4 changes: 4 additions & 0 deletions openlane/scripts/openroad/gpl.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ if { [info exists ::env(PL_ROUTABILITY_DRIVEN)] && $::env(PL_ROUTABILITY_DRIVEN)
set_macro_extension $::env(GRT_MACRO_EXTENSION)
source $::env(SCRIPTS_DIR)/openroad/common/set_layer_adjustments.tcl
lappend arg_list -routability_driven
if { [info exists ::env(PL_ROUTABILITY_OVERFLOW_THRESHOLD)] } {
lappend arg_list -routability_check_overflow $::env(PL_ROUTABILITY_OVERFLOW_THRESHOLD)
}
}

if { $::env(PL_SKIP_INITIAL_PLACEMENT) } {
Expand All @@ -72,6 +75,7 @@ lappend arg_list -pad_right $cell_pad_side
lappend arg_list -pad_left $cell_pad_side
lappend arg_list -init_wirelength_coef $::env(PL_WIRE_LENGTH_COEF)

puts "+ global_placement $arg_list"
global_placement {*}$arg_list


Expand Down
Loading
Loading