File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change 2
2
#include < random>
3
3
#include < algorithm>
4
4
5
+ #include " rr_graph_util.h"
6
+
5
7
#include " vtr_memory.h"
6
8
#include " vtr_time.h"
7
9
8
10
#include " vpr_types.h"
9
11
#include " vpr_error.h"
10
12
11
13
#include " globals.h"
12
- #include " rr_graph_util.h"
13
14
14
15
int seg_index_of_cblock (t_rr_type from_rr_type, int to_node) {
15
16
/* Returns the segment number (distance along the channel) of the connection *
@@ -177,3 +178,20 @@ void reorder_rr_graph_nodes(const t_router_opts& router_opts) {
177
178
std::get<2 >(edge));
178
179
});
179
180
}
181
+
182
+ void t_rr_graph_util::init_fan_in_list () {
183
+ auto & rr_nodes = g_vpr_ctx.device ().rr_nodes ;
184
+
185
+ node_fan_in_list_.resize (rr_nodes.size (), std::vector<RREdgeId>(0 ));
186
+ node_fan_in_list_.shrink_to_fit ();
187
+
188
+ // Walk the graph and increment fanin on all dwnstream nodes
189
+ rr_nodes.for_each_edge (
190
+ [&](RREdgeId edge, __attribute__ ((unused)) RRNodeId src, RRNodeId sink) {
191
+ node_fan_in_list_[sink].push_back (edge);
192
+ });
193
+ }
194
+
195
+ t_rr_graph_util::~t_rr_graph_util () {
196
+ node_fan_in_list_.clear ();
197
+ }
Original file line number Diff line number Diff line change 1
1
#ifndef RR_GRAPH_UTIL_H
2
2
#define RR_GRAPH_UTIL_H
3
3
4
+ #include " vpr_types.h"
5
+
4
6
int seg_index_of_cblock (t_rr_type from_rr_type, int to_node);
5
7
6
8
int seg_index_of_sblock (int from_node, int to_node);
7
9
8
10
void reorder_rr_graph_nodes (const t_router_opts& router_opts);
9
11
12
+ // t_rr_graph_util is a utility class that collects utility
13
+ // methods that do not strictly belong to the RR graph storage,
14
+ // as they can use its public interface.
15
+ class t_rr_graph_util {
16
+ public:
17
+ ~t_rr_graph_util ();
18
+
19
+ void init_fan_in_list ();
20
+
21
+ /* Returns a fan-in edge list corresponding to a specific node */
22
+ std::vector<RREdgeId> fan_in_list (RRNodeId id) const {
23
+ return node_fan_in_list_[id];
24
+ }
25
+
26
+ private:
27
+ // Fan in edges for each RR node.
28
+ vtr::vector<RRNodeId, std::vector<RREdgeId>> node_fan_in_list_;
29
+ };
30
+
10
31
#endif
You can’t perform that action at this time.
0 commit comments