-
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.
Updates needed for a build system changes
- Loading branch information
Showing
2 changed files
with
51 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,58 @@ | ||
message(STATUS "Configuring Himbaechel-GateMate uarch") | ||
cmake_minimum_required(VERSION 3.5) | ||
project(himbaechel-gatemate-chipdb NONE) | ||
set(SOURCES | ||
bitstream.cc | ||
ccf.cc | ||
config.cc | ||
config.h | ||
constids.inc | ||
extra_data.h | ||
gatemate.cc | ||
gatemate.h | ||
gfx.cc | ||
gfxids.inc | ||
pack.cc | ||
pack.h | ||
) | ||
|
||
add_nextpnr_himbaechel_microarchitecture(${uarch} | ||
CORE_SOURCES ${SOURCES} | ||
) | ||
|
||
set(HIMBAECHEL_PEPPERCORN_PATH "" CACHE STRING | ||
"Path to a Project Peppercorn database scripts") | ||
"Path to a Project Peppercorn database") | ||
if (NOT HIMBAECHEL_PEPPERCORN_PATH) | ||
message(FATAL_ERROR "HIMBAECHEL_PEPPERCORN_PATH must be set to a Project Peppercorn checkout") | ||
endif() | ||
|
||
set(ALL_HIMBAECHE_GATEMATE_DEVICES CCGM1A1 CCGM1A2 CCGM1A4 CCGM1A9 CCGM1A16 CCGM1A25) | ||
set(HIMBAECHEL_GATEMATE_DEVICES "" CACHE STRING | ||
#set(ALL_HIMBAECHE_GATEMATE_DEVICES CCGM1A1 CCGM1A2 CCGM1A4 CCGM1A9 CCGM1A16 CCGM1A25) | ||
set(ALL_HIMBAECHE_GATEMATE_DEVICES CCGM1A1) | ||
set(HIMBAECHEL_GATEMATE_DEVICES ${ALL_HIMBAECHE_GATEMATE_DEVICES} CACHE STRING | ||
"Include support for these GateMate devices (available: ${ALL_HIMBAECHE_GATEMATE_DEVICES})") | ||
message(STATUS "Enabled Himbaechel-GateMate devices: ${HIMBAECHEL_GATEMATE_DEVICES}") | ||
|
||
set(chipdb_binaries) | ||
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/gatemate) | ||
foreach(device ${HIMBAECHEL_GATEMATE_DEVICES}) | ||
set(device_bba ${CMAKE_BINARY_DIR}/share/himbaechel/gatemate/chipdb-${device}.bba) | ||
set(device_bin ${CMAKE_BINARY_DIR}/share/himbaechel/gatemate/chipdb-${device}.bin) | ||
if("${HIMBAECHEL_PEPPERCORN_PATH}" STREQUAL "") | ||
message(SEND_ERROR "HIMBAECHEL_PEPPERCORN_PATH must be set to a Project Peppercorn checkout") | ||
endif() | ||
add_custom_command( | ||
OUTPUT ${device_bin} | ||
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py --device ${device} --bba ${device_bba} --lib ${HIMBAECHEL_PEPPERCORN_PATH}/gatemate | ||
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 | ||
foreach (device ${HIMBAECHEL_GATEMATE_DEVICES}) | ||
if (NOT device IN_LIST ALL_HIMBAECHE_GATEMATE_DEVICES) | ||
message(FATAL_ERROR "Device ${device} is not a supported GateMate device") | ||
endif() | ||
|
||
add_bba_produce_command( | ||
TARGET nextpnr-himbaechel-gatemate-bba | ||
COMMAND ${Python3_EXECUTABLE} | ||
${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py | ||
--lib ${HIMBAECHEL_PEPPERCORN_PATH}/gatemate | ||
--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/arch_gen.py | ||
${CMAKE_CURRENT_SOURCE_DIR}/constids.inc | ||
${CMAKE_CURRENT_SOURCE_DIR}/gfxids.inc | ||
VERBATIM) | ||
list(APPEND chipdb_binaries ${device_bin}) | ||
endforeach() | ||
) | ||
|
||
add_custom_target(chipdb-himbaechel-gatemate ALL DEPENDS ${chipdb_binaries}) | ||
install(DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/gatemate/ DESTINATION share/nextpnr/himbaechel/gatemate | ||
PATTERN "*.bba" EXCLUDE) | ||
add_bba_compile_command( | ||
TARGET nextpnr-himbaechel-gatemate-chipdb | ||
OUTPUT himbaechel/gatemate/chipdb-${device}.bin | ||
INPUT ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba | ||
MODE binary | ||
) | ||
endforeach() |