Skip to content

Commit d00d78f

Browse files
committed
Merge remote-tracking branch 'origin/master' into gui-legend
2 parents 29978aa + 9f19c00 commit d00d78f

File tree

20 files changed

+433
-182
lines changed

20 files changed

+433
-182
lines changed

docs/src/scripts/md_roff_compat.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,11 @@ def man2_translate(doc, path):
166166
global_see_also = extract_global_see_also(text)
167167

168168
print(f"{os.path.basename(doc)}")
169-
print(
170-
f"""Names: {len(func_names)},\
169+
print(f"""Names: {len(func_names)},\
171170
Desc: {len(func_descs)},\
172171
Syn: {len(func_synopsis)},\
173172
Options: {len(func_options)},\
174-
Args: {len(func_args)}"""
175-
)
173+
Args: {len(func_args)}""")
176174
print(f"Global Examples: {'Found' if global_examples else 'None'}")
177175
print(f"Global See Also: {'Found' if global_see_also else 'None'}")
178176

src/dbSta/src/dbSta.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,10 +824,10 @@ void dbSta::checkSanityDrvrVertexEdges(const Pin* pin) const
824824
std::set<const sta::Pin*>& loads_;
825825
const Pin* drvr_;
826826
const Network* network_;
827-
ODBLoadVisitor(std::set<const sta::Pin*>& load,
827+
ODBLoadVisitor(std::set<const sta::Pin*>& loads,
828828
const Pin* drvr,
829829
const Network* network)
830-
: loads_(load), drvr_(drvr), network_(network)
830+
: loads_(loads), drvr_(drvr), network_(network)
831831
{
832832
}
833833

@@ -863,8 +863,8 @@ void dbSta::checkSanityDrvrVertexEdges(const Pin* pin) const
863863
2301,
864864
"Inconsistent load: ODB has load '{}' for driver '{}', but STA graph "
865865
"edge is missing.",
866-
odb_load ? db_network_->pathName(odb_load) : "NULL",
867-
pin ? db_network_->pathName(pin) : "NULL");
866+
db_network_->pathName(odb_load),
867+
db_network_->pathName(pin));
868868
}
869869
}
870870
}

src/grt/include/grt/GlobalRouter.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class GlobalRouter
231231
void addNetToRoute(odb::dbNet* db_net);
232232
std::vector<odb::dbNet*> getNetsToRoute();
233233
void mergeNetsRouting(odb::dbNet* db_net1, odb::dbNet* db_net2);
234-
void connectRouting(odb::dbNet* db_net1, odb::dbNet* db_net2);
234+
bool connectRouting(odb::dbNet* db_net1, odb::dbNet* db_net2);
235235
void findBufferPinPostions(Net* net1,
236236
Net* net2,
237237
odb::Point& pin_pos1,
@@ -329,6 +329,7 @@ class GlobalRouter
329329
// Net functions
330330
Net* addNet(odb::dbNet* db_net);
331331
void removeNet(odb::dbNet* db_net);
332+
void updateNetPins(Net* net);
332333

333334
void getCongestionNets(std::set<odb::dbNet*>& congestion_nets);
334335
void applyAdjustments(int min_routing_layer, int max_routing_layer);
@@ -579,8 +580,8 @@ class GRouteDbCbk : public odb::dbBlockCallBackObj
579580

580581
void inDbNetDestroy(odb::dbNet* net) override;
581582
void inDbNetCreate(odb::dbNet* net) override;
582-
void inDbNetPreMerge(odb::dbNet* preserved_net,
583-
odb::dbNet* removed_net) override;
583+
void inDbNetPostMerge(odb::dbNet* preserved_net,
584+
odb::dbNet* removed_net) override;
584585

585586
void inDbITermPreDisconnect(odb::dbITerm* iterm) override;
586587
void inDbITermPostConnect(odb::dbITerm* iterm) override;

src/grt/src/GlobalRouter.cpp

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ void GlobalRouter::globalRoute(bool save_guides,
335335
} else {
336336
try {
337337
if (end_incremental) {
338+
fastroute_->setResistanceAware(resistance_aware_);
338339
updateDirtyRoutes();
339340
grouter_cbk_->removeOwner();
340341
delete grouter_cbk_;
@@ -818,11 +819,7 @@ void GlobalRouter::updateDirtyNets(std::vector<Net*>& dirty_nets)
818819
initRoutingLayers(min_layer, max_layer);
819820
for (odb::dbNet* db_net : dirty_nets_) {
820821
Net* net = db_net_map_[db_net];
821-
net->destroyPins();
822-
// update pin positions
823-
makeItermPins(net, db_net, grid_->getGridArea());
824-
makeBtermPins(net, db_net, grid_->getGridArea());
825-
findPins(net);
822+
updateNetPins(net);
826823
destroyNetWire(net);
827824
std::string pins_not_covered;
828825
// compare new positions with last positions & add on vector
@@ -4211,9 +4208,7 @@ Net* GlobalRouter::addNet(odb::dbNet* db_net)
42114208
delete db_net_map_[db_net];
42124209
}
42134210
db_net_map_[db_net] = net;
4214-
makeItermPins(net, db_net, grid_->getGridArea());
4215-
makeBtermPins(net, db_net, grid_->getGridArea());
4216-
findPins(net);
4211+
updateNetPins(net);
42174212
return net;
42184213
}
42194214
return nullptr;
@@ -4233,6 +4228,15 @@ void GlobalRouter::removeNet(odb::dbNet* db_net)
42334228
routes_.erase(db_net);
42344229
}
42354230

4231+
void GlobalRouter::updateNetPins(Net* net)
4232+
{
4233+
odb::dbNet* db_net = net->getDbNet();
4234+
net->destroyPins();
4235+
makeItermPins(net, db_net, grid_->getGridArea());
4236+
makeBtermPins(net, db_net, grid_->getGridArea());
4237+
findPins(net);
4238+
}
4239+
42364240
Net* GlobalRouter::getNet(odb::dbNet* db_net)
42374241
{
42384242
return db_net_map_[db_net];
@@ -4908,22 +4912,29 @@ void GlobalRouter::mergeNetsRouting(odb::dbNet* db_net1, odb::dbNet* db_net2)
49084912
{
49094913
Net* net1 = db_net_map_[db_net1];
49104914
Net* net2 = db_net_map_[db_net2];
4911-
// Do not merge the routing if the survivor net is already dirty.
4912-
if (!net1->isDirtyNet()) {
4913-
connectRouting(db_net1, db_net2);
4915+
// Try to connect the routing of the two nets
4916+
if (connectRouting(db_net1, db_net2)) {
49144917
net1->setIsMergedNet(true);
49154918
net1->setMergedNet(db_net2);
4919+
net1->setDirtyNet(false);
49164920
net2->setIsMergedNet(true);
49174921
net2->setMergedNet(db_net1);
4922+
} else {
4923+
// After failing to connect the routing, the survivor net still have
4924+
// uncovered pins and needs to be re-routed
4925+
net1->setDirtyNet(true);
49184926
}
49194927
}
49204928

4921-
void GlobalRouter::connectRouting(odb::dbNet* db_net1, odb::dbNet* db_net2)
4929+
bool GlobalRouter::connectRouting(odb::dbNet* db_net1, odb::dbNet* db_net2)
49224930
{
49234931
Net* net1 = db_net_map_[db_net1];
49244932
Net* net2 = db_net_map_[db_net2];
49254933

4926-
// find the pin positions in the buffer that connects the two nets
4934+
// Find the pin positions in the buffer that connects the two nets.
4935+
// At the time this function is called, the buffer information still preserved
4936+
// on GRT data structures, allowing us to use it to define the connection
4937+
// position.
49274938
odb::Point pin_pos1;
49284939
odb::Point pin_pos2;
49294940
findBufferPinPostions(net1, net2, pin_pos1, pin_pos2);
@@ -4940,6 +4951,10 @@ void GlobalRouter::connectRouting(odb::dbNet* db_net1, odb::dbNet* db_net2)
49404951
} else {
49414952
net1_route.insert(net1_route.end(), net2_route.begin(), net2_route.end());
49424953
}
4954+
4955+
updateNetPins(net1);
4956+
std::string dump;
4957+
return netIsCovered(db_net1, dump);
49434958
}
49444959

49454960
void GlobalRouter::findBufferPinPostions(Net* net1,
@@ -5805,8 +5820,8 @@ void GRouteDbCbk::inDbNetDestroy(odb::dbNet* net)
58055820
grouter_->removeNet(net);
58065821
}
58075822

5808-
void GRouteDbCbk::inDbNetPreMerge(odb::dbNet* preserved_net,
5809-
odb::dbNet* removed_net)
5823+
void GRouteDbCbk::inDbNetPostMerge(odb::dbNet* preserved_net,
5824+
odb::dbNet* removed_net)
58105825
{
58115826
grouter_->mergeNetsRouting(preserved_net, removed_net);
58125827
}
@@ -5815,9 +5830,7 @@ void GRouteDbCbk::inDbITermPreDisconnect(odb::dbITerm* iterm)
58155830
{
58165831
odb::dbNet* db_net = iterm->getNet();
58175832
if (db_net != nullptr && !db_net->isSpecial()) {
5818-
Net* net = grouter_->getNet(db_net);
58195833
grouter_->addDirtyNet(iterm->getNet());
5820-
net->destroyITermPin(iterm);
58215834
}
58225835
}
58235836

@@ -5851,9 +5864,7 @@ void GRouteDbCbk::inDbBTermPreDisconnect(odb::dbBTerm* bterm)
58515864
{
58525865
odb::dbNet* db_net = bterm->getNet();
58535866
if (db_net != nullptr && !db_net->isSpecial()) {
5854-
Net* net = grouter_->getNet(db_net);
58555867
grouter_->addDirtyNet(bterm->getNet());
5856-
net->destroyBTermPin(bterm);
58575868
}
58585869
}
58595870

src/grt/src/fastroute/include/DataType.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ struct FrNet // A Net is a set of connected MazePoints
106106
bool isSoftNDR() { return is_soft_ndr_; }
107107
void setIsResAware(bool res_aware) { is_res_aware_ = res_aware; }
108108
bool isResAware() { return is_res_aware_; }
109+
float getResistance() { return resistance_; }
110+
void setResistance(float resistance) { resistance_ = resistance; }
111+
int getNetLength() { return net_length_; }
112+
void setNetLength(int net_length) { net_length_ = net_length; }
109113

110114
private:
111115
odb::dbNet* db_net_;
@@ -121,6 +125,8 @@ struct FrNet // A Net is a set of connected MazePoints
121125
float slack_;
122126
bool is_soft_ndr_ = false;
123127
bool is_res_aware_ = false;
128+
float resistance_;
129+
int net_length_;
124130
// Non-null when an NDR has been applied to the net.
125131
std::unique_ptr<std::vector<int8_t>> edge_cost_per_layer_;
126132
};
@@ -240,8 +246,7 @@ struct OrderNetPin
240246
int minX;
241247
float length_per_pin; // net length over pin count
242248
int ndr_priority; // NDR nets are assigned first
243-
int res_aware;
244-
float slack;
249+
float res_aware_score;
245250
int clock;
246251
};
247252

src/grt/src/fastroute/include/FastRoute.h

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ class FastRouteCore
229229
void setCongestionReportIterStep(int congestion_report_iter_step);
230230
void setCongestionReportFile(const char* congestion_file_name);
231231
void setGridMax(int x_max, int y_max);
232+
void setDetourPenalty(int penalty);
232233
void getCongestionNets(std::set<odb::dbNet*>& congestion_nets);
233234
void computeCongestionInformation();
234235
std::vector<int> getOriginalResources();
@@ -287,7 +288,7 @@ class FastRouteCore
287288
double dbuToMicrons(int dbu);
288289
odb::Rect globalRoutingToBox(const GSegment& route);
289290
NetRouteMap getRoutes();
290-
void updateSlacks(float percentage = 1);
291+
void updateSlacks(float percentage = 0.15);
291292
void preProcessTechLayers();
292293
odb::dbTechLayer* getTechLayer(int layer, bool is_via);
293294

@@ -383,7 +384,8 @@ class FastRouteCore
383384
std::vector<int*>& points_heap_3D,
384385
multi_array<int, 3>& dist_3D,
385386
multi_array<Direction, 3>& directions_3D,
386-
multi_array<int, 3>& corr_edge_3D);
387+
multi_array<int, 3>& corr_edge_3D,
388+
multi_array<int, 3>& path_len_3D);
387389
void setupHeap3D(int netID,
388390
int edgeID,
389391
std::vector<int*>& src_heap_3D,
@@ -392,6 +394,7 @@ class FastRouteCore
392394
multi_array<int, 3>& corr_edge_3D,
393395
multi_array<int, 3>& d1_3D,
394396
multi_array<int, 3>& d2_3D,
397+
multi_array<int, 3>& path_len_3D,
395398
int regionX1,
396399
int regionX2,
397400
int regionY1,
@@ -537,16 +540,24 @@ class FastRouteCore
537540
multi_array<int, 2>& layer_grid,
538541
int net_cost);
539542
void assignEdge(int netID, int edgeID, bool processDIR);
540-
int getLayerResistance(int layer, int length, FrNet* net);
541-
int getViaResistance(int from_layer, int to_layer);
542-
bool needResistanceAware(int net_id);
543543
void recoverEdge(int netID, int edgeID);
544544
void layerAssignmentV4();
545545
void netpinOrderInc();
546546
void checkRoute3D();
547547
void StNetOrder();
548548
float CalculatePartialSlack();
549549
float getNetSlack(odb::dbNet* net);
550+
551+
// Resistance-aware related functions
552+
float getWireResistance(int layer, int length, FrNet* net);
553+
float getViaResistance(int from_layer, int to_layer);
554+
int getWireCost(int layer, int length, FrNet* net);
555+
int getViaCost(int from_layer, int to_layer);
556+
float getNetResistance(FrNet* net, bool assume_layer = false);
557+
float getResAwareScore(FrNet* net);
558+
void updateWorstMetrics(FrNet* net);
559+
void resetWorstMetrics();
560+
550561
/**
551562
* @brief Validates the routing of edges for a specified net.
552563
*
@@ -622,6 +633,10 @@ class FastRouteCore
622633
bool enable_resistance_aware_ = false;
623634
bool is_3d_step_ = false;
624635
bool is_incremental_grt_ = false;
636+
float worst_slack_;
637+
float worst_net_resistance_;
638+
int worst_net_length_;
639+
int worst_fanout_;
625640
int num_adjust_;
626641
int v_capacity_;
627642
int h_capacity_;
@@ -718,6 +733,8 @@ class FastRouteCore
718733
std::vector<int*> dest_heap_3D_;
719734
multi_array<int, 3> d1_3D_;
720735
multi_array<int, 3> d2_3D_;
736+
multi_array<int, 3> path_len_3D_;
737+
int detour_penalty_;
721738
};
722739

723740
extern const char* getNetName(odb::dbNet* db_net);

src/grt/src/fastroute/src/FastRoute.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ FastRouteCore::FastRouteCore(odb::dbDatabase* db,
6565
logger_(log),
6666
stt_builder_(stt_builder),
6767
sta_(sta),
68-
debug_(new DebugSetting())
68+
debug_(new DebugSetting()),
69+
detour_penalty_(0)
6970
{
7071
}
7172

@@ -128,6 +129,8 @@ void FastRouteCore::clear()
128129

129130
vertical_blocked_intervals_.clear();
130131
horizontal_blocked_intervals_.clear();
132+
133+
detour_penalty_ = 0;
131134
}
132135

133136
void FastRouteCore::clearNets()
@@ -203,6 +206,7 @@ void FastRouteCore::setGridsAndLayers(int x, int y, int nLayers)
203206

204207
d1_3D_.resize(boost::extents[num_layers_][y_range_][x_range_]);
205208
d2_3D_.resize(boost::extents[num_layers_][y_range_][x_range_]);
209+
path_len_3D_.resize(boost::extents[num_layers_][y_range_][x_range_]);
206210
}
207211

208212
void FastRouteCore::addVCapacity(int16_t verticalCapacity, int layer)
@@ -1371,7 +1375,7 @@ NetRouteMap FastRouteCore::run()
13711375
int slope;
13721376
int max_adj;
13731377
int long_edge_len = 40;
1374-
const int short_edge_len = 12;
1378+
int short_edge_len = 12;
13751379
const int soft_ndr_overflow_th = 10000;
13761380

13771381
// call FLUTE to generate RSMT and break the nets into segments (2-pin nets)
@@ -1471,6 +1475,7 @@ NetRouteMap FastRouteCore::run()
14711475
if (debug_->isOn() && debug_->rectilinearSTree) {
14721476
for (const int& netID : net_ids_) {
14731477
if (nets_[netID]->getDbNet() == debug_->net) {
1478+
logger_->report("RST Tree before overflow iterations");
14741479
StTreeVisualization(sttrees_[netID], nets_[netID], false);
14751480
}
14761481
}
@@ -1759,9 +1764,9 @@ NetRouteMap FastRouteCore::run()
17591764

17601765
// Debug mode Tree 2D after overflow iterations
17611766
if (debug_->isOn() && debug_->tree2D) {
1762-
logger_->report("Tree 2D after overflow iterations");
17631767
for (const int& netID : net_ids_) {
17641768
if (nets_[netID]->getDbNet() == debug_->net) {
1769+
logger_->report("Tree 2D after overflow iterations");
17651770
StTreeVisualization(sttrees_[netID], nets_[netID], false);
17661771
}
17671772
}
@@ -1812,6 +1817,7 @@ NetRouteMap FastRouteCore::run()
18121817
// Increase ripup threshold if res-aware is enabled
18131818
if (enable_resistance_aware_) {
18141819
long_edge_len = BIG_INT;
1820+
short_edge_len = BIG_INT;
18151821
}
18161822

18171823
mazeRouteMSMDOrder3D(enlarge_, 0, long_edge_len);
@@ -1843,6 +1849,7 @@ NetRouteMap FastRouteCore::run()
18431849
if (debug_->isOn() && debug_->tree3D) {
18441850
for (const int& netID : net_ids_) {
18451851
if (nets_[netID]->getDbNet() == debug_->net) {
1852+
logger_->report("Tree 3D after maze route 3D");
18461853
StTreeVisualization(sttrees_[netID], nets_[netID], true);
18471854
}
18481855
}
@@ -2005,6 +2012,11 @@ void FastRouteCore::setGridMax(int x_max, int y_max)
20052012
y_grid_max_ = y_max;
20062013
}
20072014

2015+
void FastRouteCore::setDetourPenalty(int penalty)
2016+
{
2017+
detour_penalty_ = penalty;
2018+
}
2019+
20082020
std::vector<int> FastRouteCore::getOriginalResources()
20092021
{
20102022
std::vector<int> original_resources(num_layers_);

src/grt/src/fastroute/src/RSMT.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,7 @@ void FastRouteCore::gen_brk_RSMT(const bool congestionDriven,
680680
}
681681
if (debug_->isOn() && debug_->steinerTree
682682
&& net->getDbNet() == debug_->net) {
683+
logger_->report("Steiner Tree 2D");
683684
steinerTreeVisualization(rsmt, net);
684685
}
685686

0 commit comments

Comments
 (0)