DRT: Support LEF58_SPACING ADJACENTCUTS EXCEPTSAMEPGNET branch#10164
DRT: Support LEF58_SPACING ADJACENTCUTS EXCEPTSAMEPGNET branch#10164osamahammad21 wants to merge 2 commits intoThe-OpenROAD-Project:masterfrom
Conversation
Signed-off-by: osamahammad21 <osama21@aucegypt.edu>
Signed-off-by: osamahammad21 <osama21@aucegypt.edu>
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
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.
| 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; |
| con->setTwoCuts(rule->getTwoCuts()); | ||
| } | ||
| con->setSameCut(rule->isSameCut()); | ||
| con->setCutWithin(rule->getWithin()); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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.
| 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; |
There was a problem hiding this comment.
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.
| return; | |
| break; |
| // 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(), |
There was a problem hiding this comment.
warning: use a ranges version of this algorithm [modernize-use-ranges]
| 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(), |
There was a problem hiding this comment.
warning: use a ranges version of this algorithm [modernize-use-ranges]
| 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(); |
There was a problem hiding this comment.
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"
Summary
Support EXCEPTSAMEPGNET branch in LEF58_SPACING ADJACENTCUTS rule.
Type of Change
Impact
None on the current designs
Verification
./etc/Build.sh).