Added BUILD_GUI, BUILD_PYTHON and BUILD_TESTS cmake options,

This commit is contained in:
Miodrag Milanovic 2018-06-23 14:32:18 +02:00
parent b63fdfbeab
commit 82ec1be31f
18 changed files with 315 additions and 199 deletions

View File

@ -1,6 +1,11 @@
# TODO: sensible minimum CMake version # TODO: sensible minimum CMake version
cmake_minimum_required(VERSION 3.3) cmake_minimum_required(VERSION 3.3)
project(nextpnr) project(nextpnr)
option(BUILD_GUI "Build GUI" ON)
option(BUILD_PYTHON "Build Python Integration" ON)
option(BUILD_TESTS "Build GUI" OFF)
# List of families to build # List of families to build
set(FAMILIES dummy ice40) set(FAMILIES dummy ice40)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
@ -9,15 +14,24 @@ set(CMAKE_CXX_FLAGS_RELEASE "-Wall -fPIC -O3 -g")
set(CMAKE_DEFIN) set(CMAKE_DEFIN)
# List of Boost libraries to include # List of Boost libraries to include
set(boost_libs filesystem thread program_options) set(boost_libs filesystem thread program_options)
# TODO: sensible minimum Python version
find_package(PythonInterp 3.5 REQUIRED) if (BUILD_PYTHON)
find_package(PythonLibs 3.5 REQUIRED) # TODO: sensible minimum Python version
find_package(PythonInterp 3.5 REQUIRED)
find_package(PythonLibs 3.5 REQUIRED)
else()
add_definitions("-DNO_PYTHON")
endif()
find_package(Boost REQUIRED COMPONENTS ${boost_libs}) find_package(Boost REQUIRED COMPONENTS ${boost_libs})
# Find the Qt5 libraries if (BUILD_GUI)
find_package(Qt5 COMPONENTS Core Widgets OpenGL REQUIRED) # Find the Qt5 libraries
find_package(OpenGL REQUIRED) find_package(Qt5 COMPONENTS Core Widgets OpenGL REQUIRED)
find_package(OpenGL REQUIRED)
else()
add_definitions("-DNO_GUI")
endif()
# Get the latest abbreviated commit hash of the working branch # Get the latest abbreviated commit hash of the working branch
execute_process( execute_process(
@ -27,27 +41,33 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_STRIP_TRAILING_WHITESPACE
) )
add_subdirectory(3rdparty/googletest/googletest generated/3rdparty/googletest EXCLUDE_FROM_ALL) if (BUILD_TESTS)
enable_testing() add_subdirectory(3rdparty/googletest/googletest generated/3rdparty/googletest EXCLUDE_FROM_ALL)
enable_testing()
endif()
add_subdirectory(3rdparty/QtPropertyBrowser generated/3rdparty/QtPropertyBrowser) if (BUILD_GUI)
add_subdirectory(3rdparty/QtPropertyBrowser generated/3rdparty/QtPropertyBrowser)
endif()
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}") add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
configure_file( configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/common/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/generated/version.h ${CMAKE_CURRENT_SOURCE_DIR}/common/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/generated/version.h
) )
# Find Boost::Python of a suitable version in a cross-platform way if (BUILD_PYTHON)
# Some distributions (Arch) call it libboost_python3, others such as Ubuntu # Find Boost::Python of a suitable version in a cross-platform way
# call it libboost_python35. In the latter case we must consider all minor versions # Some distributions (Arch) call it libboost_python3, others such as Ubuntu
# Original source: https://github.com/BVLC/caffe/blob/master/cmake/Dependencies.cmake#L148 # call it libboost_python35. In the latter case we must consider all minor versions
set(version ${PYTHONLIBS_VERSION_STRING}) # Original source: https://github.com/BVLC/caffe/blob/master/cmake/Dependencies.cmake#L148
set(version ${PYTHONLIBS_VERSION_STRING})
STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version}) STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version})
find_package(Boost COMPONENTS "python-py${boost_py_version}" ${boost_libs}) find_package(Boost COMPONENTS "python-py${boost_py_version}" ${boost_libs})
set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND}) set(Boost_PYTHON_FOUND ${Boost_PYTHON-PY${boost_py_version}_FOUND})
while (NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND) while (NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
STRING(REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version}) STRING(REGEX REPLACE "([0-9.]+).[0-9]+" "\\1" version ${version})
STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version}) STRING(REGEX REPLACE "[^0-9]" "" boost_py_version ${version})
@ -58,26 +78,27 @@ while (NOT "${version}" STREQUAL "" AND NOT Boost_PYTHON_FOUND)
if ("${has_more_version}" STREQUAL "") if ("${has_more_version}" STREQUAL "")
break() break()
endif () endif ()
endwhile () endwhile ()
if (NOT Boost_PYTHON_FOUND) if (NOT Boost_PYTHON_FOUND)
find_package(Boost COMPONENTS python3 ${boost_libs}) find_package(Boost COMPONENTS python3 ${boost_libs})
if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" ) if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" )
set(Boost_PYTHON_FOUND TRUE) set(Boost_PYTHON_FOUND TRUE)
endif () endif ()
endif () endif ()
if (NOT Boost_PYTHON_FOUND) if (NOT Boost_PYTHON_FOUND)
STRING(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" gentoo_version ${PYTHONLIBS_VERSION_STRING}) STRING(REGEX REPLACE "([0-9]+\\.[0-9]+).*" "\\1" gentoo_version ${PYTHONLIBS_VERSION_STRING})
find_package(Boost COMPONENTS python-${gentoo_version} ${boost_libs}) find_package(Boost COMPONENTS python-${gentoo_version} ${boost_libs})
if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" ) if ("${Boost_LIBRARIES}" MATCHES ".*(python|PYTHON).*" )
set(Boost_PYTHON_FOUND TRUE) set(Boost_PYTHON_FOUND TRUE)
endif () endif ()
endif () endif ()
if (NOT Boost_PYTHON_FOUND ) if (NOT Boost_PYTHON_FOUND )
message( FATAL_ERROR "No version of Boost::Python 3.x could be found.") message( FATAL_ERROR "No version of Boost::Python 3.x could be found.")
endif () endif ()
endif()
include_directories(common/ frontend/json ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}) include_directories(common/ frontend/json ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS})
aux_source_directory(common/ COMMON_SRC_FILES) aux_source_directory(common/ COMMON_SRC_FILES)
@ -92,32 +113,57 @@ endif(MINGW)
foreach (family ${FAMILIES}) foreach (family ${FAMILIES})
string(TOUPPER ${family} ufamily) string(TOUPPER ${family} ufamily)
aux_source_directory(${family}/ ${ufamily}_FILES) aux_source_directory(${family}/ ${ufamily}_FILES)
aux_source_directory(tests/${family}/ ${ufamily}_TEST_FILES)
if (BUILD_GUI)
add_subdirectory(gui generated/gui/${family}) add_subdirectory(gui generated/gui/${family})
endif()
# Add the CLI binary target # Add the CLI binary target
add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} ) add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} )
install(TARGETS nextpnr-${family} RUNTIME DESTINATION bin) install(TARGETS nextpnr-${family} RUNTIME DESTINATION bin)
target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE) target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE)
if (BUILD_PYTHON)
# Add the importable Python module target # Add the importable Python module target
PYTHON_ADD_MODULE(nextpnrpy_${family} EXCLUDE_FROM_ALL ${COMMON_FILES} ${${ufamily}_FILES}) PYTHON_ADD_MODULE(nextpnrpy_${family} EXCLUDE_FROM_ALL ${COMMON_FILES} ${${ufamily}_FILES})
# Add any new per-architecture targets here endif()
add_executable(nextpnr-${family}-test EXCLUDE_FROM_ALL ${${ufamily}_TEST_FILES} ${COMMON_FILES} ${${ufamily}_FILES}) # Add any new per-architecture targets here
if (BUILD_TESTS)
aux_source_directory(tests/${family}/ ${ufamily}_TEST_FILES)
add_executable(nextpnr-${family}-test ${${ufamily}_TEST_FILES} ${COMMON_FILES} ${${ufamily}_FILES})
target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main) target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main)
add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test) add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test)
endif()
# Set ${family_targets} to the list of targets being build for this family # Set ${family_targets} to the list of targets being build for this family
set(family_targets nextpnr-${family} nextpnrpy_${family} nextpnr-${family}-test) set(family_targets nextpnr-${family})
if (BUILD_TESTS)
set(family_targets ${family_targets} nextpnr-${family}-test)
endif()
if (BUILD_PYTHON)
set(family_targets ${family_targets} nextpnrpy_${family})
endif()
# Include the family-specific CMakeFile # Include the family-specific CMakeFile
include(${family}/family.cmake) include(${family}/family.cmake)
foreach (target ${family_targets}) foreach (target ${family_targets})
# Include family-specific source files to all family targets and set defines appropriately # Include family-specific source files to all family targets and set defines appropriately
target_include_directories(${target} PRIVATE ${family}/ generated/ gui/${family}/ gui/) target_include_directories(${target} PRIVATE ${family}/ generated/)
target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} QT_NO_KEYWORDS) target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family})
target_link_libraries(${target} LINK_PUBLIC gui_${family} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${GUI_LIBRARY_FILES_${ufamily}}) target_link_libraries(${target} LINK_PUBLIC ${Boost_LIBRARIES})
if (BUILD_PYTHON)
target_link_libraries(${target} LINK_PUBLIC ${PYTHON_LIBRARIES})
endif()
if (BUILD_GUI)
target_include_directories(${target} PRIVATE gui/${family}/ gui/)
target_compile_definitions(${target} PRIVATE QT_NO_KEYWORDS)
target_link_libraries(${target} LINK_PUBLIC gui_${family} ${GUI_LIBRARY_FILES_${ufamily}})
endif()
endforeach (target) endforeach (target)
endforeach (family) endforeach (family)
@ -133,3 +179,7 @@ add_custom_target(
-i -i
${CLANGFORMAT_FILES} ${CLANGFORMAT_FILES}
) )
unset(BUILD_GUI CACHE)
unset(BUILD_PYTHON CACHE)
unset(BUILD_TESTS CACHE)

View File

@ -5,6 +5,7 @@
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
// //
// Blog article: http://mateusz.loskot.net/?p=2819 // Blog article: http://mateusz.loskot.net/?p=2819
#ifndef NO_PYTHON
#include "emb.h" #include "emb.h"
#include <Python.h> #include <Python.h>
@ -136,3 +137,5 @@ void reset_stdout()
void append_inittab() { PyImport_AppendInittab("emb", emb::PyInit_emb); } void append_inittab() { PyImport_AppendInittab("emb", emb::PyInit_emb); }
} // namespace emb } // namespace emb
#endif // NO_PYTHON

View File

@ -1,3 +1,5 @@
#ifndef NO_PYTHON
#include <Python.h> #include <Python.h>
#include <boost/python.hpp> #include <boost/python.hpp>
#include "nextpnr.h" #include "nextpnr.h"
@ -61,3 +63,5 @@ std::string parse_python_exception()
} }
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END
#endif // NO_PYTHON

View File

@ -18,6 +18,8 @@
* *
*/ */
#ifndef NO_PYTHON
#include "pybindings.h" #include "pybindings.h"
#include "emb.h" #include "emb.h"
#include "jsonparse.h" #include "jsonparse.h"
@ -186,3 +188,5 @@ void execute_python_file(const char *python_file)
} }
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END
#endif // NO_PYTHON

View File

@ -19,15 +19,20 @@
#ifdef MAIN_EXECUTABLE #ifdef MAIN_EXECUTABLE
#ifndef NO_GUI
#include <QApplication> #include <QApplication>
#include "application.h"
#include "mainwindow.h"
#endif
#ifndef NO_PYTHON
#include "pybindings.h"
#endif
#include <boost/filesystem/convenience.hpp> #include <boost/filesystem/convenience.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include "application.h"
#include "log.h" #include "log.h"
#include "mainwindow.h"
#include "nextpnr.h" #include "nextpnr.h"
#include "pybindings.h"
#include "version.h" #include "version.h"
#include <iostream>
USING_NEXTPNR_NAMESPACE USING_NEXTPNR_NAMESPACE
@ -44,12 +49,17 @@ int main(int argc, char *argv[])
options.add_options()("help,h", "show help"); options.add_options()("help,h", "show help");
options.add_options()("verbose,v", "verbose output"); options.add_options()("verbose,v", "verbose output");
options.add_options()("force,f", "keep running after errors"); options.add_options()("force,f", "keep running after errors");
#ifndef NO_GUI
options.add_options()("gui", "start gui"); options.add_options()("gui", "start gui");
#endif
po::positional_options_description pos;
#ifndef NO_PYTHON
options.add_options()("run", po::value<std::vector<std::string>>(), options.add_options()("run", po::value<std::vector<std::string>>(),
"python file to execute"); "python file to execute");
options.add_options()("version,V", "show version");
po::positional_options_description pos;
pos.add("run", -1); pos.add("run", -1);
#endif
options.add_options()("version,V", "show version");
po::variables_map vm; po::variables_map vm;
try { try {
@ -85,8 +95,11 @@ int main(int argc, char *argv[])
} }
Context ctx(ArchArgs{}); Context ctx(ArchArgs{});
#ifndef NO_PYTHON
init_python(argv[0]); init_python(argv[0]);
python_export_global("ctx", ctx); python_export_global("ctx", ctx);
#endif
if (vm.count("verbose")) { if (vm.count("verbose")) {
ctx.verbose = true; ctx.verbose = true;
@ -100,13 +113,16 @@ int main(int argc, char *argv[])
ctx.rngseed(vm["seed"].as<int>()); ctx.rngseed(vm["seed"].as<int>());
} }
#ifndef NO_PYTHON
if (vm.count("run")) { if (vm.count("run")) {
std::vector<std::string> files = std::vector<std::string> files =
vm["run"].as<std::vector<std::string>>(); vm["run"].as<std::vector<std::string>>();
for (auto filename : files) for (auto filename : files)
execute_python_file(filename.c_str()); execute_python_file(filename.c_str());
} }
#endif
#ifndef NO_GUI
if (vm.count("gui")) { if (vm.count("gui")) {
Application a(argc, argv); Application a(argc, argv);
MainWindow w(&ctx); MainWindow w(&ctx);
@ -114,7 +130,10 @@ int main(int argc, char *argv[])
rc = a.exec(); rc = a.exec();
} }
#endif
#ifndef NO_PYTHON
deinit_python(); deinit_python();
#endif
return rc; return rc;
} catch (log_execution_error_exception) { } catch (log_execution_error_exception) {
#if defined(_MSC_VER) #if defined(_MSC_VER)

View File

@ -18,6 +18,8 @@
* *
*/ */
#ifndef NO_PYTHON
#include "pybindings.h" #include "pybindings.h"
#include "nextpnr.h" #include "nextpnr.h"
@ -26,3 +28,5 @@ NEXTPNR_NAMESPACE_BEGIN
void arch_wrap_python() { class_<ArchArgs>("ArchArgs"); } void arch_wrap_python() { class_<ArchArgs>("ArchArgs"); }
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END
#endif

View File

@ -27,7 +27,10 @@
#include "jsonparse.h" #include "jsonparse.h"
#include "log.h" #include "log.h"
#include "mainwindow.h" #include "mainwindow.h"
#ifndef NO_PYTHON
#include "pythontab.h" #include "pythontab.h"
#endif
static void initBasenameResource() { Q_INIT_RESOURCE(base); } static void initBasenameResource() { Q_INIT_RESOURCE(base); }
@ -70,7 +73,9 @@ BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent)
SLOT(writeInfo(std::string))); SLOT(writeInfo(std::string)));
tabWidget = new QTabWidget(); tabWidget = new QTabWidget();
#ifndef NO_PYTHON
tabWidget->addTab(new PythonTab(), "Python"); tabWidget->addTab(new PythonTab(), "Python");
#endif
info = new InfoTab(); info = new InfoTab();
tabWidget->addTab(info, "Info"); tabWidget->addTab(info, "Info");

View File

@ -24,7 +24,6 @@
#include <QSplitter> #include <QSplitter>
#include <QTreeWidgetItem> #include <QTreeWidgetItem>
#include "fpgaviewwidget.h" #include "fpgaviewwidget.h"
#include "pybindings.h"
NEXTPNR_NAMESPACE_BEGIN NEXTPNR_NAMESPACE_BEGIN

View File

@ -16,6 +16,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* *
*/ */
#ifndef NO_PYTHON
#include "pythontab.h" #include "pythontab.h"
#include <QGridLayout> #include <QGridLayout>
@ -138,3 +139,5 @@ void PythonTab::showContextMenu(const QPoint &pt)
void PythonTab::clearBuffer() { plainTextEdit->clear(); } void PythonTab::clearBuffer() { plainTextEdit->clear(); }
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END
#endif

View File

@ -20,6 +20,8 @@
#ifndef PYTHONTAB_H #ifndef PYTHONTAB_H
#define PYTHONTAB_H #define PYTHONTAB_H
#ifndef NO_PYTHON
#include <QLineEdit> #include <QLineEdit>
#include <QMenu> #include <QMenu>
#include <QPlainTextEdit> #include <QPlainTextEdit>
@ -52,5 +54,6 @@ class PythonTab : public QWidget
}; };
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END
#endif // NO_PYTHON
#endif // PYTHONTAB_H #endif // PYTHONTAB_H

View File

@ -19,23 +19,27 @@
#ifdef MAIN_EXECUTABLE #ifdef MAIN_EXECUTABLE
#ifndef NO_GUI
#include <QApplication> #include <QApplication>
#include <QSurfaceFormat> #include "application.h"
#include "mainwindow.h"
#endif
#ifndef NO_PYTHON
#include "pybindings.h"
#endif
#include <boost/filesystem/convenience.hpp> #include <boost/filesystem/convenience.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include "application.h"
#include "bitstream.h" #include "bitstream.h"
#include "design_utils.h" #include "design_utils.h"
#include "jsonparse.h" #include "jsonparse.h"
#include "log.h" #include "log.h"
#include "mainwindow.h"
#include "nextpnr.h" #include "nextpnr.h"
#include "pack.h" #include "pack.h"
#include "pcf.h" #include "pcf.h"
#include "place_sa.h" #include "place_sa.h"
#include "pybindings.h"
#include "route.h" #include "route.h"
#include "timing.h" #include "timing.h"
#include "version.h" #include "version.h"
@ -76,13 +80,19 @@ int main(int argc, char *argv[])
options.add_options()("verbose,v", "verbose output"); options.add_options()("verbose,v", "verbose output");
options.add_options()("debug", "debug output"); options.add_options()("debug", "debug output");
options.add_options()("force,f", "keep running after errors"); options.add_options()("force,f", "keep running after errors");
#ifndef NO_GUI
options.add_options()("gui", "start gui"); options.add_options()("gui", "start gui");
#endif
options.add_options()("svg", "dump SVG file"); options.add_options()("svg", "dump SVG file");
options.add_options()("pack-only", options.add_options()("pack-only",
"pack design only without placement or routing"); "pack design only without placement or routing");
po::positional_options_description pos;
#ifndef NO_PYTHON
options.add_options()("run", po::value<std::vector<std::string>>(), options.add_options()("run", po::value<std::vector<std::string>>(),
"python file to execute"); "python file to execute");
pos.add("run", -1);
#endif
options.add_options()("json", po::value<std::string>(), options.add_options()("json", po::value<std::string>(),
"JSON design file to ingest"); "JSON design file to ingest");
options.add_options()("pcf", po::value<std::string>(), options.add_options()("pcf", po::value<std::string>(),
@ -104,8 +114,6 @@ int main(int argc, char *argv[])
options.add_options()("no-tmdriv", "disable timing-driven placement"); options.add_options()("no-tmdriv", "disable timing-driven placement");
options.add_options()("package", po::value<std::string>(), options.add_options()("package", po::value<std::string>(),
"set device package"); "set device package");
po::positional_options_description pos;
pos.add("run", -1);
po::variables_map vm; po::variables_map vm;
try { try {
@ -202,8 +210,11 @@ int main(int argc, char *argv[])
chipArgs.package = vm["package"].as<std::string>(); chipArgs.package = vm["package"].as<std::string>();
Context ctx(chipArgs); Context ctx(chipArgs);
#ifndef NO_PYTHON
init_python(argv[0]); init_python(argv[0]);
python_export_global("ctx", ctx); python_export_global("ctx", ctx);
#endif
if (vm.count("verbose")) { if (vm.count("verbose")) {
ctx.verbose = true; ctx.verbose = true;
@ -326,13 +337,16 @@ int main(int argc, char *argv[])
write_asc(&ctx, f); write_asc(&ctx, f);
} }
#ifndef NO_PYTHON
if (vm.count("run")) { if (vm.count("run")) {
std::vector<std::string> files = std::vector<std::string> files =
vm["run"].as<std::vector<std::string>>(); vm["run"].as<std::vector<std::string>>();
for (auto filename : files) for (auto filename : files)
execute_python_file(filename.c_str()); execute_python_file(filename.c_str());
} }
#endif
#ifndef NO_GUI
if (vm.count("gui")) { if (vm.count("gui")) {
Application a(argc, argv); Application a(argc, argv);
MainWindow w(&ctx); MainWindow w(&ctx);
@ -340,7 +354,11 @@ int main(int argc, char *argv[])
rc = a.exec(); rc = a.exec();
} }
#endif
#ifndef NO_PYTHON
deinit_python(); deinit_python();
#endif
return rc; return rc;
} catch (log_execution_error_exception) { } catch (log_execution_error_exception) {
#if defined(_MSC_VER) #if defined(_MSC_VER)

View File

@ -18,6 +18,8 @@
* *
*/ */
#ifndef NO_PYTHON
#include "pybindings.h" #include "pybindings.h"
#include "nextpnr.h" #include "nextpnr.h"
@ -84,3 +86,5 @@ void arch_wrap_python()
} }
NEXTPNR_NAMESPACE_END NEXTPNR_NAMESPACE_END
#endif // NO_PYTHON

View File

@ -9,23 +9,23 @@ class HX1KTest : public ::testing::Test
protected: protected:
virtual void SetUp() virtual void SetUp()
{ {
chipArgs.type = ChipArgs::HX1K; chipArgs.type = ArchArgs::HX1K;
chipArgs.package = "tq144"; chipArgs.package = "tq144";
design = new Design(chipArgs); ctx = new Context(chipArgs);
} }
virtual void TearDown() { delete design; } virtual void TearDown() { delete ctx; }
ChipArgs chipArgs; ArchArgs chipArgs;
Design *design; Context *ctx;
}; };
TEST_F(HX1KTest, bel_names) TEST_F(HX1KTest, bel_names)
{ {
int bel_count = 0; int bel_count = 0;
for (auto bel : design->chip.getBels()) { for (auto bel : ctx->getBels()) {
auto name = design->chip.getBelName(bel); auto name = ctx->getBelName(bel);
ASSERT_EQ(bel, design->chip.getBelByName(name)); ASSERT_EQ(bel, ctx->getBelByName(name));
bel_count++; bel_count++;
} }
ASSERT_EQ(bel_count, 1416); ASSERT_EQ(bel_count, 1416);
@ -34,9 +34,9 @@ TEST_F(HX1KTest, bel_names)
TEST_F(HX1KTest, wire_names) TEST_F(HX1KTest, wire_names)
{ {
int wire_count = 0; int wire_count = 0;
for (auto wire : design->chip.getWires()) { for (auto wire : ctx->getWires()) {
auto name = design->chip.getWireName(wire); auto name = ctx->getWireName(wire);
assert(wire == design->chip.getWireByName(name)); assert(wire == ctx->getWireByName(name));
wire_count++; wire_count++;
} }
ASSERT_EQ(wire_count, 27682); ASSERT_EQ(wire_count, 27682);
@ -45,9 +45,9 @@ TEST_F(HX1KTest, wire_names)
TEST_F(HX1KTest, pip_names) TEST_F(HX1KTest, pip_names)
{ {
int pip_count = 0; int pip_count = 0;
for (auto pip : design->chip.getPips()) { for (auto pip : ctx->getPips()) {
auto name = design->chip.getPipName(pip); auto name = ctx->getPipName(pip);
assert(pip == design->chip.getPipByName(name)); assert(pip == ctx->getPipByName(name));
pip_count++; pip_count++;
} }
ASSERT_EQ(pip_count, 319904); ASSERT_EQ(pip_count, 319904);
@ -55,11 +55,11 @@ TEST_F(HX1KTest, pip_names)
TEST_F(HX1KTest, uphill_to_downhill) TEST_F(HX1KTest, uphill_to_downhill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto uphill_pip : design->chip.getPipsUphill(dst)) { for (auto uphill_pip : ctx->getPipsUphill(dst)) {
bool found_downhill = false; bool found_downhill = false;
for (auto downhill_pip : design->chip.getPipsDownhill( for (auto downhill_pip : ctx->getPipsDownhill(
design->chip.getPipSrcWire(uphill_pip))) { ctx->getPipSrcWire(uphill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_downhill); ASSERT_FALSE(found_downhill);
found_downhill = true; found_downhill = true;
@ -72,11 +72,11 @@ TEST_F(HX1KTest, uphill_to_downhill)
TEST_F(HX1KTest, downhill_to_uphill) TEST_F(HX1KTest, downhill_to_uphill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) { for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
bool found_uphill = false; bool found_uphill = false;
for (auto uphill_pip : design->chip.getPipsUphill( for (auto uphill_pip : ctx->getPipsUphill(
design->chip.getPipDstWire(downhill_pip))) { ctx->getPipDstWire(downhill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_uphill); ASSERT_FALSE(found_uphill);
found_uphill = true; found_uphill = true;

View File

@ -9,23 +9,23 @@ class HX8KTest : public ::testing::Test
protected: protected:
virtual void SetUp() virtual void SetUp()
{ {
chipArgs.type = ChipArgs::HX8K; chipArgs.type = ArchArgs::HX8K;
chipArgs.package = "ct256"; chipArgs.package = "ct256";
design = new Design(chipArgs); ctx = new Context(chipArgs);
} }
virtual void TearDown() { delete design; } virtual void TearDown() { delete ctx; }
ChipArgs chipArgs; ArchArgs chipArgs;
Design *design; Context *ctx;
}; };
TEST_F(HX8KTest, bel_names) TEST_F(HX8KTest, bel_names)
{ {
int bel_count = 0; int bel_count = 0;
for (auto bel : design->chip.getBels()) { for (auto bel : ctx->getBels()) {
auto name = design->chip.getBelName(bel); auto name = ctx->getBelName(bel);
ASSERT_EQ(bel, design->chip.getBelByName(name)); ASSERT_EQ(bel, ctx->getBelByName(name));
bel_count++; bel_count++;
} }
ASSERT_EQ(bel_count, 7968); ASSERT_EQ(bel_count, 7968);
@ -34,9 +34,9 @@ TEST_F(HX8KTest, bel_names)
TEST_F(HX8KTest, wire_names) TEST_F(HX8KTest, wire_names)
{ {
int wire_count = 0; int wire_count = 0;
for (auto wire : design->chip.getWires()) { for (auto wire : ctx->getWires()) {
auto name = design->chip.getWireName(wire); auto name = ctx->getWireName(wire);
assert(wire == design->chip.getWireByName(name)); assert(wire == ctx->getWireByName(name));
wire_count++; wire_count++;
} }
ASSERT_EQ(wire_count, 135174); ASSERT_EQ(wire_count, 135174);
@ -45,9 +45,9 @@ TEST_F(HX8KTest, wire_names)
TEST_F(HX8KTest, pip_names) TEST_F(HX8KTest, pip_names)
{ {
int pip_count = 0; int pip_count = 0;
for (auto pip : design->chip.getPips()) { for (auto pip : ctx->getPips()) {
auto name = design->chip.getPipName(pip); auto name = ctx->getPipName(pip);
assert(pip == design->chip.getPipByName(name)); assert(pip == ctx->getPipByName(name));
pip_count++; pip_count++;
} }
ASSERT_EQ(pip_count, 1652480); ASSERT_EQ(pip_count, 1652480);
@ -55,11 +55,11 @@ TEST_F(HX8KTest, pip_names)
TEST_F(HX8KTest, uphill_to_downhill) TEST_F(HX8KTest, uphill_to_downhill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto uphill_pip : design->chip.getPipsUphill(dst)) { for (auto uphill_pip : ctx->getPipsUphill(dst)) {
bool found_downhill = false; bool found_downhill = false;
for (auto downhill_pip : design->chip.getPipsDownhill( for (auto downhill_pip : ctx->getPipsDownhill(
design->chip.getPipSrcWire(uphill_pip))) { ctx->getPipSrcWire(uphill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_downhill); ASSERT_FALSE(found_downhill);
found_downhill = true; found_downhill = true;
@ -72,11 +72,11 @@ TEST_F(HX8KTest, uphill_to_downhill)
TEST_F(HX8KTest, downhill_to_uphill) TEST_F(HX8KTest, downhill_to_uphill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) { for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
bool found_uphill = false; bool found_uphill = false;
for (auto uphill_pip : design->chip.getPipsUphill( for (auto uphill_pip : ctx->getPipsUphill(
design->chip.getPipDstWire(downhill_pip))) { ctx->getPipDstWire(downhill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_uphill); ASSERT_FALSE(found_uphill);
found_uphill = true; found_uphill = true;

View File

@ -9,23 +9,23 @@ class LP1KTest : public ::testing::Test
protected: protected:
virtual void SetUp() virtual void SetUp()
{ {
chipArgs.type = ChipArgs::LP1K; chipArgs.type = ArchArgs::LP1K;
chipArgs.package = "tq144"; chipArgs.package = "tq144";
design = new Design(chipArgs); ctx = new Context(chipArgs);
} }
virtual void TearDown() { delete design; } virtual void TearDown() { delete ctx; }
ChipArgs chipArgs; ArchArgs chipArgs;
Design *design; Context *ctx;
}; };
TEST_F(LP1KTest, bel_names) TEST_F(LP1KTest, bel_names)
{ {
int bel_count = 0; int bel_count = 0;
for (auto bel : design->chip.getBels()) { for (auto bel : ctx->getBels()) {
auto name = design->chip.getBelName(bel); auto name = ctx->getBelName(bel);
ASSERT_EQ(bel, design->chip.getBelByName(name)); ASSERT_EQ(bel, ctx->getBelByName(name));
bel_count++; bel_count++;
} }
ASSERT_EQ(bel_count, 1416); ASSERT_EQ(bel_count, 1416);
@ -34,9 +34,9 @@ TEST_F(LP1KTest, bel_names)
TEST_F(LP1KTest, wire_names) TEST_F(LP1KTest, wire_names)
{ {
int wire_count = 0; int wire_count = 0;
for (auto wire : design->chip.getWires()) { for (auto wire : ctx->getWires()) {
auto name = design->chip.getWireName(wire); auto name = ctx->getWireName(wire);
assert(wire == design->chip.getWireByName(name)); assert(wire == ctx->getWireByName(name));
wire_count++; wire_count++;
} }
ASSERT_EQ(wire_count, 27682); ASSERT_EQ(wire_count, 27682);
@ -45,9 +45,9 @@ TEST_F(LP1KTest, wire_names)
TEST_F(LP1KTest, pip_names) TEST_F(LP1KTest, pip_names)
{ {
int pip_count = 0; int pip_count = 0;
for (auto pip : design->chip.getPips()) { for (auto pip : ctx->getPips()) {
auto name = design->chip.getPipName(pip); auto name = ctx->getPipName(pip);
assert(pip == design->chip.getPipByName(name)); assert(pip == ctx->getPipByName(name));
pip_count++; pip_count++;
} }
ASSERT_EQ(pip_count, 319904); ASSERT_EQ(pip_count, 319904);
@ -55,11 +55,11 @@ TEST_F(LP1KTest, pip_names)
TEST_F(LP1KTest, uphill_to_downhill) TEST_F(LP1KTest, uphill_to_downhill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto uphill_pip : design->chip.getPipsUphill(dst)) { for (auto uphill_pip : ctx->getPipsUphill(dst)) {
bool found_downhill = false; bool found_downhill = false;
for (auto downhill_pip : design->chip.getPipsDownhill( for (auto downhill_pip : ctx->getPipsDownhill(
design->chip.getPipSrcWire(uphill_pip))) { ctx->getPipSrcWire(uphill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_downhill); ASSERT_FALSE(found_downhill);
found_downhill = true; found_downhill = true;
@ -72,11 +72,11 @@ TEST_F(LP1KTest, uphill_to_downhill)
TEST_F(LP1KTest, downhill_to_uphill) TEST_F(LP1KTest, downhill_to_uphill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) { for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
bool found_uphill = false; bool found_uphill = false;
for (auto uphill_pip : design->chip.getPipsUphill( for (auto uphill_pip : ctx->getPipsUphill(
design->chip.getPipDstWire(downhill_pip))) { ctx->getPipDstWire(downhill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_uphill); ASSERT_FALSE(found_uphill);
found_uphill = true; found_uphill = true;

View File

@ -9,23 +9,23 @@ class LP384Test : public ::testing::Test
protected: protected:
virtual void SetUp() virtual void SetUp()
{ {
chipArgs.type = ChipArgs::LP384; chipArgs.type = ArchArgs::LP384;
chipArgs.package = "qn32"; chipArgs.package = "qn32";
design = new Design(chipArgs); ctx = new Context(chipArgs);
} }
virtual void TearDown() { delete design; } virtual void TearDown() { delete ctx; }
ChipArgs chipArgs; ArchArgs chipArgs;
Design *design; Context *ctx;
}; };
TEST_F(LP384Test, bel_names) TEST_F(LP384Test, bel_names)
{ {
int bel_count = 0; int bel_count = 0;
for (auto bel : design->chip.getBels()) { for (auto bel : ctx->getBels()) {
auto name = design->chip.getBelName(bel); auto name = ctx->getBelName(bel);
ASSERT_EQ(bel, design->chip.getBelByName(name)); ASSERT_EQ(bel, ctx->getBelByName(name));
bel_count++; bel_count++;
} }
ASSERT_EQ(bel_count, 440); ASSERT_EQ(bel_count, 440);
@ -34,9 +34,9 @@ TEST_F(LP384Test, bel_names)
TEST_F(LP384Test, wire_names) TEST_F(LP384Test, wire_names)
{ {
int wire_count = 0; int wire_count = 0;
for (auto wire : design->chip.getWires()) { for (auto wire : ctx->getWires()) {
auto name = design->chip.getWireName(wire); auto name = ctx->getWireName(wire);
assert(wire == design->chip.getWireByName(name)); assert(wire == ctx->getWireByName(name));
wire_count++; wire_count++;
} }
ASSERT_EQ(wire_count, 8294); ASSERT_EQ(wire_count, 8294);
@ -45,9 +45,9 @@ TEST_F(LP384Test, wire_names)
TEST_F(LP384Test, pip_names) TEST_F(LP384Test, pip_names)
{ {
int pip_count = 0; int pip_count = 0;
for (auto pip : design->chip.getPips()) { for (auto pip : ctx->getPips()) {
auto name = design->chip.getPipName(pip); auto name = ctx->getPipName(pip);
assert(pip == design->chip.getPipByName(name)); assert(pip == ctx->getPipByName(name));
pip_count++; pip_count++;
} }
ASSERT_EQ(pip_count, 86864); ASSERT_EQ(pip_count, 86864);
@ -55,11 +55,11 @@ TEST_F(LP384Test, pip_names)
TEST_F(LP384Test, uphill_to_downhill) TEST_F(LP384Test, uphill_to_downhill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto uphill_pip : design->chip.getPipsUphill(dst)) { for (auto uphill_pip : ctx->getPipsUphill(dst)) {
bool found_downhill = false; bool found_downhill = false;
for (auto downhill_pip : design->chip.getPipsDownhill( for (auto downhill_pip : ctx->getPipsDownhill(
design->chip.getPipSrcWire(uphill_pip))) { ctx->getPipSrcWire(uphill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_downhill); ASSERT_FALSE(found_downhill);
found_downhill = true; found_downhill = true;
@ -72,11 +72,11 @@ TEST_F(LP384Test, uphill_to_downhill)
TEST_F(LP384Test, downhill_to_uphill) TEST_F(LP384Test, downhill_to_uphill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) { for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
bool found_uphill = false; bool found_uphill = false;
for (auto uphill_pip : design->chip.getPipsUphill( for (auto uphill_pip : ctx->getPipsUphill(
design->chip.getPipDstWire(downhill_pip))) { ctx->getPipDstWire(downhill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_uphill); ASSERT_FALSE(found_uphill);
found_uphill = true; found_uphill = true;

View File

@ -9,23 +9,23 @@ class LP8KTest : public ::testing::Test
protected: protected:
virtual void SetUp() virtual void SetUp()
{ {
chipArgs.type = ChipArgs::LP8K; chipArgs.type = ArchArgs::LP8K;
chipArgs.package = "ct256"; chipArgs.package = "ct256";
design = new Design(chipArgs); ctx = new Context(chipArgs);
} }
virtual void TearDown() { delete design; } virtual void TearDown() { delete ctx; }
ChipArgs chipArgs; ArchArgs chipArgs;
Design *design; Context *ctx;
}; };
TEST_F(LP8KTest, bel_names) TEST_F(LP8KTest, bel_names)
{ {
int bel_count = 0; int bel_count = 0;
for (auto bel : design->chip.getBels()) { for (auto bel : ctx->getBels()) {
auto name = design->chip.getBelName(bel); auto name = ctx->getBelName(bel);
ASSERT_EQ(bel, design->chip.getBelByName(name)); ASSERT_EQ(bel, ctx->getBelByName(name));
bel_count++; bel_count++;
} }
ASSERT_EQ(bel_count, 7968); ASSERT_EQ(bel_count, 7968);
@ -34,9 +34,9 @@ TEST_F(LP8KTest, bel_names)
TEST_F(LP8KTest, wire_names) TEST_F(LP8KTest, wire_names)
{ {
int wire_count = 0; int wire_count = 0;
for (auto wire : design->chip.getWires()) { for (auto wire : ctx->getWires()) {
auto name = design->chip.getWireName(wire); auto name = ctx->getWireName(wire);
assert(wire == design->chip.getWireByName(name)); assert(wire == ctx->getWireByName(name));
wire_count++; wire_count++;
} }
ASSERT_EQ(wire_count, 135174); ASSERT_EQ(wire_count, 135174);
@ -45,9 +45,9 @@ TEST_F(LP8KTest, wire_names)
TEST_F(LP8KTest, pip_names) TEST_F(LP8KTest, pip_names)
{ {
int pip_count = 0; int pip_count = 0;
for (auto pip : design->chip.getPips()) { for (auto pip : ctx->getPips()) {
auto name = design->chip.getPipName(pip); auto name = ctx->getPipName(pip);
assert(pip == design->chip.getPipByName(name)); assert(pip == ctx->getPipByName(name));
pip_count++; pip_count++;
} }
ASSERT_EQ(pip_count, 1652480); ASSERT_EQ(pip_count, 1652480);
@ -55,11 +55,11 @@ TEST_F(LP8KTest, pip_names)
TEST_F(LP8KTest, uphill_to_downhill) TEST_F(LP8KTest, uphill_to_downhill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto uphill_pip : design->chip.getPipsUphill(dst)) { for (auto uphill_pip : ctx->getPipsUphill(dst)) {
bool found_downhill = false; bool found_downhill = false;
for (auto downhill_pip : design->chip.getPipsDownhill( for (auto downhill_pip : ctx->getPipsDownhill(
design->chip.getPipSrcWire(uphill_pip))) { ctx->getPipSrcWire(uphill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_downhill); ASSERT_FALSE(found_downhill);
found_downhill = true; found_downhill = true;
@ -72,11 +72,11 @@ TEST_F(LP8KTest, uphill_to_downhill)
TEST_F(LP8KTest, downhill_to_uphill) TEST_F(LP8KTest, downhill_to_uphill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) { for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
bool found_uphill = false; bool found_uphill = false;
for (auto uphill_pip : design->chip.getPipsUphill( for (auto uphill_pip : ctx->getPipsUphill(
design->chip.getPipDstWire(downhill_pip))) { ctx->getPipDstWire(downhill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_uphill); ASSERT_FALSE(found_uphill);
found_uphill = true; found_uphill = true;

View File

@ -9,23 +9,23 @@ class UP5KTest : public ::testing::Test
protected: protected:
virtual void SetUp() virtual void SetUp()
{ {
chipArgs.type = ChipArgs::UP5K; chipArgs.type = ArchArgs::UP5K;
chipArgs.package = "sg48"; chipArgs.package = "sg48";
design = new Design(chipArgs); ctx = new Context(chipArgs);
} }
virtual void TearDown() { delete design; } virtual void TearDown() { delete ctx; }
ChipArgs chipArgs; ArchArgs chipArgs;
Design *design; Context *ctx;
}; };
TEST_F(UP5KTest, bel_names) TEST_F(UP5KTest, bel_names)
{ {
int bel_count = 0; int bel_count = 0;
for (auto bel : design->chip.getBels()) { for (auto bel : ctx->getBels()) {
auto name = design->chip.getBelName(bel); auto name = ctx->getBelName(bel);
ASSERT_EQ(bel, design->chip.getBelByName(name)); ASSERT_EQ(bel, ctx->getBelByName(name));
bel_count++; bel_count++;
} }
ASSERT_EQ(bel_count, 5414); ASSERT_EQ(bel_count, 5414);
@ -34,9 +34,9 @@ TEST_F(UP5KTest, bel_names)
TEST_F(UP5KTest, wire_names) TEST_F(UP5KTest, wire_names)
{ {
int wire_count = 0; int wire_count = 0;
for (auto wire : design->chip.getWires()) { for (auto wire : ctx->getWires()) {
auto name = design->chip.getWireName(wire); auto name = ctx->getWireName(wire);
assert(wire == design->chip.getWireByName(name)); assert(wire == ctx->getWireByName(name));
wire_count++; wire_count++;
} }
ASSERT_EQ(wire_count, 103383); ASSERT_EQ(wire_count, 103383);
@ -45,9 +45,9 @@ TEST_F(UP5KTest, wire_names)
TEST_F(UP5KTest, pip_names) TEST_F(UP5KTest, pip_names)
{ {
int pip_count = 0; int pip_count = 0;
for (auto pip : design->chip.getPips()) { for (auto pip : ctx->getPips()) {
auto name = design->chip.getPipName(pip); auto name = ctx->getPipName(pip);
assert(pip == design->chip.getPipByName(name)); assert(pip == ctx->getPipByName(name));
pip_count++; pip_count++;
} }
ASSERT_EQ(pip_count, 1219104); ASSERT_EQ(pip_count, 1219104);
@ -55,11 +55,11 @@ TEST_F(UP5KTest, pip_names)
TEST_F(UP5KTest, uphill_to_downhill) TEST_F(UP5KTest, uphill_to_downhill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto uphill_pip : design->chip.getPipsUphill(dst)) { for (auto uphill_pip : ctx->getPipsUphill(dst)) {
bool found_downhill = false; bool found_downhill = false;
for (auto downhill_pip : design->chip.getPipsDownhill( for (auto downhill_pip : ctx->getPipsDownhill(
design->chip.getPipSrcWire(uphill_pip))) { ctx->getPipSrcWire(uphill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_downhill); ASSERT_FALSE(found_downhill);
found_downhill = true; found_downhill = true;
@ -72,11 +72,11 @@ TEST_F(UP5KTest, uphill_to_downhill)
TEST_F(UP5KTest, downhill_to_uphill) TEST_F(UP5KTest, downhill_to_uphill)
{ {
for (auto dst : design->chip.getWires()) { for (auto dst : ctx->getWires()) {
for (auto downhill_pip : design->chip.getPipsDownhill(dst)) { for (auto downhill_pip : ctx->getPipsDownhill(dst)) {
bool found_uphill = false; bool found_uphill = false;
for (auto uphill_pip : design->chip.getPipsUphill( for (auto uphill_pip : ctx->getPipsUphill(
design->chip.getPipDstWire(downhill_pip))) { ctx->getPipDstWire(downhill_pip))) {
if (uphill_pip == downhill_pip) { if (uphill_pip == downhill_pip) {
ASSERT_FALSE(found_uphill); ASSERT_FALSE(found_uphill);
found_uphill = true; found_uphill = true;