Skip to content

Commit d76d7b5

Browse files
check or-tools dependency in CMakeLists.txt
1 parent e697f64 commit d76d7b5

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ option(VTR_ENABLE_CAPNPROTO "Enable capnproto binary serialization support in VP
4343
#VPR option --enable_analytic_placer is also required for Analytic Placement
4444
option(VPR_ANALYTIC_PLACE "Enable analytic placement in VPR." ON)
4545
option(VPR_ENABLE_INTERCHANGE "Enable FPGA interchange." ON)
46+
option(VPR_ENABLE_NOC_SAT_ROUTING "Enable NoC SAT routing." OFF)
4647

4748
option(WITH_BLIFEXPLORER "Enable build with blifexplorer" OFF)
4849

@@ -217,12 +218,12 @@ endforeach()
217218
set(FLEX_BISON_WARN_SUPPRESS_FLAGS "")
218219
set(FLEX_BISON_WARN_SUPPRESS_FLAGS_TO_CHECK
219220
"-Wno-redundant-decls" #Flex/bison generate code with redundant declarations
220-
"-Wno-switch-default" #Flex/bison generate switch statments w/o default cases
221+
"-Wno-switch-default" #Flex/bison generate switch statements w/o default cases
221222
"-Wno-unused-parameter" #Flex produces functions with unused params in re-entrant mode
222223
"-Wno-missing-declarations" #Flex misses some declarations in re-entrant mode
223224
"-Wimplicit-fallthrough=0" #Bison produces some cases with explicit
224225
"-Wno-sign-compare" #Flex generates code which performs some signed/unsigned comparison
225-
"-Wno-null-dereference" #Bison produces some cases with potenetial null derefs
226+
"-Wno-null-dereference" #Bison produces some cases with potential null derefs
226227
)
227228
foreach(flag ${FLEX_BISON_WARN_SUPPRESS_FLAGS_TO_CHECK})
228229
CHECK_CXX_COMPILER_FLAG(${flag} CXX_COMPILER_SUPPORTS_${flag})

vpr/CMakeLists.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ if(${VPR_ANALYTIC_PLACE})
7373
endif(TARGET Eigen3::Eigen)
7474
endif()
7575

76+
if (${VPR_ENABLE_NOC_SAT_ROUTING})
77+
message(STATUS "VPR NoC SAT Routing: Requested")
78+
find_package(ortools CONFIG REQUIRED)
79+
if (TARGET ortools::ortools)
80+
message(STATUS "VPR NoC SAT Routing dependency (or-tools): Found")
81+
message(STATUS "VPR NoC SAT Routing: Enabled")
82+
target_link_libraries(libvpr ortools::ortools)
83+
target_compile_definitions(libvpr PUBLIC -DENABLE_NOC_SAT_ROUTING)
84+
else ()
85+
message(STATUS "VPR NoC SAT Routing dependency (or-tools): Not Found (You may need to set CMAKE_PREFIX_PATH in order for CMake to find your OR-Tools installation)")
86+
message(STATUS "VPR NoC SAT Routing: Disabled")
87+
endif (TARGET ortools::ortools)
88+
endif ()
89+
7690
set_target_properties(libvpr PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
7791

7892
#Specify link-time dependencies
@@ -87,9 +101,6 @@ target_link_libraries(libvpr
87101
librrgraph
88102
)
89103

90-
find_package(ortools CONFIG REQUIRED)
91-
target_link_libraries(libvpr ortools::ortools)
92-
93104
#link graphics library only when graphics set to on
94105
if (VPR_USE_EZGL STREQUAL "on")
95106
target_link_libraries(libvpr

vpr/src/noc/sat_routing.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#ifdef ENABLE_NOC_SAT_ROUTING
2+
13

24
#include "sat_routing.h"
35
#include "turn_model_routing.h"
@@ -940,4 +942,6 @@ vtr::vector<NocTrafficFlowId, std::vector<NocLinkId>> noc_sat_route(bool minimiz
940942

941943
// when no feasible solution was found, return an empty vector
942944
return {};
943-
}
945+
}
946+
947+
#endif //ENABLE_NOC_SAT_ROUTING

vpr/src/noc/sat_routing.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef VTR_SATROUTING_H
22
#define VTR_SATROUTING_H
33

4+
#ifdef ENABLE_NOC_SAT_ROUTING
5+
46
#include <utility>
57
#include <map>
68

@@ -54,4 +56,5 @@ struct hash<std::pair<ClusterBlockId, NocRouterId>> {
5456
} // namespace std
5557

5658

59+
#endif
5760
#endif

vpr/src/place/place.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,7 @@ void try_place(const Netlist<>& net_list,
12011201
get_total_congestion_bandwidth_ratio(),
12021202
get_number_of_congested_noc_links());
12031203

1204+
#ifdef ENABLE_NOC_SAT_ROUTING
12041205
if (costs.noc_cost_terms.congestion > 0.0) {
12051206
VTR_LOG("NoC routing configuration is congested. Invoking the SAT NoC router.\n");
12061207
auto traffic_flow_routes = noc_sat_route(true,
@@ -1236,7 +1237,9 @@ void try_place(const Netlist<>& net_list,
12361237
VTR_LOG("SAT routing failed.\n");
12371238
}
12381239
}
1240+
#endif //ENABLE_NOC_SAT_ROUTING
12391241
}
1242+
12401243
update_screen(ScreenUpdatePriority::MAJOR, msg, PLACEMENT, timing_info);
12411244
// Print out swap statistics
12421245
print_resources_utilization();

0 commit comments

Comments
 (0)