-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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).
- Loading branch information
1 parent
3844c2a
commit 6303fbe
Showing
8 changed files
with
178 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,48 @@ | ||
message(STATUS "Configuring Himbaechel-NG-ULTRA uarch") | ||
cmake_minimum_required(VERSION 3.5) | ||
project(himbaechel-ng-ultra-chipdb NONE) | ||
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() | ||
|
||
add_custom_target(chipdb-himbaechel-ng-ultra) | ||
foreach (target ${family_targets}) | ||
add_dependencies(${target} chipdb-himbaechel-ng-ultra) | ||
endforeach() | ||
|
||
set(ALL_HIMBAECHEL_NGULTRA_DEVICES ng-ultra) | ||
set(HIMBAECHEL_NGULTRA_DEVICES "" CACHE STRING | ||
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}") | ||
set(HIMBAECHEL_PRJBEYOND_DB "" CACHE STRING | ||
"Path to a Project Beyond database") | ||
|
||
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() | ||
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 | ||
) | ||
|
||
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_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() | ||
|
||
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) | ||
install( | ||
DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/ng-ultra | ||
DESTINATION share/nextpnr/himbaechel/ng-ultra | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
|
||
add_custom_target(chipdb-himbaechel-xilinx) | ||
foreach (target ${family_targets}) | ||
add_dependencies(${target} chipdb-himbaechel-xilinx) | ||
endforeach() | ||
|
||
set(HIMBAECHEL_XILINX_DEVICES "" CACHE STRING | ||
"Include support for these Xilinx devices") | ||
message(STATUS "Enabled Himbaechel-Xilinx devices: ${HIMBAECHEL_XILINX_DEVICES}") | ||
|
||
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() | ||
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 | ||
) | ||
|
||
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_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() | ||
|
||
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) | ||
install( | ||
DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/xilinx | ||
DESTINATION share/nextpnr/himbaechel/xilinx | ||
) |