@@ -980,9 +980,12 @@ void PlacerPadPlacer::place()
980980 debugPause (" Final placement" );
981981
982982 // Fixed pad locations
983- for (const auto & [inst, pos] : pad_positions) {
984- placeInstance (
985- snapToRowSite (pos), inst, odb::dbOrientType::R0, false , false );
983+ for (auto * inst : getInsts ()) {
984+ placeInstance (snapToRowSite (pad_positions.at (inst)),
985+ inst,
986+ odb::dbOrientType::R0,
987+ false ,
988+ false );
986989 // TODO possibly build in pad flipping
987990 addInstanceObstructions (inst);
988991 }
@@ -1162,6 +1165,7 @@ std::map<odb::dbInst*, int> PlacerPadPlacer::poolAdjacentViolators(
11621165 positions[insts[i]] = position[i];
11631166 }
11641167 placeInstances (positions, true );
1168+ debugCheckPlacement ();
11651169 debugPause (fmt::format (" PAVA itr: {}" , k));
11661170
11671171 if (!updated) {
@@ -1311,21 +1315,22 @@ bool PlacerPadPlacer::padSpreading(
13111315 + (positions[curr]->width / 2 );
13121316 positions[curr]->setLocation (std::max (prev_pos, std::min (next_pos, move_to))
13131317 - (positions[curr]->width / 2 ));
1314- debugPrint (getLogger (),
1315- utl::PAD,
1316- " Place" ,
1317- 3 ,
1318- " {} / {}: {} -> {} (idx: {}) based on {:.6f} s, {:.6f} p, "
1319- " {:.6f} n, {:.6f} t" ,
1320- itr,
1321- curr->getName (),
1322- curr_pos,
1323- positions[curr]->center ,
1324- snapToRowSite (positions[curr]->min ),
1325- spring_force,
1326- repel_prev_force,
1327- repel_next_force,
1328- total_force);
1318+ debugPrint (
1319+ getLogger (),
1320+ utl::PAD,
1321+ " Place" ,
1322+ 3 ,
1323+ " {} / {}: {:.4f}um -> {:.4f}um (idx: {}) based on {:.6f} s, {:.6f} p, "
1324+ " {:.6f} n, {:.6f} t" ,
1325+ itr,
1326+ curr->getName (),
1327+ curr_pos / dbus,
1328+ positions[curr]->center / dbus,
1329+ snapToRowSite (positions[curr]->min ),
1330+ spring_force,
1331+ repel_prev_force,
1332+ repel_next_force,
1333+ total_force);
13291334 }
13301335
13311336 placeInstances (positions);
@@ -1339,8 +1344,9 @@ bool PlacerPadPlacer::padSpreading(
13391344 has_violations,
13401345 total_move / dbus,
13411346 net_move / dbus);
1347+ debugCheckPlacement ();
13421348
1343- if (itr % (getLogger ()->debugCheck (utl::PAD, " Pause" , 2 ) ? 500 : 100 ) == 0 ) {
1349+ if (itr % (getLogger ()->debugCheck (utl::PAD, " Pause" , 2 ) ? 100 : 500 ) == 0 ) {
13441350 debugPause (fmt::format (" Iterative pad spreading: {}" , itr));
13451351 }
13461352
@@ -1490,6 +1496,31 @@ int PlacerPadPlacer::getTunnelingPosition(odb::dbInst* inst,
14901496 return target;
14911497}
14921498
1499+ void PlacerPadPlacer::debugCheckPlacement () const
1500+ {
1501+ if (!getLogger ()->debugCheck (utl::PAD, " Check" , 1 )) {
1502+ return ;
1503+ }
1504+
1505+ bool pause = false ;
1506+ for (auto * inst : getInsts ()) {
1507+ if (checkInstancePlacement (inst)) {
1508+ debugPrint (getLogger (),
1509+ utl::PAD,
1510+ " Check" ,
1511+ 1 ,
1512+ " Invalid placement for {}" ,
1513+ inst->getName ());
1514+ pause = true ;
1515+ }
1516+ }
1517+
1518+ if (pause && gui::Gui::enabled ()) {
1519+ getLogger ()->report (" Pausing GUI due to invalid positions of pads" );
1520+ gui::Gui::get ()->pause ();
1521+ }
1522+ }
1523+
14931524// ////////////////////////
14941525
14951526int PlacerPadPlacer::InstAnchors::overlap (
0 commit comments