@@ -1193,23 +1193,20 @@ void GlobalRouter::updatePinAccessPoints()
11931193 cugr_->getITermsAccessPoints (db_net, iterm_to_aps);
11941194 cugr_->getBTermsAccessPoints (db_net, bterm_to_aps);
11951195
1196+ auto updatePinPos = [&](Pin& pin, auto * term, const auto & ap_map) {
1197+ if (auto it = ap_map.find (term); it != ap_map.end ()) {
1198+ const auto & ap = it->second ;
1199+ pin.setConnectionLayer (ap.z ());
1200+ pin.setOnGridPosition (
1201+ grid_->getPositionOnGrid (odb::Point (ap.x (), ap.y ())));
1202+ }
1203+ };
1204+
11961205 for (Pin& pin : net->getPins ()) {
11971206 if (pin.isPort ()) {
1198- if (auto it = bterm_to_aps.find (pin.getBTerm ());
1199- it != bterm_to_aps.end ()) {
1200- const auto & bterm_ap = it->second ;
1201- pin.setConnectionLayer (bterm_ap.z ());
1202- pin.setOnGridPosition (
1203- grid_->getPositionOnGrid (odb::Point (bterm_ap.x (), bterm_ap.y ())));
1204- }
1207+ updatePinPos (pin, pin.getBTerm (), bterm_to_aps);
12051208 } else {
1206- if (auto it = iterm_to_aps.find (pin.getITerm ());
1207- it != iterm_to_aps.end ()) {
1208- const auto & iterm_ap = it->second ;
1209- pin.setConnectionLayer (iterm_ap.z ());
1210- pin.setOnGridPosition (
1211- grid_->getPositionOnGrid (odb::Point (iterm_ap.x (), iterm_ap.y ())));
1212- }
1209+ updatePinPos (pin, pin.getITerm (), iterm_to_aps);
12131210 }
12141211 }
12151212 }
0 commit comments