Skip to content

Commit 51850f9

Browse files
Merge pull request #10560 from JesseDebuger/codex-fix-10481-frguide-layer
drt: collapse frGuide to a single layer field
2 parents 6da1b0d + b91c49f commit 51850f9

8 files changed

Lines changed: 26 additions & 55 deletions

File tree

src/drt/src/db/obj/frGuide.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ class frNet;
1717
class frGuide : public frConnFig
1818
{
1919
public:
20-
frGuide(const odb::Point& begin,
21-
frLayerNum begin_layer,
22-
const odb::Point& end,
23-
frLayerNum end_layer)
24-
: begin_(begin), end_(end), beginLayer_(begin_layer), endLayer_(end_layer)
20+
frGuide(const odb::Point& begin, frLayerNum layer_num, const odb::Point& end)
21+
: begin_(begin), end_(end), layerNum_(layer_num)
2522
{
2623
}
2724
frGuide(const frGuide& in) = delete;
@@ -31,8 +28,7 @@ class frGuide : public frConnFig
3128
const odb::Point& getBeginPoint() const { return begin_; }
3229
const odb::Point& getEndPoint() const { return end_; }
3330

34-
frLayerNum getBeginLayerNum() const { return beginLayer_; }
35-
frLayerNum getEndLayerNum() const { return endLayer_; }
31+
frLayerNum getLayerNum() const { return layerNum_; }
3632
bool hasRoutes() const { return !routeObj_.empty(); }
3733
const std::vector<std::unique_ptr<frConnFig>>& getRoutes() const
3834
{
@@ -76,8 +72,7 @@ class frGuide : public frConnFig
7672
private:
7773
odb::Point begin_;
7874
odb::Point end_;
79-
frLayerNum beginLayer_;
80-
frLayerNum endLayer_;
75+
frLayerNum layerNum_;
8176
std::vector<std::unique_ptr<frConnFig>> routeObj_;
8277
frNet* net_{nullptr};
8378
int index_in_owner_{0};

src/drt/src/dr/FlexDR_init.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,10 @@ void FlexDRWorker::initNetObjs(
341341
odb::Point epIdx = design_->getTopBlock()->getGCellIdx(ep);
342342
odb::Rect bbox = design_->getTopBlock()->getGCellBox(bpIdx);
343343
odb::Rect ebox = design_->getTopBlock()->getGCellBox(epIdx);
344-
frLayerNum bNum = guide->getBeginLayerNum();
345-
frLayerNum eNum = guide->getEndLayerNum();
346344
frRect rect;
347345
rect.setBBox({bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()});
348-
for (auto lNum = std::min(bNum, eNum); lNum <= std::max(bNum, eNum);
349-
lNum += 2) {
350-
rect.setLayerNum(lNum);
351-
netGuides[guide->getNet()].push_back(rect);
352-
}
346+
rect.setLayerNum(guide->getLayerNum());
347+
netGuides[guide->getNet()].push_back(rect);
353348
}
354349
}
355350
}

src/drt/src/frRegionQuery.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,7 @@ void frRegionQuery::Impl::addGuide(frGuide* guide,
470470
ObjectsByLayer<frGuide>& allShapes)
471471
{
472472
odb::Rect frb = guide->getBBox();
473-
for (int i = guide->getBeginLayerNum(); i <= guide->getEndLayerNum(); i++) {
474-
allShapes.at(i).emplace_back(frb, guide);
475-
}
473+
allShapes.at(guide->getLayerNum()).emplace_back(frb, guide);
476474
}
477475

478476
void frRegionQuery::Impl::addOrigGuide(frNet* net,

src/drt/src/global.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ std::ostream& operator<<(std::ostream& os, const frPathSeg& p)
200200
std::ostream& operator<<(std::ostream& os, const frGuide& p)
201201
{
202202
os << "frGuide: begin " << p.getBeginPoint() << " end " << p.getEndPoint()
203-
<< " begin LayerNum " << p.getBeginLayerNum() << " end layerNum "
204-
<< p.getEndLayerNum();
203+
<< " layerNum " << p.getLayerNum();
205204
return os;
206205
}
207206

src/drt/src/io/GuideProcessor.cpp

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,7 @@ GuidePathFinder::commitPathToGuides(
17211721
const odb::Point begin
17221722
= getDesign()->getTopBlock()->getGCellCenter(box.ll());
17231723
const odb::Point end = getDesign()->getTopBlock()->getGCellCenter(box.ur());
1724-
auto guide = std::make_unique<frGuide>(begin, layer_num, end, layer_num);
1724+
auto guide = std::make_unique<frGuide>(begin, layer_num, end);
17251725
net_->addGuide(std::move(guide));
17261726
}
17271727
return gr_pins;
@@ -1956,30 +1956,14 @@ void GuideProcessor::saveGuidesUpdates()
19561956
odb::Point epIdx = getDesign()->getTopBlock()->getGCellIdx(ep);
19571957
odb::Rect bbox = getDesign()->getTopBlock()->getGCellBox(bpIdx);
19581958
odb::Rect ebox = getDesign()->getTopBlock()->getGCellBox(epIdx);
1959-
frLayerNum bNum = guide->getBeginLayerNum();
1960-
frLayerNum eNum = guide->getEndLayerNum();
1961-
if (bNum != eNum) {
1962-
for (auto lNum = std::min(bNum, eNum); lNum <= std::max(bNum, eNum);
1963-
lNum += 2) {
1964-
auto layer = getTech()->getLayer(lNum);
1965-
auto dbLayer = dbTech->findLayer(layer->getName().c_str());
1966-
odb::dbGuide::create(
1967-
dbNet,
1968-
dbLayer,
1969-
dbLayer,
1970-
{bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()},
1971-
false);
1972-
}
1973-
} else {
1974-
auto layerName = getTech()->getLayer(bNum)->getName();
1975-
auto dbLayer = dbTech->findLayer(layerName.c_str());
1976-
odb::dbGuide::create(
1977-
dbNet,
1978-
dbLayer,
1979-
dbLayer,
1980-
{bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()},
1981-
false);
1982-
}
1959+
const frLayerNum layer_num = guide->getLayerNum();
1960+
auto layerName = getTech()->getLayer(layer_num)->getName();
1961+
auto dbLayer = dbTech->findLayer(layerName.c_str());
1962+
odb::dbGuide::create(dbNet,
1963+
dbLayer,
1964+
dbLayer,
1965+
{bbox.xMin(), bbox.yMin(), ebox.xMax(), ebox.yMax()},
1966+
false);
19831967
}
19841968
auto dbGuides = dbNet->getGuides();
19851969
if (dbGuides.orderReversed() && dbGuides.reversible()) {

src/drt/src/ta/FlexTA_assign.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ void FlexTAWorker::assignIroute_availTracks(taPin* iroute,
572572
int& idx1,
573573
int& idx2)
574574
{
575-
lNum = iroute->getGuide()->getBeginLayerNum();
575+
lNum = iroute->getGuide()->getLayerNum();
576576
auto [gbp, gep] = iroute->getGuide()->getPoints();
577577
odb::Point gIdx = getDesign()->getTopBlock()->getGCellIdx(gbp);
578578
odb::Rect gBox = getDesign()->getTopBlock()->getGCellBox(gIdx);
@@ -667,7 +667,7 @@ frUInt4 FlexTAWorker::assignIroute_getPinCost(taPin* iroute, frCoord trackLoc)
667667

668668
// add cost to locations that will cause forbidden via spacing to
669669
// boundary pin
670-
auto layerNum = iroute->getGuide()->getBeginLayerNum();
670+
auto layerNum = iroute->getGuide()->getLayerNum();
671671
auto layer = getTech()->getLayer(layerNum);
672672

673673
if (layer->isUnidirectional()) {
@@ -923,7 +923,7 @@ frUInt4 FlexTAWorker::assignIroute_getCost(taPin* iroute,
923923
frUInt4& outDrcCost)
924924
{
925925
frCoord irouteLayerPitch
926-
= getTech()->getLayer(iroute->getGuide()->getBeginLayerNum())->getPitch();
926+
= getTech()->getLayer(iroute->getGuide()->getLayerNum())->getPitch();
927927
outDrcCost = assignIroute_getDRCCost(iroute, trackLoc);
928928
int drcCost = (isInitTA()) ? (0.05 * outDrcCost)
929929
: (router_cfg_->TADRCCOST * outDrcCost);

src/drt/src/ta/FlexTA_init.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ bool FlexTAWorker::initIroute_helper_pin(frGuide* guide,
143143
}
144144

145145
auto net = guide->getNet();
146-
auto layerNum = guide->getBeginLayerNum();
146+
auto layerNum = guide->getLayerNum();
147147
bool isH = (getDir() == dbTechLayerDir::HORIZONTAL);
148148
bool hasDown = false;
149149
bool hasUp = false;
@@ -376,7 +376,7 @@ void FlexTAWorker::initIroute_helper_generic(frGuide* guide,
376376
frCoord& pinCoord)
377377
{
378378
auto net = guide->getNet();
379-
auto layerNum = guide->getBeginLayerNum();
379+
auto layerNum = guide->getLayerNum();
380380
bool hasMinBegin = false;
381381
bool hasMaxEnd = false;
382382
minBegin = std::numeric_limits<frCoord>::max();
@@ -415,7 +415,7 @@ void FlexTAWorker::initIroute_helper_generic(frGuide* guide,
415415
auto [nbrBp, nbrEp] = nbrGuide->getPoints();
416416
if (!nbrGuide->hasRoutes()) {
417417
// via location assumed in center
418-
auto psLNum = nbrGuide->getBeginLayerNum();
418+
auto psLNum = nbrGuide->getLayerNum();
419419
if (psLNum == layerNum - 2) {
420420
downViaCoordSet.insert((isH ? nbrBp.x() : nbrBp.y()));
421421
} else {
@@ -477,7 +477,7 @@ void FlexTAWorker::initIroute(frGuide* guide)
477477
auto iroute = std::make_unique<taPin>();
478478
iroute->setGuide(guide);
479479
odb::Rect guideBox = guide->getBBox();
480-
auto layerNum = guide->getBeginLayerNum();
480+
auto layerNum = guide->getLayerNum();
481481
bool isExt = !(getRouteBox().contains(guideBox));
482482
if (isExt) {
483483
// extIroute empty, skip
@@ -608,7 +608,7 @@ void FlexTAWorker::initCosts()
608608
for (auto& iroute : iroutes_) {
609609
auto pitch = getDesign()
610610
->getTech()
611-
->getLayer(iroute->getGuide()->getBeginLayerNum())
611+
->getLayer(iroute->getGuide()->getLayerNum())
612612
->getPitch();
613613
for (auto& uPinFig : iroute->getFigs()) {
614614
if (uPinFig->typeId() == tacPathSeg) {

src/drt/test/taTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ struct TAFixture : public Fixture
7373
const odb::Point& begin,
7474
const odb::Point& end)
7575
{
76-
auto guide = std::make_unique<frGuide>(begin, layer_num, end, layer_num);
76+
auto guide = std::make_unique<frGuide>(begin, layer_num, end);
7777
auto* ptr = guide.get();
7878
net->addGuide(std::move(guide));
7979
return ptr;

0 commit comments

Comments
 (0)