Skip to content

Commit

Permalink
Add placed field for macro instances
Browse files Browse the repository at this point in the history
Make macro instances location and orientation optional
  • Loading branch information
kareefardi committed Jan 24, 2024
1 parent 0437a58 commit 83adbb3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
11 changes: 8 additions & 3 deletions openlane/config/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ class Instance:
:param location: The physical co-ordinates of the Macro's origin.
:param orientation: Whether the Macro is facing North or South.
:param placed: Whether the Macro is already placed or not. Useful with macros inside macros.
"""

location: Tuple[Decimal, Decimal]
orientation: Orientation
location: Optional[Tuple[Decimal, Decimal]]
orientation: Optional[Orientation]
placed: Optional[bool]


@dataclass
Expand Down Expand Up @@ -196,9 +198,12 @@ def instantiate(
instance_name: str,
location: Tuple[Number, Number],
orientation: Orientation = Orientation.N,
placed: bool = False,
):
location = (Decimal(location[0]), Decimal(location[1]))
self.instances[instance_name] = Instance(location, Orientation[orientation])
self.instances[instance_name] = Instance(
location, Orientation[orientation], placed
)


def is_optional(t: Type[Any]) -> bool:
Expand Down
19 changes: 16 additions & 3 deletions openlane/steps/odb.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,22 @@ def run(self, state_in: State, **kwargs) -> Tuple[ViewsUpdate, MetricsUpdate]:
f"Misconstructed configuration: macro definition for key {module} is not of type 'Macro'."
)
for name, data in macro.instances.items():
f.write(
f"{name} {data.location[0]} {data.location[1]} {data.orientation}\n"
)
if data.placed:
info(
f"Not placing already placed marco instance: {name}."
)
else:
if not data.location:
raise StepException(
f"Unspecified key: location for non-placed macro instance: {name}."
)
if not data.orientation:
raise StepException(
f"Unspecified key: orientation> for non-placed macro instance: {name}"
)
f.write(
f"{name} {data.location[0]} {data.location[1]} {data.orientation}\n"
)

if not cfg_file.exists():
info(f"No instances found, skipping '{self.id}'…")
Expand Down

0 comments on commit 83adbb3

Please sign in to comment.