@@ -37,6 +37,24 @@ void compare_routes(const std::vector<NocLink>& golden_path,
37
37
}
38
38
}
39
39
40
+
41
+ void check_turn_legality (const vtr::vector<NocTrafficFlowId, std::vector<NocLinkId>>& traffic_flow_routes,
42
+ const NocStorage& noc_model,
43
+ const TurnModelRouting& routing_algorithm) {
44
+
45
+ for (const auto & traffic_flow_route : traffic_flow_routes) {
46
+ for (size_t i = 0 ; i < traffic_flow_route.size () - 1 ; i++) {
47
+ const NocLink& noc_link1 = noc_model.get_single_noc_link (traffic_flow_route[i]);
48
+ const NocLink& noc_link2 = noc_model.get_single_noc_link (traffic_flow_route[i + 1 ]);
49
+ REQUIRE (noc_link1.get_sink_router () == noc_link2.get_source_router ());
50
+ const NocRouter& router_1 = noc_model.get_single_noc_router (noc_link1.get_source_router ());
51
+ const NocRouter& router_2 = noc_model.get_single_noc_router (noc_link1.get_sink_router ());
52
+ const NocRouter& router_3 = noc_model.get_single_noc_router (noc_link2.get_sink_router ());
53
+ REQUIRE (routing_algorithm.is_turn_legal ({router_1, router_2, router_3}, noc_model) == true );
54
+ }
55
+ }
56
+ }
57
+
40
58
TEST_CASE (" test_route_flow" , " [vpr_noc_odd_even_routing]" ) {
41
59
/* Creating a test FPGA device below. The NoC itself will be a 10x10 mesh where
42
60
* they will span over a grid size of 10x10. So this FPGA will only consist of NoC routers */
@@ -207,7 +225,7 @@ TEST_CASE("test_route_flow", "[vpr_noc_odd_even_routing]") {
207
225
compare_routes (golden_path, found_path, noc_model);
208
226
}
209
227
210
- SECTION (" To be named " ) {
228
+ SECTION (" Test case where multiple traffic flows are router, and routes are checked for turn legality and deadlock freedom. " ) {
211
229
std::random_device device;
212
230
std::mt19937 rand_num_gen (device ());
213
231
std::uniform_int_distribution<std::mt19937::result_type> dist (0 , 99 );
@@ -242,9 +260,8 @@ TEST_CASE("test_route_flow", "[vpr_noc_odd_even_routing]") {
242
260
243
261
REQUIRE (cdg.has_cycles () == false );
244
262
263
+ check_turn_legality (traffic_flow_routes, noc_model, routing_algorithm);
245
264
}
246
-
247
-
248
265
}
249
266
250
267
}
0 commit comments