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: openroad local resynthesis #560

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions openlane/flows/classic.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class Classic(SequentialFlow):
OpenROAD.CheckMacroInstances,
OpenROAD.STAPrePNR,
OpenROAD.Floorplan,
OpenROAD.RMP,
OpenROAD.STAPrePNR,
Odb.CheckMacroAntennaProperties,
Odb.SetPowerConnections,
Odb.ManualMacroPlacement,
Expand Down
30 changes: 30 additions & 0 deletions openlane/scripts/openroad/restructure.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
source $::env(SCRIPTS_DIR)/openroad/common/io.tcl

read_current_odb

if { $::env(RMP_TARGET) == "timing" } {
repair_design
repair_timing
}
set arg_list [list]
lappend arg_list -tiehi_port $::env(SYNTH_TIEHI_CELL)
lappend arg_list -tielo_port $::env(SYNTH_TIELO_CELL)
lappend arg_list -work_dir $::env(STEP_DIR)
lappend arg_list -abc_logfile $::env(_RMP_ABC_LOG)
lappend arg_list -liberty_file $::env(_RMP_LIB)
lappend arg_list -target $::env(RMP_TARGET)
if { [info exists ::env(RMP_DEPTH_THRESHOLD)] } {
lappend arg_list -depth_threshold $::env(RMP_DEPTH_THRESHOLD)
}
if { [info exists ::env(RMP_SLACK_THRESHOLD)] } {
lappend arg_list -slack_threshold $::env(RMP_SLACK_THRESHOLD)
}
restructure {*}$arg_list
remove_buffers
if { $::env(RMP_TARGET) == "timing" } {
repair_design
repair_timing
remove_buffers
}
write_views
report_design_area_metrics
54 changes: 54 additions & 0 deletions openlane/steps/openroad.py
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,60 @@ def run(
return super().run(state_in, env=env, **kwargs)


@Step.factory.register()
class RMP(OpenROADStep):
id = "OpenROAD.RMP"
name = "Restructure RMP"

config_vars = OpenROADStep.config_vars + [
Variable(
"RMP_CORNER",
Optional[str],
description="IPVT corner to use during restructure. If unspecified, the value for `DEFAULT_CORNER` from the PDK will be used.",
),
Variable(
"RMP_TARGET",
Literal["timing", "area"],
description="In area mode, the focus is area reduction, and timing may degrade. In delay mode, delay is likely reduced, but the area may increase",
default="area",
),
Variable(
"RMP_SLACK_THRESHOLD",
Optional[Decimal],
description="Specifies a (setup) timing slack value below which timing paths need to be analyzed for restructuring",
),
Variable(
"RMP_DEPTH_THRESHOLD",
Optional[int],
description="Specifies the path depth above which a timing path would be considered for restructuring",
),
]

def get_script_path(self):
return os.path.join(get_script_dir(), "openroad", "restructure.tcl")

def run(self, state_in: State, **kwargs) -> Tuple[ViewsUpdate, MetricsUpdate]:
kwargs, env = self.extract_env(kwargs)
lib_list = self.toolbox.filter_views(
self.config, self.config["LIB"], timing_corner=self.config.get("RMP_CORNER")
)

excluded_cells: Set[str] = set(self.config["EXTRA_EXCLUDED_CELLS"] or [])
excluded_cells.update(
process_list_file(self.config["SYNTH_EXCLUDED_CELL_FILE"])
)
excluded_cells.update(process_list_file(self.config["PNR_EXCLUDED_CELL_FILE"]))
trimmed_lib = self.toolbox.remove_cells_from_lib(
frozenset([str(lib) for lib in lib_list]),
excluded_cells=frozenset(excluded_cells),
)
env["_RMP_LIB"] = TclStep.value_to_tcl(trimmed_lib)
env["_RMP_ABC_LOG"] = TclStep.value_to_tcl(
os.path.join(self.step_dir, "abc.log")
)
return super().run(state_in, env=env, **kwargs)


@Step.factory.register()
class CTS(ResizerStep):
"""
Expand Down
Loading