Skip to content

Commit 5de882b

Browse files
exclude left and bottom channels in average channel width factor computation
1 parent cf73987 commit 5de882b

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,27 +155,25 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
155155
void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_(float place_cost_exp) {
156156
const auto& device_ctx = g_vpr_ctx.device();
157157

158-
const int grid_height = device_ctx.grid.height();
159-
const int grid_width = device_ctx.grid.width();
158+
const int grid_height = (int)device_ctx.grid.height();
159+
const int grid_width = (int)device_ctx.grid.width();
160160

161161
/* Access arrays below as chan?_place_cost_fac_(subhigh, sublow). Since subhigh must be greater than or
162162
* equal to sublow, we will only access the lower half of a matrix, but we allocate the whole matrix anyway
163163
* for simplicity, so we can use the vtr utility matrix functions. */
164-
acc_chanx_width_ = vtr::NdOffsetMatrix<int, 1>({{{-2, grid_height}}});
165-
acc_chany_width_ = vtr::NdOffsetMatrix<int, 1>({{{-2, grid_width}}});
164+
acc_chanx_width_ = vtr::NdOffsetMatrix<int, 1>({{{-1, grid_height}}});
165+
acc_chany_width_ = vtr::NdOffsetMatrix<int, 1>({{{-1, grid_width}}});
166166

167167
// First compute the number of tracks between channel high and channel low, inclusive.
168-
acc_chanx_width_[-2] = 0;
169-
acc_chanx_width_[-1] = 1;
168+
acc_chanx_width_[-1] = 0;
170169
for (int y = 0; y < grid_height; y++) {
171170
acc_chanx_width_[y] = acc_chanx_width_[y - 1] + device_ctx.chan_width.x_list[y];
172171
if (acc_chanx_width_[y] == acc_chanx_width_[y - 1]) {
173172
acc_chanx_width_[y]++;
174173
}
175174
}
176175

177-
acc_chany_width_[-2] = 0;
178-
acc_chany_width_[-1] = 1;
176+
acc_chany_width_[-1] = 0;
179177
for (int x = 0; x < grid_width; x++) {
180178
acc_chany_width_[x] = acc_chany_width_[x - 1] + device_ctx.chan_width.y_list[x];
181179
if (acc_chany_width_[x] == acc_chany_width_[x - 1]) {

vpr/src/place/net_cost_handler.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,12 +514,12 @@ class NetCostHandler {
514514

515515
template<typename BBT>
516516
std::pair<double, double> get_chan_place_fac_(const BBT& bb) {
517-
const int total_chanx_width = acc_chanx_width_[bb.ymax] - acc_chanx_width_[bb.ymin - 2];
518-
const double inverse_average_chanx_width = (bb.ymax - bb.ymin + 2.0) / total_chanx_width;
517+
const int total_chanx_width = acc_chanx_width_[bb.ymax] - acc_chanx_width_[bb.ymin - 1];
518+
const double inverse_average_chanx_width = (bb.ymax - bb.ymin + 1.0) / total_chanx_width;
519519
const double inverse_average_chanx_width_sharpened = std::pow(inverse_average_chanx_width, (double)placer_opts_.place_cost_exp);
520520

521-
const int total_chany_width = acc_chany_width_[bb.xmax] - acc_chany_width_[bb.xmin - 2];
522-
const double inverse_average_chany_width = (bb.xmax - bb.xmin + 2.0) / total_chany_width;
521+
const int total_chany_width = acc_chany_width_[bb.xmax] - acc_chany_width_[bb.xmin - 1];
522+
const double inverse_average_chany_width = (bb.xmax - bb.xmin + 1.0) / total_chany_width;
523523
const double inverse_average_chany_width_sharpened = std::pow(inverse_average_chany_width, (double)placer_opts_.place_cost_exp);
524524

525525
return {inverse_average_chanx_width_sharpened, inverse_average_chany_width_sharpened};

0 commit comments

Comments
 (0)