From 57f8c216b595872e7df749c4715205e8684130c4 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sat, 29 Dec 2018 00:21:18 -0800 Subject: [PATCH 01/17] Fix compiler warning --- xc7/arch.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xc7/arch.cc b/xc7/arch.cc index 90f8d821..bd0dd5d2 100644 --- a/xc7/arch.cc +++ b/xc7/arch.cc @@ -442,6 +442,8 @@ BelId Arch::getBelByLocation(Loc loc) const BelRange Arch::getBelsByTile(int x, int y) const { BelRange br; + br.b.cursor = 0; + br.e.cursor = 0; NPNR_ASSERT("TODO"); return br; } From c28b1ee6bd9eaef28848f7e17a12b01c12d52bf3 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sat, 29 Dec 2018 00:21:32 -0800 Subject: [PATCH 02/17] cmake to do a git submodule update --- xc7/family.cmake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/xc7/family.cmake b/xc7/family.cmake index 9de869ee..6d24b405 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -1,3 +1,19 @@ +# Adapted https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html +find_package(Git QUIET) +if(GIT_FOUND AND EXISTS ".gitmodules") +# Update submodules as needed + option(GIT_SUBMODULE "Check submodules during build" ON) + if(GIT_SUBMODULE) + message(STATUS "Submodule update") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() + endif() +endif() + add_dependencies(nextpnr-${family} torc) add_custom_target(torc ALL COMMAND $(MAKE) > /dev/null 2> /dev/null From af0bc8ab4cd1370c15a2ab2de6704e389874cc96 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sat, 29 Dec 2018 12:10:04 -0800 Subject: [PATCH 03/17] Fix submodule path --- xc7/family.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xc7/family.cmake b/xc7/family.cmake index 6d24b405..ade5dd73 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -1,6 +1,6 @@ # Adapted https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html find_package(Git QUIET) -if(GIT_FOUND AND EXISTS ".gitmodules") +if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules") # Update submodules as needed option(GIT_SUBMODULE "Check submodules during build" ON) if(GIT_SUBMODULE) From 0bc158740746354280eda79fd52b26ec540e65e1 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sat, 29 Dec 2018 12:28:26 -0800 Subject: [PATCH 04/17] [xc7] Fix test deps --- xc7/family.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xc7/family.cmake b/xc7/family.cmake index ade5dd73..c1199fd0 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -15,6 +15,7 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules") endif() add_dependencies(nextpnr-${family} torc) +add_dependencies(nextpnr-${family}-test torc) add_custom_target(torc ALL COMMAND $(MAKE) > /dev/null 2> /dev/null COMMENT "Building torc (may take some time...)" @@ -22,9 +23,8 @@ add_custom_target(torc ALL find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs} ${boost_python_lib}) include_directories(torc/src) -target_link_libraries( - nextpnr-${family} PRIVATE +set(TORC_OBJS ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Arc.o ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/ArcUsage.o ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Array.o @@ -87,3 +87,6 @@ target_link_libraries( ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/TilewirePlaceholder.o ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/XdlExporter.o ) + +target_link_libraries(nextpnr-${family} PRIVATE ${TORC_OBJS}) +target_link_libraries(nextpnr-${family}-test PRIVATE ${TORC_OBJS}) From 55ac41046db21e5e69a0d5d10306319549cd552f Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 30 Dec 2018 13:05:29 -0800 Subject: [PATCH 05/17] [xc7] Update torc submodule --- torc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torc b/torc index a5a4ec05..dac95f15 160000 --- a/torc +++ b/torc @@ -1 +1 @@ -Subproject commit a5a4ec057eae3ed07ed2acb9da13404808e37211 +Subproject commit dac95f156907413426da0f996049319a7bbe475e From 078285fe7f6338fcd8c25f579f4ef2c421281fa4 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 30 Dec 2018 13:16:10 -0800 Subject: [PATCH 06/17] [xc7] Fix include_directories path --- xc7/family.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xc7/family.cmake b/xc7/family.cmake index c1199fd0..0e8105f4 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -22,7 +22,7 @@ add_custom_target(torc ALL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs} ${boost_python_lib}) -include_directories(torc/src) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/torc/src) set(TORC_OBJS ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Arc.o From 36edbdcbbd2c53366e0869629060784e936c383c Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 30 Dec 2018 13:47:16 -0800 Subject: [PATCH 07/17] [xc7] Update torc submodule --- torc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torc b/torc index dac95f15..90874d12 160000 --- a/torc +++ b/torc @@ -1 +1 @@ -Subproject commit dac95f156907413426da0f996049319a7bbe475e +Subproject commit 90874d1293fbeba77bae41b5c38168cd91e1bf00 From ae1bbbdbddf47509bd8f0cd53133a35b64c656b8 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 30 Dec 2018 14:02:19 -0800 Subject: [PATCH 08/17] [xc7] Cope with BUILD_TESTS=off --- xc7/family.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xc7/family.cmake b/xc7/family.cmake index 0e8105f4..716430ee 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -15,7 +15,9 @@ if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules") endif() add_dependencies(nextpnr-${family} torc) -add_dependencies(nextpnr-${family}-test torc) +if (BUILD_TESTS) + add_dependencies(nextpnr-${family}-test torc) +endif() add_custom_target(torc ALL COMMAND $(MAKE) > /dev/null 2> /dev/null COMMENT "Building torc (may take some time...)" @@ -89,4 +91,6 @@ set(TORC_OBJS ) target_link_libraries(nextpnr-${family} PRIVATE ${TORC_OBJS}) -target_link_libraries(nextpnr-${family}-test PRIVATE ${TORC_OBJS}) +if (BUILD_TESTS) + target_link_libraries(nextpnr-${family}-test PRIVATE ${TORC_OBJS}) +endif() From 3d79eee05aa11928409cbd813691b47679537581 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 30 Dec 2018 14:04:35 -0800 Subject: [PATCH 09/17] [xc7] Use target_include_directories not include_directories --- xc7/family.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xc7/family.cmake b/xc7/family.cmake index 716430ee..673a3f0a 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -24,7 +24,10 @@ add_custom_target(torc ALL WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs} ${boost_python_lib}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/torc/src) +target_include_directories(nextpnr-${family} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) +if (BUILD_TESTS) + target_include_directories(nextpnr-${family}-test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) +endif() set(TORC_OBJS ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Arc.o From 1e2a7c9fca514ac109241f828cf492cb39d0e88b Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Tue, 1 Jan 2019 12:07:07 -0800 Subject: [PATCH 10/17] [xc7] target_include_directories for gui_xc7 target too --- xc7/family.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xc7/family.cmake b/xc7/family.cmake index 673a3f0a..12bb3cfb 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -28,6 +28,9 @@ target_include_directories(nextpnr-${family} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ if (BUILD_TESTS) target_include_directories(nextpnr-${family}-test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) endif() +if (BUILD_GUI) + target_include_directories(gui_${family} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) +endif() set(TORC_OBJS ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Arc.o From e393187d6818b99a8df2d433c900a750e8e4e850 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Tue, 1 Jan 2019 12:16:36 -0800 Subject: [PATCH 11/17] [xc7] Remove superseded include_directories() --- gui/xc7/family.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/gui/xc7/family.cmake b/gui/xc7/family.cmake index 3b010c7b..e69de29b 100644 --- a/gui/xc7/family.cmake +++ b/gui/xc7/family.cmake @@ -1 +0,0 @@ -include_directories(/opt/torc/src) \ No newline at end of file From efd35a2dd881c13680367c2d28500342ffa499ba Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Tue, 1 Jan 2019 12:38:17 -0800 Subject: [PATCH 12/17] [xc7] Install torc in Docker image --- .cirrus.yml | 5 +- .cirrus/Dockerfile.ubuntu16.04 | 9 +- xc7/family.cmake | 168 +++++++++++++++++---------------- 3 files changed, 97 insertions(+), 85 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 38e14513..40b335df 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,8 +5,9 @@ task: memory: 16 dockerfile: .cirrus/Dockerfile.ubuntu16.04 - build_script: mkdir build && cd build && cmake .. -DARCH=all -DTRELLIS_ROOT=/usr/local/src/prjtrellis -DBUILD_TESTS=on && make -j $(nproc) + build_script: mkdir build && cd build && cmake .. -DARCH=all -DTRELLIS_ROOT=/usr/local/src/prjtrellis -DTORC_ROOT=/usr/local/src/torc -DBUILD_TESTS=on && make -j $(nproc) test_generic_script: cd build && ./nextpnr-generic-test test_ice40_script: cd build && ./nextpnr-ice40-test smoketest_ice40_script: export NEXTPNR=$(pwd)/build/nextpnr-ice40 && cd ice40/smoketest/attosoc && ./smoketest.sh - test_ecp5_script: cd build && ./nextpnr-ecp5-test \ No newline at end of file + test_ecp5_script: cd build && ./nextpnr-ecp5-test + test_xc7_script: cd build && ./nextpnr-xc7-test diff --git a/.cirrus/Dockerfile.ubuntu16.04 b/.cirrus/Dockerfile.ubuntu16.04 index 71a634bb..673fb54f 100644 --- a/.cirrus/Dockerfile.ubuntu16.04 +++ b/.cirrus/Dockerfile.ubuntu16.04 @@ -52,4 +52,11 @@ RUN set -e -x ;\ make -j $(nproc) ;\ make install - +RUN set -e -x ;\ + mkdir -p /usr/local/src ;\ + cd /usr/local/src ;\ + git clone --recursive https://github.com/eddiehung/torc.git ;\ + cd torc ;\ + git reset --hard 90874d1293fbeba77bae41b5c38168cd91e1bf00 ;\ + make -j $(nproc) -C src/torc ;\ + make install diff --git a/xc7/family.cmake b/xc7/family.cmake index 12bb3cfb..c1c7dcb8 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -1,99 +1,103 @@ -# Adapted https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html -find_package(Git QUIET) -if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules") -# Update submodules as needed - option(GIT_SUBMODULE "Check submodules during build" ON) - if(GIT_SUBMODULE) - message(STATUS "Submodule update") - execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - RESULT_VARIABLE GIT_SUBMOD_RESULT) - if(NOT GIT_SUBMOD_RESULT EQUAL "0") - message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") +if (NOT DEFINED TORC_ROOT) + # Adapted from https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html + find_package(Git QUIET) + if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.gitmodules") + # Update submodules as needed + option(GIT_SUBMODULE "Check submodules during build" ON) + if(GIT_SUBMODULE) + message(STATUS "Submodule update") + execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + RESULT_VARIABLE GIT_SUBMOD_RESULT) + if(NOT GIT_SUBMOD_RESULT EQUAL "0") + message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") + endif() endif() endif() + + add_dependencies(nextpnr-${family} torc) + if (BUILD_TESTS) + add_dependencies(nextpnr-${family}-test torc) + endif() + add_custom_target(torc ALL + COMMAND $(MAKE) > /dev/null 2> /dev/null + COMMENT "Building torc (may take some time...)" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) + find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs} ${boost_python_lib}) + + set(TORC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) endif() -add_dependencies(nextpnr-${family} torc) +target_include_directories(nextpnr-${family} PUBLIC ${TORC_ROOT}/torc/src) if (BUILD_TESTS) - add_dependencies(nextpnr-${family}-test torc) -endif() -add_custom_target(torc ALL - COMMAND $(MAKE) > /dev/null 2> /dev/null - COMMENT "Building torc (may take some time...)" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) -find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs} ${boost_python_lib}) - -target_include_directories(nextpnr-${family} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) -if (BUILD_TESTS) - target_include_directories(nextpnr-${family}-test PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) + target_include_directories(nextpnr-${family}-test PUBLIC ${TORC_ROOT}/torc/src) endif() if (BUILD_GUI) - target_include_directories(gui_${family} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) + target_include_directories(gui_${family} PUBLIC ${TORC_ROOT}/torc/src) endif() set(TORC_OBJS - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Arc.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/ArcUsage.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Array.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/DDB.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/DDBConsoleStreams.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/DDBStreamHelper.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/DigestStream.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/ExtendedWireInfo.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/InstancePin.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/OutputStreamHelpers.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Package.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Pad.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/PrimitiveConn.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/PrimitiveDef.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/PrimitiveElement.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/PrimitiveElementPin.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/PrimitivePin.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Segments.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Site.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Sites.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Tiles.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/TileInfo.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Tilewire.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/Versions.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/VprExporter.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/WireInfo.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/WireUsage.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/XdlImporter.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/architecture/XilinxDatabaseTypes.o + ${TORC_ROOT}/torc/src/torc/architecture/Arc.o + ${TORC_ROOT}/torc/src/torc/architecture/ArcUsage.o + ${TORC_ROOT}/torc/src/torc/architecture/Array.o + ${TORC_ROOT}/torc/src/torc/architecture/DDB.o + ${TORC_ROOT}/torc/src/torc/architecture/DDBConsoleStreams.o + ${TORC_ROOT}/torc/src/torc/architecture/DDBStreamHelper.o + ${TORC_ROOT}/torc/src/torc/architecture/DigestStream.o + ${TORC_ROOT}/torc/src/torc/architecture/ExtendedWireInfo.o + ${TORC_ROOT}/torc/src/torc/architecture/InstancePin.o + ${TORC_ROOT}/torc/src/torc/architecture/OutputStreamHelpers.o + ${TORC_ROOT}/torc/src/torc/architecture/Package.o + ${TORC_ROOT}/torc/src/torc/architecture/Pad.o + ${TORC_ROOT}/torc/src/torc/architecture/PrimitiveConn.o + ${TORC_ROOT}/torc/src/torc/architecture/PrimitiveDef.o + ${TORC_ROOT}/torc/src/torc/architecture/PrimitiveElement.o + ${TORC_ROOT}/torc/src/torc/architecture/PrimitiveElementPin.o + ${TORC_ROOT}/torc/src/torc/architecture/PrimitivePin.o + ${TORC_ROOT}/torc/src/torc/architecture/Segments.o + ${TORC_ROOT}/torc/src/torc/architecture/Site.o + ${TORC_ROOT}/torc/src/torc/architecture/Sites.o + ${TORC_ROOT}/torc/src/torc/architecture/Tiles.o + ${TORC_ROOT}/torc/src/torc/architecture/TileInfo.o + ${TORC_ROOT}/torc/src/torc/architecture/Tilewire.o + ${TORC_ROOT}/torc/src/torc/architecture/Versions.o + ${TORC_ROOT}/torc/src/torc/architecture/VprExporter.o + ${TORC_ROOT}/torc/src/torc/architecture/WireInfo.o + ${TORC_ROOT}/torc/src/torc/architecture/WireUsage.o + ${TORC_ROOT}/torc/src/torc/architecture/XdlImporter.o + ${TORC_ROOT}/torc/src/torc/architecture/XilinxDatabaseTypes.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/common/Annotated.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/common/DeviceDesignator.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/common/Devices.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/common/DirectoryTree.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/common/DottedVersion.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/common/NullOutputStream.o + ${TORC_ROOT}/torc/src/torc/common/Annotated.o + ${TORC_ROOT}/torc/src/torc/common/DeviceDesignator.o + ${TORC_ROOT}/torc/src/torc/common/Devices.o + ${TORC_ROOT}/torc/src/torc/common/DirectoryTree.o + ${TORC_ROOT}/torc/src/torc/common/DottedVersion.o + ${TORC_ROOT}/torc/src/torc/common/NullOutputStream.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/externals/zlib/zfstream.o + ${TORC_ROOT}/torc/src/torc/externals/zlib/zfstream.o z - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Circuit.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/ConfigMap.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Config.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Design.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Factory.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Instance.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/InstancePin.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/InstanceReference.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Module.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/ModuleTransformer.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Named.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Net.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/OutputStreamHelpers.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Pip.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Port.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Progenitor.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Progeny.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Renamable.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/Routethrough.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/TilewirePlaceholder.o - ${CMAKE_CURRENT_SOURCE_DIR}/torc/src/torc/physical/XdlExporter.o + ${TORC_ROOT}/torc/src/torc/physical/Circuit.o + ${TORC_ROOT}/torc/src/torc/physical/ConfigMap.o + ${TORC_ROOT}/torc/src/torc/physical/Config.o + ${TORC_ROOT}/torc/src/torc/physical/Design.o + ${TORC_ROOT}/torc/src/torc/physical/Factory.o + ${TORC_ROOT}/torc/src/torc/physical/Instance.o + ${TORC_ROOT}/torc/src/torc/physical/InstancePin.o + ${TORC_ROOT}/torc/src/torc/physical/InstanceReference.o + ${TORC_ROOT}/torc/src/torc/physical/Module.o + ${TORC_ROOT}/torc/src/torc/physical/ModuleTransformer.o + ${TORC_ROOT}/torc/src/torc/physical/Named.o + ${TORC_ROOT}/torc/src/torc/physical/Net.o + ${TORC_ROOT}/torc/src/torc/physical/OutputStreamHelpers.o + ${TORC_ROOT}/torc/src/torc/physical/Pip.o + ${TORC_ROOT}/torc/src/torc/physical/Port.o + ${TORC_ROOT}/torc/src/torc/physical/Progenitor.o + ${TORC_ROOT}/torc/src/torc/physical/Progeny.o + ${TORC_ROOT}/torc/src/torc/physical/Renamable.o + ${TORC_ROOT}/torc/src/torc/physical/Routethrough.o + ${TORC_ROOT}/torc/src/torc/physical/TilewirePlaceholder.o + ${TORC_ROOT}/torc/src/torc/physical/XdlExporter.o ) target_link_libraries(nextpnr-${family} PRIVATE ${TORC_OBJS}) From 1a9b2d98038ae5e4984d8e735a197ba9877576d2 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Tue, 1 Jan 2019 13:50:35 -0800 Subject: [PATCH 13/17] [xc7] Docker's torc not to make install --- .cirrus/Dockerfile.ubuntu16.04 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.cirrus/Dockerfile.ubuntu16.04 b/.cirrus/Dockerfile.ubuntu16.04 index 673fb54f..cf665c55 100644 --- a/.cirrus/Dockerfile.ubuntu16.04 +++ b/.cirrus/Dockerfile.ubuntu16.04 @@ -58,5 +58,4 @@ RUN set -e -x ;\ git clone --recursive https://github.com/eddiehung/torc.git ;\ cd torc ;\ git reset --hard 90874d1293fbeba77bae41b5c38168cd91e1bf00 ;\ - make -j $(nproc) -C src/torc ;\ - make install + make -j $(nproc) -C src/torc From ef35b41e0f9d98a21d21c0ec7cc142d30196a6ea Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 6 Jan 2019 12:29:37 -0800 Subject: [PATCH 14/17] [xc7] Remove hardcoded Torc path --- xc7/arch.cc | 10 +++++++--- xc7/family.cmake | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/xc7/arch.cc b/xc7/arch.cc index bd0dd5d2..786163e9 100644 --- a/xc7/arch.cc +++ b/xc7/arch.cc @@ -349,7 +349,9 @@ void IdString::initialize_arch(const BaseCtx *ctx) Arch::Arch(ArchArgs args) : args(args) { - torc::common::DirectoryTree directoryTree("/opt/torc/src/torc"); + std::stringstream ss; + ss << TORC_ROOT << "/torc/src/torc"; + torc::common::DirectoryTree directoryTree(ss.str().c_str()); if (args.type == ArchArgs::Z020) { torc_info = std::unique_ptr(new TorcInfo(this, "xc7z020", args.package)); } else if (args.type == ArchArgs::VX980) { @@ -358,8 +360,10 @@ Arch::Arch(ArchArgs args) : args(args) log_error("Unsupported XC7 chip type.\n"); } - width = torc_info->width; - height = torc_info->height; + // TODO: FIXME + width = torc_info->width; + height = torc_info->height; + /*if (getCtx()->verbose)*/ { log_info("Number of bels: %d\n", torc_info->num_bels); log_info("Number of wires: %d\n", torc_info->num_wires); diff --git a/xc7/family.cmake b/xc7/family.cmake index c1c7dcb8..99eb21ed 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -28,8 +28,10 @@ if (NOT DEFINED TORC_ROOT) set(TORC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) endif() +target_compile_definitions(nextpnr-${family} PRIVATE -DTORC_ROOT="${TORC_ROOT}") target_include_directories(nextpnr-${family} PUBLIC ${TORC_ROOT}/torc/src) if (BUILD_TESTS) + target_compile_definitions(nextpnr-${family}-test PRIVATE -DTORC_ROOT="${TORC_ROOT}") target_include_directories(nextpnr-${family}-test PUBLIC ${TORC_ROOT}/torc/src) endif() if (BUILD_GUI) From 2c4fd3ce8180365cb8f3e5d6176b30f414553ec2 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 6 Jan 2019 21:04:00 -0800 Subject: [PATCH 15/17] [xc7] Retry TORC_ROOT --- .cirrus.yml | 2 +- xc7/arch.cc | 2 +- xc7/family.cmake | 122 +++++++++++++++++++++++------------------------ 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 40b335df..6c1a8793 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,7 +5,7 @@ task: memory: 16 dockerfile: .cirrus/Dockerfile.ubuntu16.04 - build_script: mkdir build && cd build && cmake .. -DARCH=all -DTRELLIS_ROOT=/usr/local/src/prjtrellis -DTORC_ROOT=/usr/local/src/torc -DBUILD_TESTS=on && make -j $(nproc) + build_script: mkdir build && cd build && cmake .. -DARCH=all -DTRELLIS_ROOT=/usr/local/src/prjtrellis -DTORC_ROOT=/usr/local/src/torc/src -DBUILD_TESTS=on && make -j $(nproc) test_generic_script: cd build && ./nextpnr-generic-test test_ice40_script: cd build && ./nextpnr-ice40-test smoketest_ice40_script: export NEXTPNR=$(pwd)/build/nextpnr-ice40 && cd ice40/smoketest/attosoc && ./smoketest.sh diff --git a/xc7/arch.cc b/xc7/arch.cc index 786163e9..2304cd7a 100644 --- a/xc7/arch.cc +++ b/xc7/arch.cc @@ -350,7 +350,7 @@ void IdString::initialize_arch(const BaseCtx *ctx) Arch::Arch(ArchArgs args) : args(args) { std::stringstream ss; - ss << TORC_ROOT << "/torc/src/torc"; + ss << TORC_ROOT << "/src/torc"; torc::common::DirectoryTree directoryTree(ss.str().c_str()); if (args.type == ArchArgs::Z020) { torc_info = std::unique_ptr(new TorcInfo(this, "xc7z020", args.package)); diff --git a/xc7/family.cmake b/xc7/family.cmake index 99eb21ed..cf917db0 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -25,81 +25,81 @@ if (NOT DEFINED TORC_ROOT) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs} ${boost_python_lib}) - set(TORC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) + set(TORC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/torc) endif() target_compile_definitions(nextpnr-${family} PRIVATE -DTORC_ROOT="${TORC_ROOT}") -target_include_directories(nextpnr-${family} PUBLIC ${TORC_ROOT}/torc/src) +target_include_directories(nextpnr-${family} PUBLIC ${TORC_ROOT}/src) if (BUILD_TESTS) target_compile_definitions(nextpnr-${family}-test PRIVATE -DTORC_ROOT="${TORC_ROOT}") - target_include_directories(nextpnr-${family}-test PUBLIC ${TORC_ROOT}/torc/src) + target_include_directories(nextpnr-${family}-test PUBLIC ${TORC_ROOT}/src) endif() if (BUILD_GUI) - target_include_directories(gui_${family} PUBLIC ${TORC_ROOT}/torc/src) + target_include_directories(gui_${family} PUBLIC ${TORC_ROOT}/src) endif() set(TORC_OBJS - ${TORC_ROOT}/torc/src/torc/architecture/Arc.o - ${TORC_ROOT}/torc/src/torc/architecture/ArcUsage.o - ${TORC_ROOT}/torc/src/torc/architecture/Array.o - ${TORC_ROOT}/torc/src/torc/architecture/DDB.o - ${TORC_ROOT}/torc/src/torc/architecture/DDBConsoleStreams.o - ${TORC_ROOT}/torc/src/torc/architecture/DDBStreamHelper.o - ${TORC_ROOT}/torc/src/torc/architecture/DigestStream.o - ${TORC_ROOT}/torc/src/torc/architecture/ExtendedWireInfo.o - ${TORC_ROOT}/torc/src/torc/architecture/InstancePin.o - ${TORC_ROOT}/torc/src/torc/architecture/OutputStreamHelpers.o - ${TORC_ROOT}/torc/src/torc/architecture/Package.o - ${TORC_ROOT}/torc/src/torc/architecture/Pad.o - ${TORC_ROOT}/torc/src/torc/architecture/PrimitiveConn.o - ${TORC_ROOT}/torc/src/torc/architecture/PrimitiveDef.o - ${TORC_ROOT}/torc/src/torc/architecture/PrimitiveElement.o - ${TORC_ROOT}/torc/src/torc/architecture/PrimitiveElementPin.o - ${TORC_ROOT}/torc/src/torc/architecture/PrimitivePin.o - ${TORC_ROOT}/torc/src/torc/architecture/Segments.o - ${TORC_ROOT}/torc/src/torc/architecture/Site.o - ${TORC_ROOT}/torc/src/torc/architecture/Sites.o - ${TORC_ROOT}/torc/src/torc/architecture/Tiles.o - ${TORC_ROOT}/torc/src/torc/architecture/TileInfo.o - ${TORC_ROOT}/torc/src/torc/architecture/Tilewire.o - ${TORC_ROOT}/torc/src/torc/architecture/Versions.o - ${TORC_ROOT}/torc/src/torc/architecture/VprExporter.o - ${TORC_ROOT}/torc/src/torc/architecture/WireInfo.o - ${TORC_ROOT}/torc/src/torc/architecture/WireUsage.o - ${TORC_ROOT}/torc/src/torc/architecture/XdlImporter.o - ${TORC_ROOT}/torc/src/torc/architecture/XilinxDatabaseTypes.o + ${TORC_ROOT}/src/torc/architecture/Arc.o + ${TORC_ROOT}/src/torc/architecture/ArcUsage.o + ${TORC_ROOT}/src/torc/architecture/Array.o + ${TORC_ROOT}/src/torc/architecture/DDB.o + ${TORC_ROOT}/src/torc/architecture/DDBConsoleStreams.o + ${TORC_ROOT}/src/torc/architecture/DDBStreamHelper.o + ${TORC_ROOT}/src/torc/architecture/DigestStream.o + ${TORC_ROOT}/src/torc/architecture/ExtendedWireInfo.o + ${TORC_ROOT}/src/torc/architecture/InstancePin.o + ${TORC_ROOT}/src/torc/architecture/OutputStreamHelpers.o + ${TORC_ROOT}/src/torc/architecture/Package.o + ${TORC_ROOT}/src/torc/architecture/Pad.o + ${TORC_ROOT}/src/torc/architecture/PrimitiveConn.o + ${TORC_ROOT}/src/torc/architecture/PrimitiveDef.o + ${TORC_ROOT}/src/torc/architecture/PrimitiveElement.o + ${TORC_ROOT}/src/torc/architecture/PrimitiveElementPin.o + ${TORC_ROOT}/src/torc/architecture/PrimitivePin.o + ${TORC_ROOT}/src/torc/architecture/Segments.o + ${TORC_ROOT}/src/torc/architecture/Site.o + ${TORC_ROOT}/src/torc/architecture/Sites.o + ${TORC_ROOT}/src/torc/architecture/Tiles.o + ${TORC_ROOT}/src/torc/architecture/TileInfo.o + ${TORC_ROOT}/src/torc/architecture/Tilewire.o + ${TORC_ROOT}/src/torc/architecture/Versions.o + ${TORC_ROOT}/src/torc/architecture/VprExporter.o + ${TORC_ROOT}/src/torc/architecture/WireInfo.o + ${TORC_ROOT}/src/torc/architecture/WireUsage.o + ${TORC_ROOT}/src/torc/architecture/XdlImporter.o + ${TORC_ROOT}/src/torc/architecture/XilinxDatabaseTypes.o - ${TORC_ROOT}/torc/src/torc/common/Annotated.o - ${TORC_ROOT}/torc/src/torc/common/DeviceDesignator.o - ${TORC_ROOT}/torc/src/torc/common/Devices.o - ${TORC_ROOT}/torc/src/torc/common/DirectoryTree.o - ${TORC_ROOT}/torc/src/torc/common/DottedVersion.o - ${TORC_ROOT}/torc/src/torc/common/NullOutputStream.o + ${TORC_ROOT}/src/torc/common/Annotated.o + ${TORC_ROOT}/src/torc/common/DeviceDesignator.o + ${TORC_ROOT}/src/torc/common/Devices.o + ${TORC_ROOT}/src/torc/common/DirectoryTree.o + ${TORC_ROOT}/src/torc/common/DottedVersion.o + ${TORC_ROOT}/src/torc/common/NullOutputStream.o - ${TORC_ROOT}/torc/src/torc/externals/zlib/zfstream.o + ${TORC_ROOT}/src/torc/externals/zlib/zfstream.o z - ${TORC_ROOT}/torc/src/torc/physical/Circuit.o - ${TORC_ROOT}/torc/src/torc/physical/ConfigMap.o - ${TORC_ROOT}/torc/src/torc/physical/Config.o - ${TORC_ROOT}/torc/src/torc/physical/Design.o - ${TORC_ROOT}/torc/src/torc/physical/Factory.o - ${TORC_ROOT}/torc/src/torc/physical/Instance.o - ${TORC_ROOT}/torc/src/torc/physical/InstancePin.o - ${TORC_ROOT}/torc/src/torc/physical/InstanceReference.o - ${TORC_ROOT}/torc/src/torc/physical/Module.o - ${TORC_ROOT}/torc/src/torc/physical/ModuleTransformer.o - ${TORC_ROOT}/torc/src/torc/physical/Named.o - ${TORC_ROOT}/torc/src/torc/physical/Net.o - ${TORC_ROOT}/torc/src/torc/physical/OutputStreamHelpers.o - ${TORC_ROOT}/torc/src/torc/physical/Pip.o - ${TORC_ROOT}/torc/src/torc/physical/Port.o - ${TORC_ROOT}/torc/src/torc/physical/Progenitor.o - ${TORC_ROOT}/torc/src/torc/physical/Progeny.o - ${TORC_ROOT}/torc/src/torc/physical/Renamable.o - ${TORC_ROOT}/torc/src/torc/physical/Routethrough.o - ${TORC_ROOT}/torc/src/torc/physical/TilewirePlaceholder.o - ${TORC_ROOT}/torc/src/torc/physical/XdlExporter.o + ${TORC_ROOT}/src/torc/physical/Circuit.o + ${TORC_ROOT}/src/torc/physical/ConfigMap.o + ${TORC_ROOT}/src/torc/physical/Config.o + ${TORC_ROOT}/src/torc/physical/Design.o + ${TORC_ROOT}/src/torc/physical/Factory.o + ${TORC_ROOT}/src/torc/physical/Instance.o + ${TORC_ROOT}/src/torc/physical/InstancePin.o + ${TORC_ROOT}/src/torc/physical/InstanceReference.o + ${TORC_ROOT}/src/torc/physical/Module.o + ${TORC_ROOT}/src/torc/physical/ModuleTransformer.o + ${TORC_ROOT}/src/torc/physical/Named.o + ${TORC_ROOT}/src/torc/physical/Net.o + ${TORC_ROOT}/src/torc/physical/OutputStreamHelpers.o + ${TORC_ROOT}/src/torc/physical/Pip.o + ${TORC_ROOT}/src/torc/physical/Port.o + ${TORC_ROOT}/src/torc/physical/Progenitor.o + ${TORC_ROOT}/src/torc/physical/Progeny.o + ${TORC_ROOT}/src/torc/physical/Renamable.o + ${TORC_ROOT}/src/torc/physical/Routethrough.o + ${TORC_ROOT}/src/torc/physical/TilewirePlaceholder.o + ${TORC_ROOT}/src/torc/physical/XdlExporter.o ) target_link_libraries(nextpnr-${family} PRIVATE ${TORC_OBJS}) From 940843f7f3f1b15a48e4b6ec6aa333b5ec3f2975 Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Sun, 6 Jan 2019 21:16:31 -0800 Subject: [PATCH 16/17] [xc7] And again --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 6c1a8793..40b335df 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,7 +5,7 @@ task: memory: 16 dockerfile: .cirrus/Dockerfile.ubuntu16.04 - build_script: mkdir build && cd build && cmake .. -DARCH=all -DTRELLIS_ROOT=/usr/local/src/prjtrellis -DTORC_ROOT=/usr/local/src/torc/src -DBUILD_TESTS=on && make -j $(nproc) + build_script: mkdir build && cd build && cmake .. -DARCH=all -DTRELLIS_ROOT=/usr/local/src/prjtrellis -DTORC_ROOT=/usr/local/src/torc -DBUILD_TESTS=on && make -j $(nproc) test_generic_script: cd build && ./nextpnr-generic-test test_ice40_script: cd build && ./nextpnr-ice40-test smoketest_ice40_script: export NEXTPNR=$(pwd)/build/nextpnr-ice40 && cd ice40/smoketest/attosoc && ./smoketest.sh From 74e84cf65e0fe91668913af14d13132b2e235aad Mon Sep 17 00:00:00 2001 From: Eddie Hung Date: Thu, 10 Jan 2019 12:23:12 -0800 Subject: [PATCH 17/17] [xc7] Try again --- xc7/family.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xc7/family.cmake b/xc7/family.cmake index cf917db0..e0a93bf2 100644 --- a/xc7/family.cmake +++ b/xc7/family.cmake @@ -23,11 +23,11 @@ if (NOT DEFINED TORC_ROOT) COMMAND $(MAKE) > /dev/null 2> /dev/null COMMENT "Building torc (may take some time...)" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/torc/src) - find_package(Boost REQUIRED COMPONENTS serialization iostreams ${boost_libs} ${boost_python_lib}) - set(TORC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/torc) endif() +find_package(Boost REQUIRED COMPONENTS regex ${boost_libs} ${boost_python_lib}) + target_compile_definitions(nextpnr-${family} PRIVATE -DTORC_ROOT="${TORC_ROOT}") target_include_directories(nextpnr-${family} PUBLIC ${TORC_ROOT}/src) if (BUILD_TESTS)