Skip to content

Commit 53a5877

Browse files
fix compilation errors in test_read_xml_arch_file.cpp
1 parent 499899d commit 53a5877

File tree

3 files changed

+47
-46
lines changed

3 files changed

+47
-46
lines changed

libs/libarchfpga/src/read_xml_arch_file_noc_tag.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,6 @@
77
#include "vtr_log.h"
88
#include "arch_error.h"
99

10-
/**
11-
* @brief Describes a mesh topology as specified in the architecture file.
12-
* It is assumed that NoC routers are equally distanced in each axis.
13-
*/
14-
struct t_mesh_region {
15-
/// The location the bottom left NoC router on the X-axis.
16-
float start_x;
17-
/// The location the top right NoC router on the X-axis.
18-
float end_x;
19-
/// The location the bottom left NoC router on the Y-axis.
20-
float start_y;
21-
/// The location the top right NoC router on the Y-axis.
22-
float end_y;
23-
/// The layer from which the mesh start.
24-
int start_layer;
25-
/// The layer at which the mesh ends.
26-
int end_layer;
27-
/// The number of NoC routers in each row or column.
28-
int mesh_size;
29-
};
30-
31-
3210
/**
3311
* @brief Process the <topology> tag under <noc> tag.
3412
*

libs/libarchfpga/src/read_xml_arch_file_noc_tag.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,25 @@ void process_noc_tag(pugi::xml_node noc_tag,
1717
t_arch* arch,
1818
const pugiutil::loc_data& loc_data);
1919

20+
/**
21+
* @brief Describes a mesh topology as specified in the architecture file.
22+
* It is assumed that NoC routers are equally distanced in each axis.
23+
*/
24+
struct t_mesh_region {
25+
/// The location the bottom left NoC router on the X-axis.
26+
float start_x;
27+
/// The location the top right NoC router on the X-axis.
28+
float end_x;
29+
/// The location the bottom left NoC router on the Y-axis.
30+
float start_y;
31+
/// The location the top right NoC router on the Y-axis.
32+
float end_y;
33+
/// The layer from which the mesh start.
34+
int start_layer;
35+
/// The layer at which the mesh ends.
36+
int end_layer;
37+
/// The number of NoC routers in each row or column.
38+
int mesh_size;
39+
};
40+
2041
#endif //VTR_READ_XML_ARCH_FILE_NOC_TAG_H

libs/libarchfpga/test/test_read_xml_arch_file.cpp

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -148,31 +148,33 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
148148
t_noc_inf test_noc;
149149

150150
// mesh parameters
151-
float mesh_start_x = 10;
152-
float mesh_start_y = 10;
153-
float mesh_end_x = 5;
154-
float mesh_end_y = 56;
155-
float mesh_size = 0;
156-
int mesh_start_layer = 0;
157-
int mesh_end_layer = 0;
151+
t_mesh_region mesh_region{
152+
.start_x = 10.0f,
153+
.end_x = 5.0f,
154+
.start_y = 10.0f,
155+
.end_y = 56.0f,
156+
.start_layer = 0,
157+
.end_layer = 0,
158+
.mesh_size = 0
159+
};
158160

159161
SECTION("Check the error where a mesh size was illegal.") {
160-
REQUIRE_THROWS_WITH(generate_noc_mesh(test, test_location, &test_noc, mesh_start_x, mesh_end_x, mesh_start_y, mesh_end_y, mesh_start_layer, mesh_end_layer, mesh_size), "The NoC mesh size cannot be 0.");
162+
REQUIRE_THROWS_WITH(generate_noc_mesh(test, test_location, &test_noc, mesh_region), "The NoC mesh size cannot be 0.");
161163
}
162164
SECTION("Check the error where a mesh region size was invalid.") {
163-
mesh_size = 3;
165+
mesh_region.mesh_size = 3;
164166

165-
REQUIRE_THROWS_WITH(generate_noc_mesh(test, test_location, &test_noc, mesh_start_x, mesh_end_x, mesh_start_y, mesh_end_y, mesh_start_layer, mesh_end_layer, mesh_size), "The NoC region is invalid.");
167+
REQUIRE_THROWS_WITH(generate_noc_mesh(test, test_location, &test_noc, mesh_region), "The NoC region is invalid.");
166168
}
167169
SECTION("Check the mesh creation for integer precision coordinates.") {
168170
// define test parameters
169-
mesh_size = 3;
171+
mesh_region.mesh_size = 3;
170172

171-
mesh_start_x = 0;
172-
mesh_start_y = 0;
173+
mesh_region.start_x = 0;
174+
mesh_region.start_y = 0;
173175

174-
mesh_end_x = 4;
175-
mesh_end_y = 4;
176+
mesh_region.end_x = 4;
177+
mesh_region.end_y = 4;
176178

177179
// create the golden results
178180
float golden_results_x[9];
@@ -202,10 +204,10 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
202204
golden_results_x[8] = 4;
203205
golden_results_y[8] = 4;
204206

205-
generate_noc_mesh(test, test_location, &test_noc, mesh_start_x, mesh_end_x, mesh_start_y, mesh_end_y, mesh_start_layer, mesh_end_layer, mesh_size);
207+
generate_noc_mesh(test, test_location, &test_noc, mesh_region);
206208

207209
// go through all the expected routers
208-
for (int expected_router_id = 0; expected_router_id < (mesh_size * mesh_size); expected_router_id++) {
210+
for (int expected_router_id = 0; expected_router_id < (mesh_region.mesh_size * mesh_region.mesh_size); expected_router_id++) {
209211
// make sure the router ids match
210212
REQUIRE(test_noc.router_list[expected_router_id].id == expected_router_id);
211213

@@ -218,13 +220,13 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
218220
}
219221
SECTION("Check the mesh creation for double precision coordinates.") {
220222
// define test parameters
221-
mesh_size = 3;
223+
mesh_region.mesh_size = 3;
222224

223-
mesh_start_x = 3.5;
224-
mesh_start_y = 5.7;
225+
mesh_region.start_x = 3.5;
226+
mesh_region.start_y = 5.7;
225227

226-
mesh_end_x = 10.8;
227-
mesh_end_y = 6.4;
228+
mesh_region.end_x = 10.8;
229+
mesh_region.end_y = 6.4;
228230

229231
// create the golden results
230232
float golden_results_x[9];
@@ -254,10 +256,10 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
254256
golden_results_x[8] = 10.8;
255257
golden_results_y[8] = 6.4;
256258

257-
generate_noc_mesh(test, test_location, &test_noc, mesh_start_x, mesh_end_x, mesh_start_y, mesh_end_y, mesh_start_layer, mesh_end_layer, mesh_size);
259+
generate_noc_mesh(test, test_location, &test_noc, mesh_region);
258260

259261
// go through all the expected routers
260-
for (int expected_router_id = 0; expected_router_id < (mesh_size * mesh_size); expected_router_id++) {
262+
for (int expected_router_id = 0; expected_router_id < (mesh_region.mesh_size * mesh_region.mesh_size); expected_router_id++) {
261263
// make sure the router ids match
262264
REQUIRE(test_noc.router_list[expected_router_id].id == expected_router_id);
263265

0 commit comments

Comments
 (0)