5
5
6
6
namespace {
7
7
8
+ constexpr double DUMMY_LATENCY = 1e-9 ;
9
+ constexpr double DUMMY_BANDWIDTH = 1e12 ;
10
+
8
11
TEST_CASE (" test_route_flow" , " [vpr_noc_bfs_routing]" ) {
9
12
/*
10
13
* Creating a test FPGA device below. The NoC itself will be
@@ -29,7 +32,7 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") {
29
32
// add all the routers
30
33
for (int i = 0 ; i < 4 ; i++) {
31
34
for (int j = 0 ; j < 4 ; j++) {
32
- noc_model.add_router ((i * 4 ) + j, j, i, 0 );
35
+ noc_model.add_router ((i * 4 ) + j, j, i, 0 , DUMMY_LATENCY );
33
36
}
34
37
}
35
38
@@ -40,19 +43,19 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") {
40
43
for (int j = 0 ; j < 4 ; j++) {
41
44
// add a link to the left of the router if there exists another router there
42
45
if ((j - 1 ) >= 0 ) {
43
- noc_model.add_link ((NocRouterId)((i * 4 ) + j), (NocRouterId)(((i * 4 ) + j) - 1 ));
46
+ noc_model.add_link ((NocRouterId)((i * 4 ) + j), (NocRouterId)(((i * 4 ) + j) - 1 ), DUMMY_BANDWIDTH, DUMMY_LATENCY );
44
47
}
45
48
// add a link to the top of the router if there exists another router there
46
49
if ((i + 1 ) <= 3 ) {
47
- noc_model.add_link ((NocRouterId)((i * 4 ) + j), (NocRouterId)(((i * 4 ) + j) + 4 ));
50
+ noc_model.add_link ((NocRouterId)((i * 4 ) + j), (NocRouterId)(((i * 4 ) + j) + 4 ), DUMMY_BANDWIDTH, DUMMY_LATENCY );
48
51
}
49
52
// add a link to the right of the router if there exists another router there
50
53
if ((j + 1 ) <= 3 ) {
51
- noc_model.add_link ((NocRouterId)((i * 4 ) + j), (NocRouterId)(((i * 4 ) + j) + 1 ));
54
+ noc_model.add_link ((NocRouterId)((i * 4 ) + j), (NocRouterId)(((i * 4 ) + j) + 1 ), DUMMY_BANDWIDTH, DUMMY_LATENCY );
52
55
}
53
56
// add a link to the bottom of the router if there exists another router there
54
57
if ((i - 1 ) >= 0 ) {
55
- noc_model.add_link ((NocRouterId)((i * 4 ) + j), (NocRouterId)(((i * 4 ) + j) - 4 ));
58
+ noc_model.add_link ((NocRouterId)((i * 4 ) + j), (NocRouterId)(((i * 4 ) + j) - 4 ), DUMMY_BANDWIDTH, DUMMY_LATENCY );
56
59
}
57
60
}
58
61
}
@@ -97,12 +100,12 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") {
97
100
int number_of_links = noc_model.get_noc_links ().size ();
98
101
99
102
// add the diagonal links and also add them to the golden path
100
- noc_model.add_link (NocRouterId (12 ), NocRouterId (9 ));
101
- golden_path.push_back ( NocLinkId ( number_of_links++) );
102
- noc_model.add_link (NocRouterId (9 ), NocRouterId (6 ));
103
- golden_path.push_back ( NocLinkId ( number_of_links++) );
104
- noc_model.add_link (NocRouterId (6 ), NocRouterId (3 ));
105
- golden_path.push_back ( NocLinkId ( number_of_links++) );
103
+ noc_model.add_link (NocRouterId (12 ), NocRouterId (9 ), DUMMY_BANDWIDTH, DUMMY_LATENCY );
104
+ golden_path.emplace_back ( number_of_links++);
105
+ noc_model.add_link (NocRouterId (9 ), NocRouterId (6 ), DUMMY_BANDWIDTH, DUMMY_LATENCY );
106
+ golden_path.emplace_back ( number_of_links++);
107
+ noc_model.add_link (NocRouterId (6 ), NocRouterId (3 ), DUMMY_BANDWIDTH, DUMMY_LATENCY );
108
+ golden_path.emplace_back ( number_of_links++);
106
109
107
110
// now run the routinjg algorithm
108
111
// make sure that a legal route was found (no error should be thrown)
0 commit comments