Skip to content

Commit de62b15

Browse files
authored
Merge pull request verilog-to-routing#1579 from acomodi/fix-check-rr-graph-bug
check_rr_graph: fix bug when checking multi-connections between nodes
2 parents 37095c7 + 9825c7f commit de62b15

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

vpr/src/route/check_rr_graph.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,27 @@ void check_rr_graph(const t_graph_type graph_type,
123123

124124
t_rr_type to_rr_type = device_ctx.rr_nodes[to_node].type();
125125

126-
/* Only expect the following cases to have multiple edges
127-
* - chan <-> chan connections
128-
* - IPIN <-> chan connections (unique rr_node for IPIN nodes on multiple sides)
129-
* - OPIN <-> chan connections (unique rr_node for OPIN nodes on multiple sides)
126+
/* It is unusual to have more than one programmable switch (in the same direction) between a from_node and a to_node,
127+
* as the duplicate switch doesn't add more routing flexibility.
128+
*
129+
* However, such duplicate switches can occur for some types of nodes, which we allow below.
130+
* Reasons one could have duplicate switches between two nodes include:
131+
* - The two switches have different electrical characteristics.
132+
* - Wires near the edges of an FPGA are often cut off, and the stubs connected together.
133+
* A regular switch pattern could then result in one physical wire connecting multiple
134+
* times to other wires, IPINs or OPINs.
135+
*
136+
* Only expect the following cases to have multiple edges
137+
* - CHAN <-> CHAN connections
138+
* - CHAN -> IPIN connections (unique rr_node for IPIN nodes on multiple sides)
139+
* - OPIN -> CHAN connections (unique rr_node for OPIN nodes on multiple sides)
130140
*/
131-
if (((to_rr_type != CHANX && to_rr_type != CHANY && rr_type != IPIN)
132-
|| (rr_type != CHANX && rr_type != CHANY))
133-
&& ((to_rr_type != CHANX && to_rr_type != CHANY)
134-
|| (rr_type != CHANX && rr_type != CHANY && rr_type != OPIN))) {
141+
bool is_chan_to_chan = (rr_type == CHANX || rr_type == CHANY) && (to_rr_type == CHANY || to_rr_type == CHANX);
142+
bool is_chan_to_ipin = (rr_type == CHANX || rr_type == CHANY) && to_rr_type == IPIN;
143+
bool is_opin_to_chan = rr_type == OPIN && (to_rr_type == CHANX || to_rr_type == CHANY);
144+
if (!(is_chan_to_chan || is_chan_to_ipin || is_opin_to_chan)) {
135145
VPR_ERROR(VPR_ERROR_ROUTE,
136-
"in check_rr_graph: node %d (%s) connects to node %d (%s) %zu times - multi-connections only expected for CHAN->CHAN.\n",
146+
"in check_rr_graph: node %d (%s) connects to node %d (%s) %zu times - multi-connections only expected for CHAN<->CHAN, CHAN->IPIN, OPIN->CHAN.\n",
137147
inode, rr_node_typename[rr_type], to_node, rr_node_typename[to_rr_type], num_edges_to_node);
138148
}
139149

0 commit comments

Comments
 (0)