Skip to content

Commit f489781

Browse files
fix unit test compilation errors
1 parent 547a7ea commit f489781

File tree

6 files changed

+157
-127
lines changed

6 files changed

+157
-127
lines changed

libs/libarchfpga/test/test_read_xml_arch_file.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#include "catch2/catch_test_macros.hpp"
33
#include "catch2/matchers/catch_matchers_all.hpp"
44

5-
// testting statuc functions so include whole source file it is in
6-
#include "read_xml_arch_file.cpp"
5+
// testing static functions so include whole source file it is in
6+
#include "read_xml_arch_file_noc_tag.cpp"
77

88
// for comparing floats
99
#include "vtr_math.h"
@@ -25,7 +25,7 @@ TEST_CASE("Updating router info in arch", "[NoC Arch Tests]") {
2525

2626
it = test_router_list.find(router_id);
2727

28-
// check first that the router was newly added to the router databse
28+
// check first that the router was newly added to the router database
2929
REQUIRE(it != test_router_list.end());
3030

3131
// no verify the components of the router parameter
@@ -39,7 +39,7 @@ TEST_CASE("Updating router info in arch", "[NoC Arch Tests]") {
3939

4040
it = test_router_list.find(router_id);
4141

42-
// check first that the router was newly added to the router databse
42+
// check first that the router was newly added to the router database
4343
REQUIRE(it != test_router_list.end());
4444

4545
// no verify the components of the router parameter
@@ -56,7 +56,7 @@ TEST_CASE("Updating router info in arch", "[NoC Arch Tests]") {
5656

5757
it = test_router_list.find(router_id);
5858

59-
// check first that the router was newly added to the router databse
59+
// check first that the router was newly added to the router database
6060
REQUIRE(it != test_router_list.end());
6161

6262
// no verify the components of the router parameter
@@ -75,7 +75,7 @@ TEST_CASE("Updating router info in arch", "[NoC Arch Tests]") {
7575

7676
it = test_router_list.find(router_id);
7777

78-
// check first that the router was newly added to the router databse
78+
// check first that the router was newly added to the router database
7979
REQUIRE(it != test_router_list.end());
8080

8181
// no verify the components of the router parameter
@@ -172,7 +172,7 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
172172
mesh_end_x = 4;
173173
mesh_end_y = 4;
174174

175-
// create the golden golden results
175+
// create the golden results
176176
double golden_results_x[9];
177177
double golden_results_y[9];
178178

vpr/test/test_bfs_routing.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
namespace {
77

8+
constexpr double DUMMY_LATENCY = 1e-9;
9+
constexpr double DUMMY_BANDWIDTH = 1e12;
10+
811
TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") {
912
/*
1013
* Creating a test FPGA device below. The NoC itself will be
@@ -29,7 +32,7 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") {
2932
// add all the routers
3033
for (int i = 0; i < 4; i++) {
3134
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);
3336
}
3437
}
3538

@@ -40,19 +43,19 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") {
4043
for (int j = 0; j < 4; j++) {
4144
// add a link to the left of the router if there exists another router there
4245
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);
4447
}
4548
// add a link to the top of the router if there exists another router there
4649
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);
4851
}
4952
// add a link to the right of the router if there exists another router there
5053
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);
5255
}
5356
// add a link to the bottom of the router if there exists another router there
5457
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);
5659
}
5760
}
5861
}
@@ -97,12 +100,12 @@ TEST_CASE("test_route_flow", "[vpr_noc_bfs_routing]") {
97100
int number_of_links = noc_model.get_noc_links().size();
98101

99102
// 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++);
106109

107110
// now run the routinjg algorithm
108111
// make sure that a legal route was found (no error should be thrown)

0 commit comments

Comments
 (0)