@@ -155,24 +155,12 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
155
155
}
156
156
157
157
void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_ (float place_cost_exp) {
158
- /* Allocates and loads the chanx_place_cost_fac and chany_place_cost_fac *
159
- * arrays with the inverse of the average number of tracks per channel *
160
- * between [subhigh] and [sublow]. This is only useful for the cost *
161
- * function that takes the length of the net bounding box in each *
162
- * dimension divided by the average number of tracks in that direction. *
163
- * For other cost functions, you don't have to bother calling this *
164
- * routine; when using the cost function described above, however, you *
165
- * must always call this routine after you call init_chan and before *
166
- * you do any placement cost determination. The place_cost_exp factor *
167
- * specifies to what power the width of the channel should be taken -- *
168
- * larger numbers make narrower channels more expensive. */
169
-
170
158
auto & device_ctx = g_vpr_ctx.device ();
171
159
172
160
const size_t grid_height = device_ctx.grid .height ();
173
161
const size_t grid_width = device_ctx.grid .width ();
174
162
175
- /* Access arrays below as chan?_place_cost_fac[ subhigh][ sublow] . Since subhigh must be greater than or
163
+ /* Access arrays below as chan?_place_cost_fac_( subhigh, sublow) . Since subhigh must be greater than or
176
164
* equal to sublow, we will only access the lower half of a matrix, but we allocate the whole matrix anyway
177
165
* for simplicity, so we can use the vtr utility matrix functions. */
178
166
chanx_place_cost_fac_.resize ({grid_height + 1 , grid_height + 1 });
@@ -189,7 +177,7 @@ void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_(float place_c
189
177
}
190
178
191
179
/* Now compute the inverse of the average number of tracks per channel *
192
- * between high and low. The cost function divides by the average *
180
+ * between high and low. The cost function divides by the average *
193
181
* number of tracks per channel, so by storing the inverse I convert *
194
182
* this to a faster multiplication. Take this final number to the *
195
183
* place_cost_exp power -- numbers other than one mean this is no *
@@ -1400,6 +1388,7 @@ void NetCostHandler::get_layer_bb_from_scratch_(ClusterNetId net_id,
1400
1388
}
1401
1389
}
1402
1390
1391
+
1403
1392
double NetCostHandler::get_net_cube_bb_cost_ (ClusterNetId net_id, bool use_ts) {
1404
1393
// Finds the cost due to one net by looking at its coordinate bounding box.
1405
1394
auto & cluster_ctx = g_vpr_ctx.clustering ();
@@ -1415,6 +1404,12 @@ double NetCostHandler::get_net_cube_bb_cost_(ClusterNetId net_id, bool use_ts) {
1415
1404
/* Cost = wire length along channel * cross_count / average *
1416
1405
* channel capacity. Do this for x, then y direction and add. */
1417
1406
1407
+ /* For average channel width factor, I'll always include the channel immediately
1408
+ * below and the channel immediately to the left of the bounding box, so both bb.ymin
1409
+ * and bb.xmin are subtracted by 1 before being used as indices of chan?_place_cost_fac_.
1410
+ * chan?_place_cost_fac_ objects can handle -1 indices internally.
1411
+ */
1412
+
1418
1413
double ncost;
1419
1414
ncost = (bb.xmax - bb.xmin + 1 ) * crossing * chanx_place_cost_fac_ (bb.ymax , bb.ymin - 1 );
1420
1415
ncost += (bb.ymax - bb.ymin + 1 ) * crossing * chany_place_cost_fac_ (bb.xmax , bb.xmin - 1 );
@@ -1452,6 +1447,12 @@ double NetCostHandler::get_net_per_layer_bb_cost_(ClusterNetId net_id , bool use
1452
1447
/* Cost = wire length along channel * cross_count / average *
1453
1448
* channel capacity. Do this for x, then y direction and add. */
1454
1449
1450
+ /* For average channel width factor, I'll always include the channel immediately
1451
+ * below and the channel immediately to the left of the bounding box, so both bb.ymin
1452
+ * and bb.xmin are subtracted by 1 before being used as indices of chan?_place_cost_fac_.
1453
+ * chan?_place_cost_fac_ objects can handle -1 indices internally.
1454
+ */
1455
+
1455
1456
ncost += (bb[layer_num].xmax - bb[layer_num].xmin + 1 ) * crossing
1456
1457
* chanx_place_cost_fac_ (bb[layer_num].ymax , bb[layer_num].ymin - 1 );
1457
1458
0 commit comments