Skip to content

Commit 4b3709e

Browse files
committed
Merge remote-tracking branch 'origin/master' into drt-incremental-pa
Signed-off-by: osamahammad21 <[email protected]>
2 parents 1eb991d + 7559f96 commit 4b3709e

File tree

175 files changed

+2607
-2823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+2607
-2823
lines changed

src/Design.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "ord/Design.h"
55

6+
#include <algorithm>
67
#include <cmath>
78
#include <cstdint>
89
#include <istream>
@@ -224,7 +225,7 @@ std::uint64_t Design::getNetRoutedLength(odb::dbNet* net)
224225
for (odb::dbSWire* swire : net->getSWires()) {
225226
for (odb::dbSBox* wire : swire->getWires()) {
226227
if (wire != nullptr && !(wire->isVia())) {
227-
route_length += wire->getLength();
228+
route_length += std::max(wire->getDX(), wire->getDY());
228229
}
229230
}
230231
}

src/dpl/src/PlacementDRC.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "odb/dbTransform.h"
1414
#include "odb/dbTypes.h"
1515
#include "odb/geom.h"
16+
#include "odb/isotropy.h"
1617

1718
namespace dpl {
1819

@@ -36,7 +37,7 @@ odb::Rect transformEdgeRect(const odb::Rect& edge_rect,
3637
odb::Rect getQueryRect(const odb::Rect& edge_box, const int spc)
3738
{
3839
odb::Rect query_rect(edge_box);
39-
bool is_vertical_edge = edge_box.getDir() == 0;
40+
bool is_vertical_edge = edge_box.getDir() == odb::vertical;
4041
if (is_vertical_edge) {
4142
// vertical edge
4243
query_rect = query_rect.bloat(spc, odb::Orientation2D::Horizontal);
@@ -89,7 +90,7 @@ bool PlacementDRC::checkEdgeSpacing(const Node* cell,
8990
+ 1; // +1 to account for EXACT rules
9091
odb::Rect edge1_box = cell_edges::transformEdgeRect(
9192
edge1.getBBox(), cell, x_real, y_real, orient);
92-
bool is_vertical_edge = edge1_box.getDir() == 0;
93+
bool is_vertical_edge = edge1_box.getDir() == odb::vertical;
9394
odb::Rect query_rect = cell_edges::getQueryRect(edge1_box, max_spc);
9495
GridX xMin = grid_->gridX(DbuX(query_rect.xMin()));
9596
GridX xMax = grid_->gridEndX(DbuX(query_rect.xMax()));

src/dpl/src/infrastructure/Grid.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void Grid::markBlocked(odb::dbBlock* block)
149149
if (routing_level <= 1 || routing_level > 3) { // considering M2, M3
150150
return;
151151
}
152-
if (wire_rect.getDir() == 1) { // horizontal
152+
if (wire_rect.getDir() == odb::horizontal) {
153153
return;
154154
}
155155
wire_rect.moveDelta(-core.xMin(), -core.yMin());

src/drt/src/gc/FlexGC_main.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "gc/FlexGC_impl.h"
2222
#include "odb/dbTypes.h"
2323
#include "odb/geom.h"
24+
#include "odb/isotropy.h"
2425

2526
using odb::dbTechLayerType;
2627

@@ -3873,7 +3874,8 @@ void FlexGCWorker::Impl::patchMetalShape_minStep()
38733874
} else {
38743875
continue;
38753876
}
3876-
if (enc_box.getDir() == 1 && markerBBox.yMin() == enc_box.yMin()
3877+
if (enc_box.getDir() == odb::horizontal
3878+
&& markerBBox.yMin() == enc_box.yMin()
38773879
&& markerBBox.yMax() == enc_box.yMax()) {
38783880
int bloating_dist = std::max(0, min_step_length - markerBBox.dx());
38793881
if (markerBBox.xMin() >= enc_box.xMin()
@@ -3885,7 +3887,7 @@ void FlexGCWorker::Impl::patchMetalShape_minStep()
38853887
} else {
38863888
continue;
38873889
}
3888-
} else if (enc_box.getDir() == 0
3890+
} else if (enc_box.getDir() == odb::vertical
38893891
&& markerBBox.xMin() == enc_box.xMin()
38903892
&& markerBBox.xMax() == enc_box.xMax()) {
38913893
int bloating_dist = std::max(0, min_step_length - markerBBox.dy());

src/drt/src/io/GuideProcessor.cpp

Lines changed: 44 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "frBaseTypes.h"
2525
#include "frDesign.h"
2626
#include "frProfileTask.h"
27+
#include "global.h"
2728
#include "odb/db.h"
2829
#include "odb/dbTypes.h"
2930
#include "odb/geom.h"
@@ -207,7 +208,8 @@ Point3D findBestPinLocation(frDesign* design,
207208
*/
208209
int findClosestGuide(const Point3D& best_pin_loc_coords,
209210
const std::vector<frRect>& guides,
210-
const frCoord layer_change_penalty)
211+
const frCoord layer_change_penalty,
212+
const RouterConfiguration* router_cfg)
211213
{
212214
int closest_guide_idx = 0;
213215
int dist = 0;
@@ -217,6 +219,9 @@ int findClosestGuide(const Point3D& best_pin_loc_coords,
217219
dist = odb::manhattanDistance(guide.getBBox(), best_pin_loc_coords);
218220
dist += abs(guide.getLayerNum() - best_pin_loc_coords.z())
219221
* layer_change_penalty;
222+
if (guide.getLayerNum() < router_cfg->BOTTOM_ROUTING_LAYER) {
223+
dist += 1e9;
224+
}
220225
if (dist < min_dist) {
221226
min_dist = dist;
222227
closest_guide_idx = guide_idx;
@@ -352,41 +357,6 @@ void fillGuidesUpToZ(const Point3D& best_pin_loc_coords,
352357
net);
353358
}
354359
}
355-
/**
356-
* @brief Connects the guides with the best pin shape location (on the 2D
357-
* plane only)
358-
*
359-
* The function creates a patch guide that connects the closest guide to
360-
* best_pin_loc_coords (without consideration to different layers)
361-
*
362-
* @param guide_pt The center of the gcell on the guide that is closest to
363-
* best_pin_loc_coords
364-
* @param best_pin_loc_coords The gcell center point of the chosen pin shape
365-
* @param gcell_half_size_horz Half the horizontal size of the gcell
366-
* @param gcell_half_size_vert Half the vertical size of the gcell
367-
*/
368-
void connectGuidesWithBestPinLoc(const Point3D& guide_pt,
369-
const odb::Point& best_pin_loc_coords,
370-
const frCoord gcell_half_size_horz,
371-
const frCoord gcell_half_size_vert,
372-
frNet* net,
373-
std::vector<frRect>& guides)
374-
{
375-
if (guide_pt.x() != best_pin_loc_coords.x()
376-
|| guide_pt.y() != best_pin_loc_coords.y()) {
377-
const odb::Point pl = {std::min(best_pin_loc_coords.x(), guide_pt.x()),
378-
std::min(best_pin_loc_coords.y(), guide_pt.y())};
379-
const odb::Point ph = {std::max(best_pin_loc_coords.x(), guide_pt.x()),
380-
std::max(best_pin_loc_coords.y(), guide_pt.y())};
381-
382-
guides.emplace_back(pl.x() - gcell_half_size_horz,
383-
pl.y() - gcell_half_size_vert,
384-
ph.x() + gcell_half_size_horz,
385-
ph.y() + gcell_half_size_vert,
386-
guide_pt.z(),
387-
net);
388-
}
389-
}
390360

391361
/**
392362
* @brief logs the number of guides read so far
@@ -949,6 +919,43 @@ void GuideProcessor::buildGCellPatterns()
949919
}
950920
}
951921

922+
void GuideProcessor::connectGuidesWithBestPinLoc(
923+
Point3D& guide_pt,
924+
const odb::Point& best_pin_loc_coords,
925+
const frCoord gcell_half_size_horz,
926+
const frCoord gcell_half_size_vert,
927+
frNet* net,
928+
std::vector<frRect>& guides)
929+
{
930+
if (guide_pt.x() != best_pin_loc_coords.x()
931+
|| guide_pt.y() != best_pin_loc_coords.y()) {
932+
const odb::Point pl = {std::min(best_pin_loc_coords.x(), guide_pt.x()),
933+
std::min(best_pin_loc_coords.y(), guide_pt.y())};
934+
const odb::Point ph = {std::max(best_pin_loc_coords.x(), guide_pt.x()),
935+
std::max(best_pin_loc_coords.y(), guide_pt.y())};
936+
bool is_horizontal = pl.x() != ph.x();
937+
bool is_vertical = pl.y() != ph.y();
938+
frLayerNum layer_num = guide_pt.z();
939+
if (is_horizontal ^ is_vertical) {
940+
if ((is_vertical && design_->isHorizontalLayer(layer_num))
941+
|| (is_horizontal && design_->isVerticalLayer(layer_num))) {
942+
if (layer_num + 2 <= router_cfg_->TOP_ROUTING_LAYER) {
943+
layer_num += 2;
944+
} else {
945+
layer_num -= 2;
946+
}
947+
}
948+
}
949+
guide_pt.setZ(layer_num);
950+
guides.emplace_back(pl.x() - gcell_half_size_horz,
951+
pl.y() - gcell_half_size_vert,
952+
ph.x() + gcell_half_size_horz,
953+
ph.y() + gcell_half_size_vert,
954+
layer_num,
955+
net);
956+
}
957+
}
958+
952959
void GuideProcessor::patchGuides_helper(frNet* net,
953960
std::vector<frRect>& guides,
954961
const Point3D& best_pin_loc_idx,
@@ -1021,7 +1028,7 @@ void GuideProcessor::patchGuides(frNet* net,
10211028
// get the guide that is closest to the gCell
10221029
// TODO: test passing layer_change_penalty = gcell size
10231030
const int closest_guide_idx
1024-
= findClosestGuide(best_pin_loc_coords, guides, 1);
1031+
= findClosestGuide(best_pin_loc_coords, guides, 1, router_cfg_);
10251032

10261033
patchGuides_helper(
10271034
net, guides, best_pin_loc_idx, best_pin_loc_coords, closest_guide_idx);

src/drt/src/io/GuideProcessor.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,25 @@ class GuideProcessor
9191
const Point3D& best_pin_loc_idx,
9292
const Point3D& best_pin_loc_coords,
9393
int closest_guide_idx);
94+
/**
95+
* @brief Connects the guides with the best pin shape location (on the 2D
96+
* plane only)
97+
*
98+
* The function creates a patch guide that connects the closest guide to
99+
* best_pin_loc_coords (without consideration to different layers)
100+
*
101+
* @param guide_pt The center of the gcell on the guide that is closest to
102+
* best_pin_loc_coords
103+
* @param best_pin_loc_coords The gcell center point of the chosen pin shape
104+
* @param gcell_half_size_horz Half the horizontal size of the gcell
105+
* @param gcell_half_size_vert Half the vertical size of the gcell
106+
*/
107+
void connectGuidesWithBestPinLoc(Point3D& guide_pt,
108+
const odb::Point& best_pin_loc_coords,
109+
frCoord gcell_half_size_horz,
110+
frCoord gcell_half_size_vert,
111+
frNet* net,
112+
std::vector<frRect>& guides);
94113
/**
95114
* @brief Patches guides to cover part of the pin if needed.
96115
*

src/drt/src/io/io.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -962,9 +962,7 @@ void io::Parser::updateNetRouting(frNet* netIn, odb::dbNet* net)
962962
== getTech()->name2via_.end()) {
963963
logger_->error(DRT, 109, "Unsupported via in db.");
964964
} else {
965-
int x, y;
966-
box->getViaXY(x, y);
967-
odb::Point p(x, y);
965+
const odb::Point p = box->getViaXY();
968966
auto viaDef = getTech()->name2via_[viaName];
969967
auto tmpP = std::make_unique<frVia>(viaDef);
970968
tmpP->setOrigin(p);
@@ -2675,11 +2673,10 @@ void io::Parser::setMasters(odb::dbDatabase* db)
26752673
master->getName(),
26762674
_term->getName());
26772675
}
2678-
int x, y;
2679-
box->getViaXY(x, y);
2676+
const odb::Point pt = box->getViaXY();
26802677
auto viaDef = getTech()->name2via_[box->getTechVia()->getName()];
26812678
auto tmpP = std::make_unique<frVia>(viaDef);
2682-
tmpP->setOrigin({x, y});
2679+
tmpP->setOrigin(pt);
26832680
// layer1 rect
26842681
addPinFig(
26852682
tmpP->getLayer1BBox(), viaDef->getLayer1Num(), pinIn.get());

src/grt/src/GlobalRouter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,7 +1408,7 @@ std::vector<LayerId> GlobalRouter::findTransitionLayers()
14081408
int via_width = 0;
14091409
for (const auto box : default_vias[tech_layer]->getBoxes()) {
14101410
if (box->getTechLayer() == tech_layer) {
1411-
via_width = vertical ? box->getWidth() : box->getLength();
1411+
via_width = vertical ? box->getDY() : box->getDX();
14121412
break;
14131413
}
14141414
}
@@ -3487,17 +3487,17 @@ void getViaDims(std::map<odb::dbTechLayer*, odb::dbTechVia*> default_vias,
34873487
if (default_vias.find(tech_layer) != default_vias.end()) {
34883488
for (auto box : default_vias[tech_layer]->getBoxes()) {
34893489
if (box->getTechLayer() == tech_layer) {
3490-
width_up = std::min(box->getWidth(), box->getLength());
3491-
prl_up = std::max(box->getWidth(), box->getLength());
3490+
width_up = std::min(box->getDX(), box->getDY());
3491+
prl_up = std::max(box->getDX(), box->getDY());
34923492
break;
34933493
}
34943494
}
34953495
}
34963496
if (default_vias.find(bottom_layer) != default_vias.end()) {
34973497
for (auto box : default_vias[bottom_layer]->getBoxes()) {
34983498
if (box->getTechLayer() == tech_layer) {
3499-
width_down = std::min(box->getWidth(), box->getLength());
3500-
prl_down = std::max(box->getWidth(), box->getLength());
3499+
width_down = std::min(box->getDX(), box->getDY());
3500+
prl_down = std::max(box->getDX(), box->getDY());
35013501
break;
35023502
}
35033503
}

0 commit comments

Comments
 (0)