Skip to content

Commit

Permalink
bugfix and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Feb 13, 2025
1 parent 0afeaaf commit 4a0fc3f
Show file tree
Hide file tree
Showing 6 changed files with 453 additions and 346 deletions.
2 changes: 1 addition & 1 deletion openlane/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
ScopedFile,
)
from .toolbox import Toolbox
from .drc import DRC, Violation
from .drc import DRC, Violation, BoundingBox
from . import cli
from .tpe import get_tpe, set_tpe
from .ring_buffer import RingBuffer
23 changes: 17 additions & 6 deletions openlane/common/drc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2023 Efabless Corporation
# Copyright 2020-2025 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,17 +18,20 @@
from enum import IntEnum
from decimal import Decimal, InvalidOperation
from dataclasses import dataclass, field, asdict
from typing import List, Optional, Tuple, Dict
from typing import List, Optional, Tuple, Dict, Iterable


@dataclass
class BoundingBox:
class BoundingBox(Iterable[Decimal]):
llx: Decimal
lly: Decimal
urx: Decimal
ury: Decimal
info: Optional[str] = None

def __iter__(self):
return iter([self.llx, self.lly, self.urx, self.ury])


@dataclass
class Violation:
Expand Down Expand Up @@ -83,20 +86,28 @@ class State(IntEnum):
vio_type = src1 = src2 = lly = llx = urx = ury = ""
for line in report:
line = line.strip()
if line.strip() == "":
continue
if state == State.vio_type:
vio_match = re_violation.match(line)
assert vio_match is not None, "Error while parsing drc report file"
assert (
vio_match is not None
), f"Error while parsing drc report file: Could not match violation line '{line}'"
vio_type = vio_match.group("type")
state = State.src
elif state == State.src:
src_match = re_src.match(line)
assert src_match is not None, "Error while parsing drc report file"
assert (
src_match is not None
), f"Error while parsing drc report file: Could not match source line '{line}'"
src1 = src_match.group("src1")
src2 = src_match.group("src2")
state = State.bbox
elif state == State.bbox:
bbox_match = re_bbox.match(line)
assert bbox_match is not None, "Error while parsing drc report file"
assert (
bbox_match is not None
), f"Error while parsing drc report file: Could not match bbox line '{line}'"
llx = bbox_match.group("llx")
lly = bbox_match.group("lly")
urx = bbox_match.group("urx")
Expand Down
2 changes: 1 addition & 1 deletion openlane/steps/openroad.py
Original file line number Diff line number Diff line change
Expand Up @@ -1734,7 +1734,7 @@ class DetailedRouting(OpenROADStep):
Variable(
"DRT_SAVE_DRC_REPORT_ITERS",
Optional[int],
"Report DRC on each specified iteration. Set to 1 when DRT_SAVE_DRC_REPORT_ITERS in enabled",
"Write a DRC report every N iterations. If DRT_SAVE_SNAPSHOTS is enabled, there is an implicit default value of 1.",
),
]

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openlane"
version = "3.0.0.dev15"
version = "3.0.0.dev16"
description = "An infrastructure for implementing chip design flows"
authors = ["Efabless Corporation and Contributors <[email protected]>"]
readme = "Readme.md"
Expand Down
Loading

0 comments on commit 4a0fc3f

Please sign in to comment.