Skip to content

Commit 56dcbc8

Browse files
committed
[VPR] Add a new API find_nodes_at_all_sides() to RRSpatialLookup
1 parent e429303 commit 56dcbc8

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

vpr/src/device/rr_spatial_lookup.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,32 @@ std::vector<RRNodeId> RRSpatialLookup::find_channel_nodes(int x,
130130
return channel_nodes;
131131
}
132132

133+
std::vector<RRNodeId> RRSpatialLookup::find_nodes_at_all_sides(int x,
134+
int y,
135+
t_rr_type rr_type,
136+
int ptc) const {
137+
std::vector<RRNodeId> indices;
138+
139+
/* TODO: Consider to access the raw data like find_node() rather than calling find_node() many times, which hurts runtime */
140+
if (rr_type == IPIN || rr_type == OPIN) {
141+
//For pins we need to look at all the sides of the current grid tile
142+
for (e_side side : SIDES) {
143+
RRNodeId rr_node_index = find_node(x, y, rr_type, ptc, side);
144+
if (rr_node_index) {
145+
indices.push_back(rr_node_index);
146+
}
147+
}
148+
} else {
149+
//Sides do not effect non-pins so there should only be one per ptc
150+
RRNodeId rr_node_index = find_node(x, y, rr_type, ptc);
151+
if (rr_node_index) {
152+
indices.push_back(rr_node_index);
153+
}
154+
}
155+
156+
return indices;
157+
}
158+
133159
void RRSpatialLookup::add_node(RRNodeId node,
134160
int x,
135161
int y,

vpr/src/device/rr_spatial_lookup.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ class RRSpatialLookup {
8080
int y,
8181
t_rr_type type) const;
8282

83+
/**
84+
* Like find_node() but returns all matching nodes on all the sides.
85+
* This is particularly useful for getting all instances
86+
* of a specific IPIN/OPIN at a specific gird tile (x,y) location.
87+
*/
88+
std::vector<RRNodeId> find_nodes_at_all_sides(int x,
89+
int y,
90+
t_rr_type rr_type,
91+
int ptc) const;
92+
8393
/* -- Mutators -- */
8494
public:
8595
/**

0 commit comments

Comments
 (0)