Skip to content

Commit fa69111

Browse files
committed
add RRGraph object and basic check_rr_graph_obj() function
1 parent a0b488f commit fa69111

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

vpr/src/util/rr_graph_obj_util.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/****************************************************************************
2+
* This file include most-utilized functions that manipulate on the
3+
* RRGraph object
4+
***************************************************************************/
5+
#include <tuple>
6+
#include "rr_graph_obj_util.h"
7+
8+
/****************************************************************************
9+
* Find the switches interconnecting two nodes
10+
* Return a vector of switch ids
11+
***************************************************************************/
12+
std::vector<RRSwitchId> find_rr_graph_switches(const RRGraph& rr_graph,
13+
const RRNodeId& from_node,
14+
const RRNodeId& to_node) {
15+
std::vector<RRSwitchId> switches;
16+
std::vector<RREdgeId> edges = rr_graph.find_edges(from_node, to_node);
17+
if (true == edges.empty()) {
18+
/* edge is open, we return an empty vector of switches */
19+
return switches;
20+
}
21+
22+
/* Reach here, edge list is not empty, find switch id one by one
23+
* and update the switch list
24+
*/
25+
for (auto edge : edges) {
26+
switches.push_back(rr_graph.edge_switch(edge));
27+
}
28+
29+
return switches;
30+
}

vpr/src/util/rr_graph_obj_util.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#ifndef RR_GRAPH_OBJ_UTIL_H
2+
#define RR_GRAPH_OBJ_UTIL_H
3+
4+
/* Include header files which include data structures used by
5+
* the function declaration
6+
*/
7+
#include "rr_graph_obj.h"
8+
9+
/* Get node-to-node switches in a RRGraph */
10+
std::vector<RRSwitchId> find_rr_graph_switches(const RRGraph& rr_graph,
11+
const RRNodeId& from_node,
12+
const RRNodeId& to_node);
13+
14+
#endif

0 commit comments

Comments
 (0)