Skip to content

Commit 38e9c9e

Browse files
committed
Updates needed for a build system changes
1 parent d3bbdc8 commit 38e9c9e

File tree

2 files changed

+51
-31
lines changed

2 files changed

+51
-31
lines changed

himbaechel/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ else()
6464

6565
endif()
6666

67-
set(HIMBAECHEL_UARCHES example gowin xilinx ng-ultra)
67+
set(HIMBAECHEL_UARCHES example gowin xilinx ng-ultra gatemate)
6868

6969
set(HIMBAECHEL_UARCH "" CACHE STRING "Microarchitectures for nextpnr-himbaechel build")
7070
set_property(CACHE HIMBAECHEL_UARCH PROPERTY STRINGS ${HIMBAECHEL_UARCHES})
+50-30
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,58 @@
1-
message(STATUS "Configuring Himbaechel-GateMate uarch")
2-
cmake_minimum_required(VERSION 3.5)
3-
project(himbaechel-gatemate-chipdb NONE)
1+
set(SOURCES
2+
bitstream.cc
3+
ccf.cc
4+
config.cc
5+
config.h
6+
constids.inc
7+
extra_data.h
8+
gatemate.cc
9+
gatemate.h
10+
gfx.cc
11+
gfxids.inc
12+
pack.cc
13+
pack.h
14+
)
15+
16+
add_nextpnr_himbaechel_microarchitecture(${uarch}
17+
CORE_SOURCES ${SOURCES}
18+
)
419

520
set(HIMBAECHEL_PEPPERCORN_PATH "" CACHE STRING
6-
"Path to a Project Peppercorn database scripts")
21+
"Path to a Project Peppercorn database")
22+
if (NOT HIMBAECHEL_PEPPERCORN_PATH)
23+
message(FATAL_ERROR "HIMBAECHEL_PEPPERCORN_PATH must be set to a Project Peppercorn checkout")
24+
endif()
725

8-
set(ALL_HIMBAECHE_GATEMATE_DEVICES CCGM1A1 CCGM1A2 CCGM1A4 CCGM1A9 CCGM1A16 CCGM1A25)
9-
set(HIMBAECHEL_GATEMATE_DEVICES "" CACHE STRING
26+
#set(ALL_HIMBAECHE_GATEMATE_DEVICES CCGM1A1 CCGM1A2 CCGM1A4 CCGM1A9 CCGM1A16 CCGM1A25)
27+
set(ALL_HIMBAECHE_GATEMATE_DEVICES CCGM1A1)
28+
set(HIMBAECHEL_GATEMATE_DEVICES ${ALL_HIMBAECHE_GATEMATE_DEVICES} CACHE STRING
1029
"Include support for these GateMate devices (available: ${ALL_HIMBAECHE_GATEMATE_DEVICES})")
1130
message(STATUS "Enabled Himbaechel-GateMate devices: ${HIMBAECHEL_GATEMATE_DEVICES}")
1231

13-
set(chipdb_binaries)
14-
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/gatemate)
15-
foreach(device ${HIMBAECHEL_GATEMATE_DEVICES})
16-
set(device_bba ${CMAKE_BINARY_DIR}/share/himbaechel/gatemate/chipdb-${device}.bba)
17-
set(device_bin ${CMAKE_BINARY_DIR}/share/himbaechel/gatemate/chipdb-${device}.bin)
18-
if("${HIMBAECHEL_PEPPERCORN_PATH}" STREQUAL "")
19-
message(SEND_ERROR "HIMBAECHEL_PEPPERCORN_PATH must be set to a Project Peppercorn checkout")
20-
endif()
21-
add_custom_command(
22-
OUTPUT ${device_bin}
23-
COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py --device ${device} --bba ${device_bba} --lib ${HIMBAECHEL_PEPPERCORN_PATH}/gatemate
24-
COMMAND bbasm ${BBASM_ENDIAN_FLAG} ${device_bba} ${device_bin}.new
25-
# atomically update
26-
COMMAND ${CMAKE_COMMAND} -E rename ${device_bin}.new ${device_bin}
27-
DEPENDS
28-
bbasm
29-
${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py
30-
${CMAKE_CURRENT_SOURCE_DIR}/constids.inc
32+
foreach (device ${HIMBAECHEL_GATEMATE_DEVICES})
33+
if (NOT device IN_LIST ALL_HIMBAECHE_GATEMATE_DEVICES)
34+
message(FATAL_ERROR "Device ${device} is not a supported GateMate device")
35+
endif()
36+
37+
add_bba_produce_command(
38+
TARGET nextpnr-himbaechel-gatemate-bba
39+
COMMAND ${Python3_EXECUTABLE}
40+
${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py
41+
--lib ${HIMBAECHEL_PEPPERCORN_PATH}/gatemate
42+
--device ${device}
43+
--bba ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba.new
44+
OUTPUT
45+
${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba
46+
INPUTS
47+
${CMAKE_CURRENT_SOURCE_DIR}/gen/arch_gen.py
48+
${CMAKE_CURRENT_SOURCE_DIR}/constids.inc
3149
${CMAKE_CURRENT_SOURCE_DIR}/gfxids.inc
32-
VERBATIM)
33-
list(APPEND chipdb_binaries ${device_bin})
34-
endforeach()
50+
)
3551

36-
add_custom_target(chipdb-himbaechel-gatemate ALL DEPENDS ${chipdb_binaries})
37-
install(DIRECTORY ${CMAKE_BINARY_DIR}/share/himbaechel/gatemate/ DESTINATION share/nextpnr/himbaechel/gatemate
38-
PATTERN "*.bba" EXCLUDE)
52+
add_bba_compile_command(
53+
TARGET nextpnr-himbaechel-gatemate-chipdb
54+
OUTPUT himbaechel/gatemate/chipdb-${device}.bin
55+
INPUT ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba
56+
MODE binary
57+
)
58+
endforeach()

0 commit comments

Comments
 (0)