Skip to content

Commit 89c5c18

Browse files
committed
[vpr][rr_graph] add get_delayless switch
1 parent e4431f3 commit 89c5c18

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

vpr/src/route/rr_graph.cpp

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,18 @@ static void connect_tile_src_sink_to_pins(RRGraphBuilder& rr_graph_builder,
264264
const int delayless_switch,
265265
t_physical_tile_type_ptr physical_type_ptr);
266266

267+
/**
268+
* Add the edges between IPIN to SINK and SOURCE to OPIN to rr_edges_to_create
269+
* @param rr_graph_builder RR Graph Bulder object which contain the RR Graph storage
270+
* @param class_num_vec Class physical numbers to add the edges connected to them
271+
* @param layer The layer number of the block to add the SINK/SRC connections of it.
272+
* @param i The x location of the block to add the SINK/SRC connections of it.
273+
* @param j The y location of the block to add the SINK/SRC connections of it
274+
* @param rr_edges_to_create An object which store all of the edges created in this function.
275+
* @param delayless_switch Switch ID of the delayless switch.
276+
* @param physical_type_ptr A pointer to the physical type of the block for which the edges are created.
277+
* @param switches_remapped A flag to indicate whether edge switch IDs are remapped
278+
*/
267279
static void connect_src_sink_to_pins(RRGraphBuilder& rr_graph_builder,
268280
const std::vector<int>& class_num_vec,
269281
const int layer,
@@ -659,6 +671,9 @@ static void build_intra_cluster_rr_graph(const t_graph_type graph_type,
659671
bool is_flat,
660672
bool load_rr_graph);
661673

674+
static short get_delayless_switch_id (t_det_routing_arch* det_routing_arch,
675+
bool load_rr_graph);
676+
662677
/******************* Subroutine definitions *******************************/
663678

664679
void create_rr_graph(const t_graph_type graph_type,
@@ -744,19 +759,7 @@ void create_rr_graph(const t_graph_type graph_type,
744759
}
745760

746761
if (is_flat) {
747-
short delayless_switch = OPEN;
748-
if (load_rr_graph) {
749-
const auto& rr_switches = device_ctx.rr_graph.rr_switch();
750-
for (int switch_id = 0; switch_id < static_cast<int>(rr_switches.size()); switch_id++){
751-
const auto& rr_switch = rr_switches[RRSwitchId(switch_id)];
752-
if (rr_switch.name.find("delayless") != std::string::npos) {
753-
delayless_switch = static_cast<short>(switch_id);
754-
break;
755-
}
756-
}
757-
} else {
758-
delayless_switch = det_routing_arch->delayless_switch;
759-
}
762+
short delayless_switch = get_delayless_switch_id(det_routing_arch, load_rr_graph);
760763
VTR_ASSERT(delayless_switch != OPEN);
761764
build_intra_cluster_rr_graph(graph_type,
762765
grid,
@@ -1529,6 +1532,26 @@ static void build_intra_cluster_rr_graph(const t_graph_type graph_type,
15291532
is_flat);
15301533
}
15311534

1535+
static short get_delayless_switch_id (t_det_routing_arch* det_routing_arch,
1536+
bool load_rr_graph) {
1537+
const auto& device_ctx = g_vpr_ctx.device();
1538+
short delayless_switch;
1539+
if (load_rr_graph) {
1540+
const auto& rr_switches = device_ctx.rr_graph.rr_switch();
1541+
for (int switch_id = 0; switch_id < static_cast<int>(rr_switches.size()); switch_id++){
1542+
const auto& rr_switch = rr_switches[RRSwitchId(switch_id)];
1543+
if (rr_switch.name.find("delayless") != std::string::npos) {
1544+
delayless_switch = static_cast<short>(switch_id);
1545+
break;
1546+
}
1547+
}
1548+
} else {
1549+
delayless_switch = det_routing_arch->delayless_switch;
1550+
}
1551+
1552+
return delayless_switch;
1553+
}
1554+
15321555
void build_tile_rr_graph(RRGraphBuilder& rr_graph_builder,
15331556
const t_det_routing_arch& det_routing_arch,
15341557
t_physical_tile_type_ptr physical_tile,

0 commit comments

Comments
 (0)