Skip to content

DRT: Support LEF58_SPACING ADJACENTCUTS EXCEPTSAMEPGNET branch#10164

Open
osamahammad21 wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
osamahammad21:drt-exceptsamepgnet
Open

DRT: Support LEF58_SPACING ADJACENTCUTS EXCEPTSAMEPGNET branch#10164
osamahammad21 wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
osamahammad21:drt-exceptsamepgnet

Conversation

@osamahammad21
Copy link
Copy Markdown
Member

Summary

Support EXCEPTSAMEPGNET branch in LEF58_SPACING ADJACENTCUTS rule.

Type of Change

  • New feature

Impact

None on the current designs

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have signed my commits (DCO).

Signed-off-by: osamahammad21 <osama21@aucegypt.edu>
Signed-off-by: osamahammad21 <osama21@aucegypt.edu>
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors LEF58 area and spacing constraint handling by optimizing RECTWIDTH rule storage and moving unsupported rule warnings to the parser. Feedback identifies that area and width comparisons must be inclusive to comply with LEF58 specifications. Additionally, a return statement in the area check loop should be changed to a break to avoid skipping valid constraints, and the EXCEPTSAMEPGNET branch for adjacent cut spacing requires restoration and proper implementation following its removal during refactoring.

// iterate through rectwidth constraints first
for (auto con : layer->getLef58AreaConstraintsRectWidth()) {
odb::dbTechLayerAreaRule* db_rule = con->getODBRule();
if (width < db_rule->getRectWidth()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

According to the LEF58 specification for AREA, the RECTWIDTH rule applies if the width of the rectangle is less than or equal to the rectWidth value. The current comparison uses < which will skip the rule when the width exactly matches the limit.

Suggested change
if (width < db_rule->getRectWidth()) {
if (width <= db_rule->getRectWidth()) {

apply_rect_width_area = std::min(xLen, yLen) <= min_width;
check_rect_width = !apply_rect_width_area;
return apply_rect_width_area;
return std::min(xLen, yLen) < min_width;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Similar to the check in checkMetalShape_lef58Area, this comparison should be inclusive of the min_width value to adhere to the LEF58 specification.

Suggested change
return std::min(xLen, yLen) < min_width;
return std::min(xLen, yLen) <= min_width;

Comment thread src/drt/src/io/io.cpp
con->setTwoCuts(rule->getTwoCuts());
}
con->setSameCut(rule->isSameCut());
con->setCutWithin(rule->getWithin());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The EXCEPTSAMEPGNET branch support for LEF58_SPACING ADJACENTCUTS is mentioned in the pull request title, but the setter for this property was removed during refactoring. It should be restored so the constraint object correctly reflects the rule definition.

        con->setCutWithin(rule->getWithin());
        con->setExceptSamePGNet(rule->isExceptSamePgnet());

;
}

frSquaredDistance reqSpcValSquare = con->getCutSpacing();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The implementation for the EXCEPTSAMEPGNET branch in LEF58_SPACING ADJACENTCUTS is missing. If this branch is specified, the spacing rule should be waived if both cuts are on the same power or ground net.

Suggested change
frSquaredDistance reqSpcValSquare = con->getCutSpacing();
if (con->isExceptSamePGNet() && net1 == net2 && net1->getOwner()
&& isPG(net1->getOwner())) {
return;
}
frSquaredDistance reqSpcValSquare = con->getCutSpacing();

checkMetalShape_addPatch(pin, min_area);
}
// if any rectwidth constraint is satisfied, return
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using return here will skip all subsequent LEF58_AREA constraints, including general AREA rules that do not have the RECTWIDTH branch. If multiple rules apply, the most restrictive one should be enforced. Changing this to break will exit the RECTWIDTH-specific loop and allow the function to check general area constraints.

Suggested change
return;
break;

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

// This vector should be sorted by area in a descending order
auto area = in->getODBRule()->getArea();
auto it = std::lower_bound(lef58AreaConstraints_.begin(),
lef58AreaConstraints_.end(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use a ranges version of this algorithm [modernize-use-ranges]

Suggested change
lef58AreaConstraints_.end(),
auto it = std::ranges::lower_bound(lef58AreaConstraints_,
,

// This vector should be sorted by rectwidth in an ascending order
auto rectwidth = in->getODBRule()->getRectWidth();
auto it = std::lower_bound(lef58AreaConstraintsRectWidth_.begin(),
lef58AreaConstraintsRectWidth_.end(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use a ranges version of this algorithm [modernize-use-ranges]

Suggested change
lef58AreaConstraintsRectWidth_.end(),
auto it = std::ranges::lower_bound(lef58AreaConstraintsRectWidth_,
,

const auto curr_area = gtl::area(*poly);
// iterate through rectwidth constraints first
for (auto con : layer->getLef58AreaConstraintsRectWidth()) {
odb::dbTechLayerAreaRule* db_rule = con->getODBRule();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: no header providing "odb::dbTechLayerAreaRule" is directly included [misc-include-cleaner]

src/drt/src/gc/FlexGC_main.cpp:27:

- #include "odb/dbTypes.h"
+ #include "odb/db.h"
+ #include "odb/dbTypes.h"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant