Skip to content

Commit ac5878d

Browse files
authored
Merge pull request #2581 from eder-matheus/drt_patch_metal
2 parents 4ca2391 + 4fb6c4c commit ac5878d

File tree

1 file changed

+44
-28
lines changed

1 file changed

+44
-28
lines changed

src/drt/src/dr/FlexDR_maze.cpp

Lines changed: 44 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2982,29 +2982,34 @@ void FlexDRWorker::routeNet_postAstarPatchMinAreaVio(
29822982
currArea = (minAreaConstraint) ? minAreaConstraint->getMinArea() : 0;
29832983
}
29842984
frCoord startViaHalfEncArea = 0, endViaHalfEncArea = 0;
2985-
FlexMazeIdx prevIdx = points[0], currIdx;
2985+
FlexMazeIdx currIdx = points[0], nextIdx;
29862986
int i;
29872987
int prev_i = 0; // path start point
2988+
bool prev_is_wire = true;
29882989
for (i = 1; i < (int) points.size(); ++i) {
2989-
currIdx = points[i];
2990+
nextIdx = points[i];
29902991
// check minAreaViolation when change layer, or last segment
2991-
if (currIdx.z() != prevIdx.z()) {
2992-
layerNum = gridGraph_.getLayerNum(prevIdx.z());
2992+
if (nextIdx.z() != currIdx.z()) {
2993+
layerNum = gridGraph_.getLayerNum(currIdx.z());
29932994
minAreaConstraint = getTech()->getLayer(layerNum)->getAreaConstraint();
29942995
frArea reqArea
29952996
= (minAreaConstraint) ? minAreaConstraint->getMinArea() : 0;
2996-
// add next via enclosure
2997-
if (currIdx.z() < prevIdx.z()) {
2997+
// add curr via enclosure
2998+
frMIdx z = (nextIdx.z() < currIdx.z()) ? currIdx.z() - 1 : currIdx.z();
2999+
bool isLayer1 = (nextIdx.z() < currIdx.z()) ? false : true;
3000+
if (prev_is_wire) {
29983001
currArea += getHalfViaEncArea(
2999-
prevIdx.z() - 1, false, net->getFrNet()->getNondefaultRule());
3000-
endViaHalfEncArea = getHalfViaEncArea(
3001-
prevIdx.z() - 1, false, net->getFrNet()->getNondefaultRule());
3002+
z, isLayer1, net->getFrNet()->getNondefaultRule());
30023003
} else {
3003-
currArea += getHalfViaEncArea(
3004-
prevIdx.z(), true, net->getFrNet()->getNondefaultRule());
3005-
endViaHalfEncArea = getHalfViaEncArea(
3006-
prevIdx.z(), true, net->getFrNet()->getNondefaultRule());
3004+
currArea
3005+
= std::max((frArea) getHalfViaEncArea(
3006+
z, isLayer1, net->getFrNet()->getNondefaultRule())
3007+
* 2,
3008+
currArea);
30073009
}
3010+
endViaHalfEncArea = getHalfViaEncArea(
3011+
z, isLayer1, net->getFrNet()->getNondefaultRule());
3012+
30083013
// push to minArea violation
30093014
if (currArea < reqArea) {
30103015
FlexMazeIdx bp, ep;
@@ -3078,44 +3083,55 @@ void FlexDRWorker::routeNet_postAstarPatchMinAreaVio(
30783083
net, bp, ep, gapArea, patchWidth, bpPatchStyle, epPatchStyle);
30793084
}
30803085
// init for next path
3081-
if (currIdx.z() < prevIdx.z()) {
3082-
currArea = getHalfViaEncArea(
3083-
prevIdx.z() - 1, true, net->getFrNet()->getNondefaultRule());
3086+
if (nextIdx.z() < currIdx.z()) {
3087+
// get the bottom layer box of the current via to initialize the area
3088+
// for the next shape
3089+
currArea
3090+
= getHalfViaEncArea(
3091+
currIdx.z() - 1, true, net->getFrNet()->getNondefaultRule())
3092+
* 2;
30843093
startViaHalfEncArea = getHalfViaEncArea(
3085-
prevIdx.z() - 1, true, net->getFrNet()->getNondefaultRule());
3094+
currIdx.z() - 1, true, net->getFrNet()->getNondefaultRule());
30863095
} else {
3096+
// get the top layer box of the current via to initialize the area
3097+
// for the next shape
30873098
currArea = getHalfViaEncArea(
3088-
prevIdx.z(), false, net->getFrNet()->getNondefaultRule());
3089-
currArea = getHalfViaEncArea(
3090-
prevIdx.z(), false, net->getFrNet()->getNondefaultRule());
3091-
startViaHalfEncArea = gridGraph_.getHalfViaEncArea(prevIdx.z(), false);
3099+
currIdx.z(), false, net->getFrNet()->getNondefaultRule())
3100+
* 2;
3101+
startViaHalfEncArea = gridGraph_.getHalfViaEncArea(nextIdx.z(), false);
3102+
startViaHalfEncArea = gridGraph_.getHalfViaEncArea(currIdx.z(), false);
30923103
}
30933104
prev_i = i;
3105+
prev_is_wire = false;
30943106
}
30953107
// add the wire area
30963108
else {
3097-
layerNum = gridGraph_.getLayerNum(prevIdx.z());
3109+
layerNum = gridGraph_.getLayerNum(currIdx.z());
30983110
minAreaConstraint = getTech()->getLayer(layerNum)->getAreaConstraint();
30993111
frArea reqArea
31003112
= (minAreaConstraint) ? minAreaConstraint->getMinArea() : 0;
31013113
auto pathWidth = getTech()->getLayer(layerNum)->getWidth();
31023114
Point bp, ep;
3103-
gridGraph_.getPoint(bp, prevIdx.x(), prevIdx.y());
3104-
gridGraph_.getPoint(ep, currIdx.x(), currIdx.y());
3115+
gridGraph_.getPoint(bp, currIdx.x(), currIdx.y());
3116+
gridGraph_.getPoint(ep, nextIdx.x(), nextIdx.y());
31053117
frCoord pathLength = abs(bp.x() - ep.x()) + abs(bp.y() - ep.y());
31063118
if (currArea < reqArea) {
3119+
if (!prev_is_wire) {
3120+
currArea /= 2;
3121+
}
31073122
currArea += pathLength * pathWidth;
31083123
}
3124+
prev_is_wire = true;
31093125
}
3110-
prevIdx = currIdx;
3126+
currIdx = nextIdx;
31113127
}
31123128
// add boundary area for last segment
31133129
if (ENABLE_BOUNDARY_MAR_FIX) {
3114-
layerNum = gridGraph_.getLayerNum(prevIdx.z());
3130+
layerNum = gridGraph_.getLayerNum(currIdx.z());
31153131
minAreaConstraint = getTech()->getLayer(layerNum)->getAreaConstraint();
31163132
frArea reqArea = (minAreaConstraint) ? minAreaConstraint->getMinArea() : 0;
3117-
if (areaMap.find(prevIdx) != areaMap.end()) {
3118-
currArea += areaMap.find(prevIdx)->second;
3133+
if (areaMap.find(currIdx) != areaMap.end()) {
3134+
currArea += areaMap.find(currIdx)->second;
31193135
}
31203136
endViaHalfEncArea = 0;
31213137
if (currArea < reqArea) {

0 commit comments

Comments
 (0)