Skip to content

Commit 441400a

Browse files
use rr extracted chan widths in NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_()
1 parent e297202 commit 441400a

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -143,33 +143,34 @@ void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_() {
143143
const size_t grid_height = device_ctx.grid.height();
144144
const size_t grid_width = device_ctx.grid.width();
145145

146-
/* These arrays contain accumulative channel width between channel zero and
147-
* the channel specified by the given index. The accumulated channel width
148-
* is inclusive, meaning that it includes both channel zero and channel `idx`.
149-
* To compute the total channel width between channels 'low' and 'high', use the
150-
* following formula:
151-
* acc_chan?_width_[high] - acc_chan?_width_[low - 1]
152-
* This returns the total number of tracks between channels 'low' and 'high',
153-
* including tracks in these channels.
154-
*/
146+
// These arrays contain accumulative channel width between channel zero and
147+
// the channel specified by the given index. The accumulated channel width
148+
// is inclusive, meaning that it includes both channel zero and channel `idx`.
149+
// To compute the total channel width between channels 'low' and 'high', use the
150+
// following formula:
151+
// acc_chan?_width_[high] - acc_chan?_width_[low - 1]
152+
// This returns the total number of tracks between channels 'low' and 'high',
153+
// including tracks in these channels.
155154
acc_chanx_width_ = vtr::PrefixSum1D<int>(grid_height, [&](size_t y) noexcept {
156-
int chan_x_width = device_ctx.chan_width.x_list[y];
155+
int chan_x_width = device_ctx.rr_chanx_list[y];
157156

158-
/* If the number of tracks in a channel is zero, two consecutive elements take the same
159-
* value. This can lead to a division by zero in get_chanxy_cost_fac_(). To avoid this
160-
* potential issue, we assume that the channel width is at least 1.
161-
*/
162-
if (chan_x_width == 0)
157+
// If the number of tracks in a channel is zero, two consecutive elements take the same
158+
// value. This can lead to a division by zero in get_chanxy_cost_fac_(). To avoid this
159+
// potential issue, we assume that the channel width is at least 1.
160+
if (chan_x_width == 0) {
163161
return 1;
162+
}
164163

165164
return chan_x_width;
166165
});
166+
167167
acc_chany_width_ = vtr::PrefixSum1D<int>(grid_width, [&](size_t x) noexcept {
168-
int chan_y_width = device_ctx.chan_width.y_list[x];
168+
int chan_y_width = device_ctx.rr_chany_list[x];
169169

170170
// to avoid a division by zero
171-
if (chan_y_width == 0)
171+
if (chan_y_width == 0) {
172172
return 1;
173+
}
173174

174175
return chan_y_width;
175176
});

0 commit comments

Comments
 (0)