Skip to content

Commit

Permalink
Skip certain steps when non relative floorplan mode is running
Browse files Browse the repository at this point in the history
  • Loading branch information
kareefardi committed Jan 24, 2024
1 parent 839e736 commit e4fccda
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions openlane/steps/openroad.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import tempfile
import functools
import subprocess
from enum import StrEnum
from math import inf
from glob import glob
from decimal import Decimal
Expand Down Expand Up @@ -50,7 +51,7 @@
routing_layer_variables,
)

from ..config import Variable
from ..config import Variable, Config
from ..config.flow import option_variables
from ..state import State, DesignFormat
from ..logging import debug, err, info, warn, verbose, console, options
Expand Down Expand Up @@ -719,19 +720,25 @@ class Floorplan(OpenROADStep):
),
]

class Mode(StrEnum):
template = "template"
absolute = "absolute"
relative = "relative"

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

def __get_floorplan_mode(self) -> str:
@classmethod
def get_mode(Self, config: Config) -> Mode:
mode = ""
if self.config["FP_DEF_TEMPLATE"] and self.config["DIE_AREA"]:
if config.get("FP_DEF_TEMPLATE") and config.get("DIE_AREA"):
warn("Specifing DIE_AREA with FP_DEF_TEMPLATE is redundant")
if self.config["FP_DEF_TEMPLATE"]:
mode = "template"
elif self.config["DIE_AREA"]:
mode = "absolute"
if config.get("FP_DEF_TEMPLATE"):
mode = Self.Mode.template
elif config.get("DIE_AREA"):
mode = Self.Mode.absolute
else:
mode = "relative"
mode = Self.Mode.relative
return mode

def run(self, state_in: State, **kwargs) -> Tuple[ViewsUpdate, MetricsUpdate]:
Expand All @@ -744,7 +751,7 @@ def run(self, state_in: State, **kwargs) -> Tuple[ViewsUpdate, MetricsUpdate]:

kwargs, env = self.extract_env(kwargs)
env["TRACKS_INFO_FILE_PROCESSED"] = new_tracks_info
env["_FP_MODE"] = self.__get_floorplan_mode()
env["_FP_MODE"] = self.get_mode(self.config)
return super().run(state_in, env=env, **kwargs)


Expand Down Expand Up @@ -792,6 +799,8 @@ def run(self, state_in: State, **kwargs) -> Tuple[ViewsUpdate, MetricsUpdate]:
if self.config["FP_PIN_ORDER_CFG"] is not None:
info(f"FP_PIN_ORDER_CFG is set. Skipping '{self.id}'…")
return {}, {}
if Floorplan.get_mode(self.config) != Floorplan.Mode.relative:
return {}, {}

return super().run(state_in, **kwargs)

Expand Down Expand Up @@ -1020,6 +1029,10 @@ def run(self, state_in: State, **kwargs) -> Tuple[ViewsUpdate, MetricsUpdate]:
f"'PL_TARGET_DENSITY_PCT' not explicitly set, using dynamically calculated target density: {expr}…"
)
env["__PL_SKIP_IO"] = "1"

if Floorplan.get_mode(self.config) != Floorplan.Mode.relative:
return {}, {}

return OpenROADStep.run(self, state_in, env=env, **kwargs)


Expand Down

0 comments on commit e4fccda

Please sign in to comment.