Skip to content

Commit 7366945

Browse files
apply PR comments
1 parent 7e18a9e commit 7366945

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

vpr/src/base/vpr_types.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,10 +1651,13 @@ struct t_node_edge {
16511651
};
16521652

16531653
/**
1654-
* @brief Non-configurably connected nodes and edges in the RR graph
1655-
* @note It is assumed that node_sets and edge_sets are stored in the same order,
1656-
* meaning that nodes and edges that create an RR set can be accesses using
1657-
* the same index.
1654+
* @brief Groups of non-configurably connected nodes and edges in the RR graph.
1655+
* @note Each group is represented by a node set and an edge set, stored at the same index.
1656+
*
1657+
* For example, in an architecture with L-shaped wires formed by an x- and y-directed segment
1658+
* connected by an electrical short, each L-shaped wire corresponds to a new group. The group's
1659+
* index provides access to its node set (containing two RRNodeIds) and edge set (containing two
1660+
* directed edge in opposite directions).
16581661
*/
16591662
struct t_non_configurable_rr_sets {
16601663
std::vector<std::set<RRNodeId>> node_sets;
@@ -1670,11 +1673,11 @@ struct t_power_opts {
16701673
* @param max= Maximum channel width between x_max and y_max.
16711674
* @param x_min= Minimum channel width of horizontal channels. Initialized when init_chan() is invoked in rr_graph2.cpp
16721675
* @param y_min= Same as above but for vertical channels.
1673-
* @param x_max= Maximum channel width of horiozntal channels. Initialized when init_chan() is invoked in rr_graph2.cpp
1676+
* @param x_max= Maximum channel width of horizontal channels. Initialized when init_chan() is invoked in rr_graph2.cpp
16741677
* @param y_max= Same as above but for vertical channels.
16751678
* @param x_list= Stores the channel width of all horizontal channels and thus goes from [0..grid.height()]
16761679
* (imagine a 2D Cartesian grid with horizontal lines starting at every grid point on a line parallel to the y-axis)
1677-
* @param y_list= Stores the channel width of all verical channels and thus goes from [0..grid.width()]
1680+
* @param y_list= Stores the channel width of all vertical channels and thus goes from [0..grid.width()]
16781681
* (imagine a 2D Cartesian grid with vertical lines starting at every grid point on a line parallel to the x-axis)
16791682
*/
16801683

vpr/src/route/check_route.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ static void check_locally_used_clb_opins(const t_clb_opins_used& clb_opins_used_
4040
enum e_route_type route_type,
4141
bool is_flat);
4242

43+
/**
44+
* Checks that all non-configurable edges are in a legal configuration.
45+
* @param net_list The netlist whose routing is to be checked.
46+
* @param is_flat True if flat routing is enabled; otherwise false.
47+
*/
4348
static void check_all_non_configurable_edges(const Netlist<>& net_list, bool is_flat);
4449

4550
/**
4651
* @brief Checks that the specified routing is legal with respect to non-configurable edges.
47-
* For routing to be legal if *any* non-configurable edge is used, so must *all*
48-
* other non-configurable edges in the same set
52+
* For routing to be valid, if any non-configurable edge is used, all nodes in the same set
53+
* and the required connecting edges in the set must also be used.
4954
*
5055
* @param net_list A reference to the netlist.
5156
* @param net The net id for which the check is done.
@@ -60,6 +65,7 @@ static bool check_non_configurable_edges(const Netlist<>& net_list,
6065
const t_non_configurable_rr_sets& non_configurable_rr_sets,
6166
const vtr::vector<RRNodeId, int>& rrnode_set_id,
6267
bool is_flat);
68+
6369
static void check_net_for_stubs(const Netlist<>& net_list,
6470
ParentNetId net,
6571
bool is_flat);
@@ -607,8 +613,6 @@ static void check_node_and_range(RRNodeId inode,
607613
is_flat);
608614
}
609615

610-
//Checks that all non-configurable edges are in a legal configuration
611-
//This check is slow, so it has been moved out of check_route()
612616
static void check_all_non_configurable_edges(const Netlist<>& net_list, bool is_flat) {
613617
const auto& rr_graph = g_vpr_ctx.device().rr_graph;
614618

@@ -618,13 +622,15 @@ static void check_all_non_configurable_edges(const Netlist<>& net_list, bool is_
618622
// Specifies which RR set each node is part of.
619623
vtr::vector<RRNodeId, int> rrnode_set_ids(rr_graph.num_nodes(), -1);
620624

621-
int non_configurable_rr_set_id = 0;
622-
for (const auto& node_set : non_configurable_rr_sets.node_sets) {
625+
const size_t num_non_cfg_rr_sets = non_configurable_rr_sets.node_sets.size();
626+
627+
// Populate rrnode_set_ids
628+
for (size_t non_cfg_rr_set_id = 0; non_cfg_rr_set_id < num_non_cfg_rr_sets; non_cfg_rr_set_id++) {
629+
const std::set<RRNodeId>& node_set = non_configurable_rr_sets.node_sets[non_cfg_rr_set_id];
623630
for (const RRNodeId node_id : node_set) {
624631
VTR_ASSERT_SAFE(rrnode_set_ids[node_id] == -1);
625-
rrnode_set_ids[node_id] = non_configurable_rr_set_id;
632+
rrnode_set_ids[node_id] = (int)non_cfg_rr_set_id;
626633
}
627-
non_configurable_rr_set_id++;
628634
}
629635

630636
for (auto net_id : net_list.nets()) {
@@ -647,7 +653,7 @@ static bool check_non_configurable_edges(const Netlist<>& net_list,
647653
if (!route_ctx.route_trees[net]) // no routing
648654
return true;
649655

650-
// Collect all the nodes, edges, and RR sets ids used by this net's routing
656+
// Collect all the nodes, edges, and non-configurable RR set ids used by this net's routing
651657
std::set<t_node_edge> routing_edges;
652658
std::set<RRNodeId> routing_nodes;
653659
std::set<int> routing_non_configurable_rr_set_ids;
@@ -658,12 +664,14 @@ static bool check_non_configurable_edges(const Netlist<>& net_list,
658664
t_node_edge edge = {rt_node.parent()->inode, rt_node.inode};
659665
routing_edges.insert(edge);
660666

661-
if (rrnode_set_id[rt_node.inode] >= 0) {
667+
if (rrnode_set_id[rt_node.inode] >= 0) { // The node belongs to a non-configurable RR set
662668
routing_non_configurable_rr_set_ids.insert(rrnode_set_id[rt_node.inode]);
663669
}
664670
}
665671

666672
// Copy used non-configurable RR sets
673+
// This is done to check legality only for used non-configurable RR sets. If a non-configurable RR set
674+
// is not used by a net's routing, it cannot violate the requirements of using that non-configurable RR set.
667675
t_non_configurable_rr_sets used_non_configurable_rr_sets;
668676
used_non_configurable_rr_sets.node_sets.reserve(routing_non_configurable_rr_set_ids.size());
669677
used_non_configurable_rr_sets.edge_sets.reserve(routing_non_configurable_rr_set_ids.size());

0 commit comments

Comments
 (0)