improve rr_node fast look-up in rr_graph object so that we have easily find all the channel nodes
This commit is contained in:
parent
85f3826939
commit
e2e115e6f3
|
@ -1219,15 +1219,26 @@ void RRGraph::build_fast_node_lookup() const {
|
|||
continue;
|
||||
}
|
||||
RRNodeId node = RRNodeId(id);
|
||||
/* Special for SOURCE and SINK, we should annotate in the look-up
|
||||
/* Special for CHANX and CHANY, we should annotate in the look-up
|
||||
* for all the (x,y) upto (xhigh, yhigh)
|
||||
*/
|
||||
size_t x = node_xlow(node);
|
||||
size_t y = node_ylow(node);
|
||||
size_t x_start = std::min(node_xlow(node), node_xhigh(node));
|
||||
size_t y_start = std::min(node_ylow(node), node_yhigh(node));
|
||||
std::vector<size_t> node_x(std::abs(node_xlow(node) - node_xhigh(node)) + 1);
|
||||
std::vector<size_t> node_y(std::abs(node_ylow(node) - node_yhigh(node)) + 1);
|
||||
|
||||
std::iota(node_x.begin(), node_x.end(), x_start);
|
||||
std::iota(node_y.begin(), node_y.end(), y_start);
|
||||
|
||||
VTR_ASSERT(size_t(std::max(node_xlow(node), node_xhigh(node))) == node_x.back());
|
||||
VTR_ASSERT(size_t(std::max(node_ylow(node), node_yhigh(node))) == node_y.back());
|
||||
|
||||
size_t itype = node_type(node);
|
||||
|
||||
size_t ptc = node_ptc_num(node);
|
||||
|
||||
for (const size_t& x : node_x) {
|
||||
for (const size_t& y : node_y) {
|
||||
if (ptc >= node_lookup_[x][y][itype].size()) {
|
||||
node_lookup_[x][y][itype].resize(ptc + 1);
|
||||
}
|
||||
|
@ -1246,6 +1257,8 @@ void RRGraph::build_fast_node_lookup() const {
|
|||
//Save node in lookup
|
||||
node_lookup_[x][y][itype][ptc][iside] = node;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RRGraph::invalidate_fast_node_lookup() const {
|
||||
|
|
Loading…
Reference in New Issue