@@ -68,6 +68,7 @@ struct Router2
6868 int cx, cy, hpwl;
6969 int total_route_us = 0 ;
7070 float max_crit = 0 ;
71+ int fail_count = 0 ;
7172 };
7273
7374 struct WireScore
@@ -189,6 +190,10 @@ struct Router2
189190 log_info (" %s: bb=(%d, %d)->(%d, %d) c=(%d, %d) hpwl=%d\n " , ctx->nameOf (ni), nets.at (i).bb .x0 ,
190191 nets.at (i).bb .y0 , nets.at (i).bb .x1 , nets.at (i).bb .y1 , nets.at (i).cx , nets.at (i).cy ,
191192 nets.at (i).hpwl );
193+ nets.at (i).bb .x0 = std::max (nets.at (i).bb .x0 - cfg.bb_margin_x , 0 );
194+ nets.at (i).bb .y0 = std::max (nets.at (i).bb .y0 - cfg.bb_margin_y , 0 );
195+ nets.at (i).bb .x1 = std::min (nets.at (i).bb .x1 + cfg.bb_margin_x , ctx->getGridDimX ());
196+ nets.at (i).bb .y1 = std::min (nets.at (i).bb .y1 + cfg.bb_margin_y , ctx->getGridDimY ());
192197 i++;
193198 }
194199 }
@@ -264,11 +269,7 @@ struct Router2
264269 };
265270 };
266271
267- bool hit_test_pip (ArcBounds &bb, Loc l)
268- {
269- return l.x >= (bb.x0 - cfg.bb_margin_x ) && l.x <= (bb.x1 + cfg.bb_margin_x ) &&
270- l.y >= (bb.y0 - cfg.bb_margin_y ) && l.y <= (bb.y1 + cfg.bb_margin_y );
271- }
272+ bool hit_test_pip (ArcBounds &bb, Loc l) { return l.x >= bb.x0 && l.x <= bb.x1 && l.y >= bb.y0 && l.y <= bb.y1 ; }
272273
273274 double curr_cong_weight, hist_cong_weight, estimate_weight;
274275
@@ -684,7 +685,7 @@ struct Router2
684685 if (is_bb && !hit_test_pip(ad.bb, ctx->getPipLocation(dh)) && wire_intent != ID_PSEUDO_GND && wire_intent != ID_PSEUDO_VCC)
685686 continue;
686687#else
687- if (is_bb && !hit_test_pip (ad .bb , ctx->getPipLocation (dh)))
688+ if (is_bb && !hit_test_pip (nd .bb , ctx->getPipLocation (dh)))
688689 continue ;
689690 if (!ctx->checkPipAvailForNet (dh, net)) {
690691 ROUTE_LOG_DBG (" Skipping pip %s because it is bound to net '%s' not net '%s'\n " , ctx->nameOfPip (dh),
@@ -870,6 +871,17 @@ struct Router2
870871 failed_nets.insert (bound.first );
871872 }
872873 }
874+ for (int n : failed_nets) {
875+ auto &net_data = nets.at (n);
876+ ++net_data.fail_count ;
877+ if ((net_data.fail_count % 3 ) == 0 ) {
878+ // Every three times a net fails to route, expand the bounding box to increase the search space
879+ net_data.bb .x0 = std::max (net_data.bb .x0 - 1 , 0 );
880+ net_data.bb .y0 = std::max (net_data.bb .y0 - 1 , 0 );
881+ net_data.bb .x1 = std::min (net_data.bb .x1 + 1 , ctx->getGridDimX ());
882+ net_data.bb .y1 = std::min (net_data.bb .y1 + 1 , ctx->getGridDimY ());
883+ }
884+ }
873885 }
874886
875887 bool bind_and_check (NetInfo *net, int usr_idx, int phys_pin)
@@ -1113,10 +1125,10 @@ struct Router2
11131125 for (auto &th : tcs) {
11141126 th.rng .rngseed (ctx->rng64 ());
11151127 }
1116- int le_x = mid_x - cfg. bb_margin_x ;
1117- int rs_x = mid_x + cfg. bb_margin_x ;
1118- int le_y = mid_y - cfg. bb_margin_y ;
1119- int rs_y = mid_y + cfg. bb_margin_y ;
1128+ int le_x = mid_x;
1129+ int rs_x = mid_x;
1130+ int le_y = mid_y;
1131+ int rs_y = mid_y;
11201132 // Set up thread bounding boxes
11211133 tcs.at (0 ).bb = ArcBounds (0 , 0 , mid_x, mid_y);
11221134 tcs.at (1 ).bb = ArcBounds (mid_x + 1 , 0 , std::numeric_limits<int >::max (), le_y);
0 commit comments