Skip to content

Commit 3c31e04

Browse files
committed
added directives to the draw noc related code so that there is no build failure when graphics isn't enabled
1 parent a142d1b commit 3c31e04

File tree

5 files changed

+18
-12
lines changed

5 files changed

+18
-12
lines changed

vpr/src/base/noc_data_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "vtr_strong_id.h"
55

6-
// definitins data types used to index the routers and links within the noc
6+
// data types used to index the routers and links within the noc
77

88
struct noc_router_id_tag;
99
struct noc_link_id_tag;

vpr/src/base/vpr_api.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,17 +503,18 @@ void vpr_setup_clock_networks(t_vpr_setup& vpr_setup, const t_arch& Arch) {
503503
* description file.
504504
*/
505505
void vpr_setup_noc(const t_vpr_setup& vpr_setup, const t_arch& arch) {
506-
t_draw_state* draw_state = get_draw_state_vars();
507-
508506
// check if the user provided the option to model the noc
509507
if (vpr_setup.NocOpts.noc == true) {
510508
// create the NoC model based on the user description from the arch file
511509
setup_noc(arch);
512510

511+
#ifndef NO_GRAPHICS
513512
// setup the graphics
514513
// if the user turned on "noc" in the command line, then we also want them to have the option to display the noc, so set that option here to be able to display it.
515514
// if the "noc" was not turned on, then we don't need to provide the user with the option to display it
515+
t_draw_state* draw_state = get_draw_state_vars();
516516
draw_state->show_noc_button = true;
517+
#endif
517518
}
518519
}
519520

vpr/src/draw/draw_noc.cpp

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

2-
#include "draw_noc.h"
3-
#include "globals.h"
4-
#include "noc_storage.h"
5-
#include "vpr_error.h"
6-
#include "vtr_math.h"
2+
#ifndef NO_GRAPHICS
3+
4+
# include "draw_noc.h"
5+
# include "globals.h"
6+
# include "noc_storage.h"
7+
# include "vpr_error.h"
8+
# include "vtr_math.h"
79

810
/**
911
* @brief For a NoC that is undirected, each connection between routers has two
@@ -226,3 +228,5 @@ void shift_noc_link(noc_link_draw_coords& link_coords, NocLinkShift link_shift_d
226228

227229
return;
228230
}
231+
232+
#endif

vpr/src/draw/draw_noc.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
#include <iostream>
1010
#include <vector>
1111

12-
#include "draw.h"
12+
#ifndef NO_GRAPHICS
13+
14+
# include "draw.h"
1315

1416
// defines the length of a reference horizontal line that is used in a cross product to calculate the angle between this line and a noc link to be drawn
1517
const double HORIZONTAL_LINE_LENGTH(5.0);
@@ -51,4 +53,6 @@ NocLinkType determine_noc_link_type(ezgl::point2d link_start_point, ezgl::point2
5153

5254
void shift_noc_link(noc_link_draw_coords& link_coords, NocLinkShift link_shift_direction, NocLinkType link_type, double noc_connection_marker_quarter_width, double noc_connection_marker_quarter_height);
5355

56+
#endif
57+
5458
#endif

vpr/test/test_setup_noc.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
/*Re-defining static functions in setup_noc.cpp that are tested here*/
1212

13-
1413
static void identify_and_store_noc_router_tile_positions(const DeviceGrid& device_grid, std::vector<t_noc_router_tile_position>& list_of_noc_router_tiles, std::string noc_router_tile_name) {
1514
int grid_width = device_grid.width();
1615
int grid_height = device_grid.height();
@@ -52,8 +51,6 @@ static void identify_and_store_noc_router_tile_positions(const DeviceGrid& devic
5251
return;
5352
}
5453

55-
56-
5754
static void create_noc_routers(const t_noc_inf& noc_info, NocStorage* noc_model, std::vector<t_noc_router_tile_position>& list_of_noc_router_tiles) {
5855
// keep track of the shortest distance between a logical router and the curren physical router tile
5956
// also keep track of the corresponding physical router tile index (within the list)

0 commit comments

Comments
 (0)