From dcfb7d8c339c563e969a05987eab80ad0609fbf8 Mon Sep 17 00:00:00 2001 From: Catherine Date: Wed, 15 Jan 2025 16:20:21 +0000 Subject: [PATCH] CMake: align Himbaechel targets with non-Himbaechel ones. Primarily, this commit makes both of them use the `BBAsm` functions to build and compile `.bba` files. In addition, Himbaechel targets are now aligned with the rest in how they are configured: instead of having all uarches enabled with all of the devices disabled (the opposite of the rest of nextpnr), uarches must be enabled explicitly but they come with all devices enabled (except for Xilinx, which does not have a list of devices). --- .github/ci/build_himbaechel.sh | 2 +- README.md | 4 +- cmake/BBAsm.cmake | 10 +++- cmake/FindApycula.cmake | 17 ++++++ himbaechel/CMakeLists.txt | 28 ++++++--- himbaechel/uarch/example/CMakeLists.txt | 55 +++++++++-------- himbaechel/uarch/gowin/CMakeLists.txt | 67 ++++++++++----------- himbaechel/uarch/ng-ultra/CMakeLists.txt | 76 ++++++++++++++---------- himbaechel/uarch/xilinx/CMakeLists.txt | 67 +++++++++++---------- 9 files changed, 187 insertions(+), 139 deletions(-) diff --git a/.github/ci/build_himbaechel.sh b/.github/ci/build_himbaechel.sh index 62e13390..b13e5b04 100644 --- a/.github/ci/build_himbaechel.sh +++ b/.github/ci/build_himbaechel.sh @@ -7,7 +7,7 @@ function get_dependencies { function build_nextpnr { mkdir build pushd build - cmake .. -DARCH=himbaechel -DHIMBAECHEL_EXAMPLE_DEVICES=example + cmake .. -DARCH=himbaechel -DHIMBAECHEL_UARCH=example -DHIMBAECHEL_EXAMPLE_DEVICES=example make nextpnr-himbaechel chipdb-himbaechel-example -j`nproc` popd } diff --git a/README.md b/README.md index b012a1c1..9685f968 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ The himbaechel target allows running placement and routing for larger architectu For Gowin support, install [Project Apicula](https://github.com/YosysHQ/apicula) ``` -cmake . -DARCH="himbaechel" -DHIMBAECHEL_GOWIN_DEVICES="all" +cmake . -DARCH="himbaechel" -DHIMBAECHEL_UARCH="gowin" make -j$(nproc) sudo make install ``` @@ -152,7 +152,7 @@ sudo make install For NanoXplore NG-Ultra support, clone [Project Beyond DB](https://github.com/yosyshq-GmbH/prjbeyond-db) repo ``` -cmake . -DARCH="himbaechel" -DHIMBAECHEL_PRJBEYOND_DB=/path/to/prjbeyond-db -DHIMBAECHEL_NGULTRA_DEVICES=ng-ultra +cmake . -DARCH="himbaechel" -DHIMBAECHEL_UARCH="ng-ultra" -DHIMBAECHEL_PRJBEYOND_DB=/path/to/prjbeyond-db -DHIMBAECHEL_NGULTRA_DEVICES=ng-ultra make -j$(nproc) sudo make install ``` diff --git a/cmake/BBAsm.cmake b/cmake/BBAsm.cmake index c7d59446..4a2b3688 100644 --- a/cmake/BBAsm.cmake +++ b/cmake/BBAsm.cmake @@ -39,12 +39,18 @@ function(add_bba_produce_command) DEPENDS ${arg_EXECUTABLE} ${arg_INPUTS} - $ENV{SERIALIZE_BBA_PRODUCE_COMMAND} + $ENV{SERIALIZE_BBA_TARGET} VERBATIM ) if (BBASM_SERIALIZE) - set(ENV{SERIALIZE_BBA_PRODUCE_COMMAND} ${arg_OUTPUT}) + # Have to insert a custom target in between two custom commands, else CMake will try to + # depend on the previous (in serialization order) command directly, which will fail if + # they're in different directories. Unfortunately this makes the terminal output uglier. + math(EXPR next_count "$ENV{SERIALIZE_BBA_COUNT} + 1") + add_custom_target(--bbasm-serialize-${next_count} DEPENDS ${arg_OUTPUT}) + set(ENV{SERIALIZE_BBA_COUNT} ${next_count}) + set(ENV{SERIALIZE_BBA_TARGET} --bbasm-serialize-${next_count}) endif() endfunction() diff --git a/cmake/FindApycula.cmake b/cmake/FindApycula.cmake index d63fd552..6358a9b9 100644 --- a/cmake/FindApycula.cmake +++ b/cmake/FindApycula.cmake @@ -1,2 +1,19 @@ +# nextpnr-gowin only + find_program (GOWIN_BBA_EXECUTABLE gowin_bba) message(STATUS "gowin_bba executable: ${GOWIN_BBA_EXECUTABLE}") + +# nextpnr-himbaechel-gowin only + +if (DEFINED ENV{APYCULA_INSTALL_PREFIX}) + set(apycula_default_install_prefix $ENV{APYCULA_INSTALL_PREFIX}) +endif() +set(APYCULA_INSTALL_PREFIX ${apycula_default_install_prefix} CACHE STRING + "Apycula install prefix (virtualenv directory)") +if (NOT APYCULA_INSTALL_PREFIX STREQUAL "") + message(STATUS "Apycula install prefix: ${APYCULA_INSTALL_PREFIX}") + set(apycula_Python3_EXECUTABLE ${APYCULA_INSTALL_PREFIX}/bin/python) +else() + message(STATUS "Apycula install prefix: (not set, using Python: ${Python3_EXECUTABLE})") + set(apycula_Python3_EXECUTABLE ${Python3_EXECUTABLE}) +endif() diff --git a/himbaechel/CMakeLists.txt b/himbaechel/CMakeLists.txt index 441452a8..bfe81b5a 100644 --- a/himbaechel/CMakeLists.txt +++ b/himbaechel/CMakeLists.txt @@ -1,16 +1,28 @@ -set(HIMBAECHEL_UARCHES "example;gowin;xilinx;ng-ultra") +set(HIMBAECHEL_UARCHES example gowin xilinx ng-ultra) -set(HIMBAECHEL_UARCH "${HIMBAECHEL_UARCHES}" CACHE STRING "Microarchitectures for nextpnr-himbaechel build") +set(HIMBAECHEL_UARCH "" CACHE STRING "Microarchitectures for nextpnr-himbaechel build") set_property(CACHE HIMBAECHEL_UARCH PROPERTY STRINGS ${HIMBAECHEL_UARCHES}) -foreach (item ${HIMBAECHEL_UARCH}) - if (NOT item IN_LIST HIMBAECHEL_UARCHES) - message(FATAL_ERROR "Microarchitecture '${item}' not in list of supported architectures") - endif() -endforeach() +if (NOT HIMBAECHEL_UARCH) + message(STATUS "Microarchitecture needs to be set, set desired one with -DHIMBAECHEL_UARCH=xxx") + message(STATUS "Supported Himbaechel microarchitectures are :") + message(STATUS " all") + foreach (item ${HIMBAECHEL_UARCHES}) + message(STATUS " ${item}") + endforeach() + message(FATAL_ERROR "Microarchitecture setting is mandatory") +endif() + +if (HIMBAECHEL_UARCH STREQUAL "all") + set(HIMBAECHEL_UARCH ${HIMBAECHEL_UARCHES}) +endif() foreach (uarch ${HIMBAECHEL_UARCH}) - add_subdirectory(uarch/${uarch}) + if (NOT uarch IN_LIST HIMBAECHEL_UARCHES) + message(FATAL_ERROR "Microarchitecture ${uarch} is not a supported Himbaechel microarchitecture") + endif() + + add_subdirectory(uarch/${uarch}) aux_source_directory(uarch/${uarch} HM_UARCH_FILES) foreach (target ${family_targets}) target_sources(${target} PRIVATE ${HM_UARCH_FILES}) diff --git a/himbaechel/uarch/example/CMakeLists.txt b/himbaechel/uarch/example/CMakeLists.txt index 52a1b2a0..d9e6dc77 100644 --- a/himbaechel/uarch/example/CMakeLists.txt +++ b/himbaechel/uarch/example/CMakeLists.txt @@ -1,32 +1,39 @@ -message(STATUS "Configuring Himbaechel-Example uarch") -cmake_minimum_required(VERSION 3.5) -project(himbaechel-example-chipdb NONE) +add_custom_target(chipdb-himbaechel-example) +foreach (target ${family_targets}) + add_dependencies(${target} chipdb-himbaechel-example) +endforeach() set(ALL_HIMBAECHEL_EXAMPLE_DEVICES example) -set(HIMBAECHEL_EXAMPLE_DEVICES "" CACHE STRING +set(HIMBAECHEL_EXAMPLE_DEVICES ${ALL_HIMBAECHEL_EXAMPLE_DEVICES} CACHE STRING "Include support for these Example devices (available: ${ALL_HIMBAECHEL_EXAMPLE_DEVICES})") message(STATUS "Enabled Himbaechel-Example devices: ${HIMBAECHEL_EXAMPLE_DEVICES}") -set(chipdb_binaries) -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/example) foreach (device ${HIMBAECHEL_EXAMPLE_DEVICES}) - set(device_bba ${CMAKE_BINARY_DIR}/share/himbaechel/example/chipdb-${device}.bba) - set(device_bin ${CMAKE_BINARY_DIR}/share/himbaechel/example/chipdb-${device}.bin) - add_custom_command( - OUTPUT ${device_bin} - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/example_arch_gen.py ${device_bba} - COMMAND bbasm ${BBASM_ENDIAN_FLAG} ${device_bba} ${device_bin}.new - # atomically update - COMMAND ${CMAKE_COMMAND} -E rename ${device_bin}.new ${device_bin} - DEPENDS - bbasm - ${CMAKE_CURRENT_SOURCE_DIR}/example_arch_gen.py - ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc - ${CMAKE_CURRENT_SOURCE_DIR}/gfxids.inc - VERBATIM) - list(APPEND chipdb_binaries ${device_bin}) + if (NOT device IN_LIST ALL_HIMBAECHEL_EXAMPLE_DEVICES) + message(FATAL_ERROR "Device ${device} is not a supported Example device") + endif() + + add_bba_produce_command( + COMMAND ${Python3_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/example_arch_gen.py + ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba.new + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba + INPUTS + ${CMAKE_CURRENT_SOURCE_DIR}/example_arch_gen.py + ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc + ${CMAKE_CURRENT_SOURCE_DIR}/gfxids.inc + ) + + add_bba_compile_command( + TARGET chipdb-himbaechel-example + OUTPUT ${CMAKE_BINARY_DIR}/share/himbaechel/example/chipdb-${device}.bin + INPUT ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba + MODE binary + ) endforeach() -add_custom_target(chipdb-himbaechel-example ALL DEPENDS ${chipdb_binaries}) -install(DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/example/ DESTINATION share/nextpnr/himbaechel/example - PATTERN "*.bba" EXCLUDE) +install( + DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/example + DESTINATION share/nextpnr/himbaechel/example +) diff --git a/himbaechel/uarch/gowin/CMakeLists.txt b/himbaechel/uarch/gowin/CMakeLists.txt index 7375d821..a7daf2f5 100644 --- a/himbaechel/uarch/gowin/CMakeLists.txt +++ b/himbaechel/uarch/gowin/CMakeLists.txt @@ -1,51 +1,44 @@ -message(STATUS "Configuring Himbaechel-Gowin uarch") -cmake_minimum_required(VERSION 3.5) -project(himbaechel-gowin-chipdb NONE) +include(FindApycula) + +add_custom_target(chipdb-himbaechel-gowin ALL) +foreach (target ${family_targets}) + add_dependencies(${target} chipdb-himbaechel-gowin) +endforeach() set(ALL_HIMBAECHEL_GOWIN_DEVICES GW1N-1 GW1NZ-1 GW1N-4 GW1N-9 GW1N-9C GW1NS-4 GW2A-18 GW2A-18C) -set(HIMBAECHEL_GOWIN_DEVICES "" CACHE STRING +set(HIMBAECHEL_GOWIN_DEVICES ${ALL_HIMBAECHEL_GOWIN_DEVICES} CACHE STRING "Include support for these Gowin devices (available: ${ALL_HIMBAECHEL_GOWIN_DEVICES})") if (HIMBAECHEL_GOWIN_DEVICES STREQUAL "all") set(HIMBAECHEL_GOWIN_DEVICES ${ALL_HIMBAECHEL_GOWIN_DEVICES}) endif() message(STATUS "Enabled Himbaechel-Gowin devices: ${HIMBAECHEL_GOWIN_DEVICES}") -if (DEFINED ENV{APYCULA_INSTALL_PREFIX}) - set(apycula_default_install_prefix $ENV{APYCULA_INSTALL_PREFIX}) -endif() -set(APYCULA_INSTALL_PREFIX ${apycula_default_install_prefix} CACHE STRING - "Apycula install prefix (virtualenv directory)") -if (NOT APYCULA_INSTALL_PREFIX STREQUAL "") - message(STATUS "Apycula install prefix: ${APYCULA_INSTALL_PREFIX}") - set(apycula_Python3_EXECUTABLE ${APYCULA_INSTALL_PREFIX}/bin/python) -else() - message(STATUS "Apycula install prefix: (using system Python)") - set(apycula_Python3_EXECUTABLE ${Python3_EXECUTABLE}) -endif() - -set(chipdb_binaries) -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/gowin) foreach (device ${HIMBAECHEL_GOWIN_DEVICES}) if (NOT device IN_LIST ALL_HIMBAECHEL_GOWIN_DEVICES) - message(FATAL_ERROR "Device ${device} is not a supported Gowin device") + message(FATAL_ERROR "Device ${device} is not a supported Gowin device") endif() - set(device_bba ${CMAKE_BINARY_DIR}/share/himbaechel/gowin/chipdb-${device}.bba) - set(device_bin ${CMAKE_BINARY_DIR}/share/himbaechel/gowin/chipdb-${device}.bin) - add_custom_command( - OUTPUT ${device_bin} - COMMAND ${apycula_Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gowin_arch_gen.py -d ${device} -o ${device_bba} - COMMAND bbasm ${BBASM_ENDIAN_FLAG} ${device_bba} ${device_bin}.new - # atomically update - COMMAND ${CMAKE_COMMAND} -E rename ${device_bin}.new ${device_bin} - DEPENDS - bbasm - ${CMAKE_CURRENT_SOURCE_DIR}/gowin_arch_gen.py - ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc - VERBATIM) - list(APPEND chipdb_binaries ${device_bin}) + add_bba_produce_command( + COMMAND ${apycula_Python3_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/gowin_arch_gen.py + -d ${device} + -o ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba.new + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba + INPUTS + ${CMAKE_CURRENT_SOURCE_DIR}/gowin_arch_gen.py + ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc + ) + + add_bba_compile_command( + TARGET chipdb-himbaechel-gowin + OUTPUT ${CMAKE_BINARY_DIR}/share/himbaechel/gowin/chipdb-${device}.bin + INPUT ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba + MODE binary + ) endforeach() -add_custom_target(chipdb-himbaechel-gowin ALL DEPENDS ${chipdb_binaries}) -install(DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/gowin/ DESTINATION share/nextpnr/himbaechel/gowin - PATTERN "*.bba" EXCLUDE) +install( + DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/gowin + DESTINATION share/nextpnr/himbaechel/gowin +) diff --git a/himbaechel/uarch/ng-ultra/CMakeLists.txt b/himbaechel/uarch/ng-ultra/CMakeLists.txt index 7d9bc0f4..a5e7ee8a 100644 --- a/himbaechel/uarch/ng-ultra/CMakeLists.txt +++ b/himbaechel/uarch/ng-ultra/CMakeLists.txt @@ -1,38 +1,48 @@ -message(STATUS "Configuring Himbaechel-NG-ULTRA uarch") -cmake_minimum_required(VERSION 3.5) -project(himbaechel-ng-ultra-chipdb NONE) - -set(ALL_HIMBAECHEL_NGULTRA_DEVICES ng-ultra) -set(HIMBAECHEL_NGULTRA_DEVICES "" CACHE STRING - "Include support for these NG-Ultra devices (available: ${ALL_HIMBAECHEL_NGULTRA_DEVICES})") -message(STATUS "Enabled Himbaechel-NG-Ultra devices: ${HIMBAECHEL_NGULTRA_DEVICES}") set(HIMBAECHEL_PRJBEYOND_DB "" CACHE STRING "Path to a Project Beyond database") +if (NOT HIMBAECHEL_PRJBEYOND_DB) + message(FATAL_ERROR "HIMBAECHEL_PRJBEYOND_DB must be set to a prjbeyond database checkout") +endif() -set(chipdb_binaries) -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra) -foreach (device ${HIMBAECHEL_NGULTRA_DEVICES}) - if ("${HIMBAECHEL_PRJBEYOND_DB}" STREQUAL "") - message(SEND_ERROR "HIMBAECHEL_PRJBEYOND_DB must be set to a prjbeyond database checkout") - endif() - - set(device_bba ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra/chipdb-${device}.bba) - set(device_bin ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra/chipdb-${device}.bin) - string(TOUPPER ${device} upcase_device) - add_custom_command( - OUTPUT ${device_bin} - COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py --db ${HIMBAECHEL_PRJBEYOND_DB} --device ${upcase_device} --bba ${device_bba} - COMMAND bbasm ${BBASM_ENDIAN_FLAG} ${device_bba} ${device_bin}.new - # atomically update - COMMAND ${CMAKE_COMMAND} -E rename ${device_bin}.new ${device_bin} - DEPENDS - bbasm - ${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py - ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc - VERBATIM) - list(APPEND chipdb_binaries ${device_bin}) +add_custom_target(chipdb-himbaechel-ng-ultra) +foreach (target ${family_targets}) + add_dependencies(${target} chipdb-himbaechel-ng-ultra) endforeach() -add_custom_target(chipdb-himbaechel-ng-ultra ALL DEPENDS ${chipdb_binaries}) -install(DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra/ DESTINATION share/nextpnr/himbaechel/ng-ultra - PATTERN "*.bba" EXCLUDE) +set(ALL_HIMBAECHEL_NGULTRA_DEVICES ng-ultra) +set(HIMBAECHEL_NGULTRA_DEVICES ${ALL_HIMBAECHEL_NGULTRA_DEVICES} CACHE STRING + "Include support for these NG-Ultra devices (available: ${ALL_HIMBAECHEL_NGULTRA_DEVICES})") +message(STATUS "Enabled Himbaechel-NG-Ultra devices: ${HIMBAECHEL_NGULTRA_DEVICES}") + +foreach (device ${HIMBAECHEL_NGULTRA_DEVICES}) + if (NOT device IN_LIST ALL_HIMBAECHEL_NGULTRA_DEVICES) + message(FATAL_ERROR "Device ${device} is not a supported NG-Ultra device") + endif() + + string(TOUPPER ${device} upcase_device) + + add_bba_produce_command( + COMMAND ${Python3_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py + --db ${HIMBAECHEL_PRJBEYOND_DB} + --device ${upcase_device} + --bba ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba.new + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba + INPUTS + ${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py + ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc + ) + + add_bba_compile_command( + TARGET chipdb-himbaechel-ng-ultra + OUTPUT ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra/chipdb-${device}.bin + INPUT ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba + MODE binary + ) +endforeach() + +install( + DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra + DESTINATION share/nextpnr/himbaechel/ng-ultra +) diff --git a/himbaechel/uarch/xilinx/CMakeLists.txt b/himbaechel/uarch/xilinx/CMakeLists.txt index 3d70ce01..f027551a 100644 --- a/himbaechel/uarch/xilinx/CMakeLists.txt +++ b/himbaechel/uarch/xilinx/CMakeLists.txt @@ -1,37 +1,40 @@ -message(STATUS "Configuring Xilinx uarch") -cmake_minimum_required(VERSION 3.5) -project(himbaechel-xilinx-chipdb NONE) - -set(HIMBAECHEL_XILINX_DEVICES "" CACHE STRING - "Include support for these Xilinx devices via himbaechel") set(HIMBAECHEL_PRJXRAY_DB "" CACHE STRING "Path to a project x-ray database") -message(STATUS "Enabled Himbaechel-Xilinx devices: ${HIMBAECHEL_XILINX_DEVICES}") +if (NOT HIMBAECHEL_PRJXRAY_DB) + message(FATAL_ERROR "HIMBAECHEL_PRJXRAY_DB must be set to a prjxray database checkout") +endif() - -set(chipdb_binaries) -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/xilinx) -foreach (device ${HIMBAECHEL_XILINX_DEVICES}) - if ("${HIMBAECHEL_PRJXRAY_DB}" STREQUAL "") - message(SEND_ERROR "HIMBAECHEL_PRJXRAY_DB must be set to a prjxray database checkout") - endif() - - set(device_bba ${CMAKE_BINARY_DIR}/share/himbaechel/xilinx/chipdb-${device}.bba) - set(device_bin ${CMAKE_BINARY_DIR}/share/himbaechel/xilinx/chipdb-${device}.bin) - add_custom_command( - OUTPUT ${device_bin} - COMMAND pypy3 ${CMAKE_CURRENT_SOURCE_DIR}/gen/xilinx_gen.py --xray ${HIMBAECHEL_PRJXRAY_DB}/artix7 --device ${device} --bba ${device_bba} - COMMAND bbasm ${BBASM_ENDIAN_FLAG} ${device_bba} ${device_bin}.new - # atomically update - COMMAND ${CMAKE_COMMAND} -E rename ${device_bin}.new ${device_bin} - DEPENDS - bbasm - ${CMAKE_CURRENT_SOURCE_DIR}/gen/xilinx_gen.py - ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc - VERBATIM) - list(APPEND chipdb_binaries ${device_bin}) +add_custom_target(chipdb-himbaechel-xilinx) +foreach (target ${family_targets}) + add_dependencies(${target} chipdb-himbaechel-xilinx) endforeach() -add_custom_target(chipdb-himbaechel-xilinx ALL DEPENDS ${chipdb_binaries}) -install(DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/xilinx/ DESTINATION share/nextpnr/himbaechel/xilinx - PATTERN "*.bba" EXCLUDE) +set(HIMBAECHEL_XILINX_DEVICES "" CACHE STRING + "Include support for these Xilinx devices") +message(STATUS "Enabled Himbaechel-Xilinx devices: ${HIMBAECHEL_XILINX_DEVICES}") + +foreach (device ${HIMBAECHEL_XILINX_DEVICES}) + add_bba_produce_command( + COMMAND /usr/bin/pypy3 ${CMAKE_CURRENT_SOURCE_DIR}/gen/xilinx_gen.py + --xray ${HIMBAECHEL_PRJXRAY_DB}/artix7 + --device ${device} + --bba ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba.new + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba + INPUTS + ${CMAKE_CURRENT_SOURCE_DIR}/gen/xilinx_gen.py + ${CMAKE_CURRENT_SOURCE_DIR}/constids.inc + ) + + add_bba_compile_command( + TARGET chipdb-himbaechel-xilinx + OUTPUT ${CMAKE_BINARY_DIR}/share/himbaechel/xilinx/chipdb-${device}.bin + INPUT ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba + MODE binary + ) +endforeach() + +install( + DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/xilinx + DESTINATION share/nextpnr/himbaechel/xilinx +)