Skip to content

Commit 57ba9a3

Browse files
committed
fixed an issue where the route generation in the bfs routing algorithm was causing a segmentation fault. Also updated the error message when no route was found in the bfs routing algorithm
1 parent 7f62b7e commit 57ba9a3

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

vpr/src/noc/bfs_routing.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void BFSRouting::route_flow(NocRouterId src_router_id, NocRouterId sink_router_i
8888
generate_route(sink_router_id, flow_route, noc_model, router_parent_link);
8989
} else {
9090
// a path was not found so throw an error to the user
91-
VPR_FATAL_ERROR(VPR_ERROR_OTHER, "No route could be found from starting router with id:'%d' and the destination router with id:'%d' using the XY-Routing algorithm.", src_router.get_router_user_id(), sink_router.get_router_user_id());
91+
VPR_FATAL_ERROR(VPR_ERROR_OTHER, "No route could be found from starting router with id:'%d' and the destination router with id:'%d' using the breadth-first search routing algorithm.", src_router.get_router_user_id(), sink_router.get_router_user_id());
9292
}
9393

9494
return;
@@ -111,6 +111,9 @@ void BFSRouting::generate_route(NocRouterId start_router_id, std::vector<NocLink
111111
// add the parent link to the path. Since we are tracing backwards we need to store the links in fron of the last link.
112112
flow_route.emplace(route_beginning, curr_intermediate_router_parent_link->second);
113113

114+
// update the reference to the beginning of the route
115+
route_beginning = flow_route.begin();
116+
114117
// now move to the next intermediate router in the path. This will be the source router of the parent link
115118
curr_intermediate_router = noc_model.get_single_noc_link(curr_intermediate_router_parent_link->second).get_source_router();
116119
// now get the parent of the router we moved to

vpr/test/test_bfs_routing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") {
124124
std::vector<NocLinkId> found_path;
125125

126126
// run the routing algorithm and we expect ir ro fail
127-
REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model), "No route could be found from starting router with ID:'12' and the destination router with ID:'3' using the XY-Routing algorithm.");
127+
REQUIRE_THROWS_WITH(routing_algorithm.route_flow(start_router_id, sink_router_id, found_path, noc_model), "No route could be found from starting router with id:'12' and the destination router with id:'3' using the breadth-first search routing algorithm.");
128128
}
129129
}
130130

0 commit comments

Comments
 (0)