aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/examples/chipdb.cmake
diff options
context:
space:
mode:
authorAlessandro Comodi <acomodi@antmicro.com>2021-03-12 16:37:00 +0100
committerAlessandro Comodi <acomodi@antmicro.com>2021-03-16 15:39:01 +0100
commit490fdb0a1c3bb78856d26be2186e4dca5d3d021f (patch)
tree7c0c98c57c240cc85e9c37064dd9ccdba8d99bb5 /fpga_interchange/examples/chipdb.cmake
parent77ffdd7fd4e90e0da43e81b1f5e021b08ee64a9f (diff)
downloadnextpnr-490fdb0a1c3bb78856d26be2186e4dca5d3d021f.tar.gz
nextpnr-490fdb0a1c3bb78856d26be2186e4dca5d3d021f.tar.bz2
nextpnr-490fdb0a1c3bb78856d26be2186e4dca5d3d021f.zip
fpga_interchange: cmake: generate only one device family
Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
Diffstat (limited to 'fpga_interchange/examples/chipdb.cmake')
-rw-r--r--fpga_interchange/examples/chipdb.cmake76
1 files changed, 49 insertions, 27 deletions
diff --git a/fpga_interchange/examples/chipdb.cmake b/fpga_interchange/examples/chipdb.cmake
index 5f1e4a67..81cc01f9 100644
--- a/fpga_interchange/examples/chipdb.cmake
+++ b/fpga_interchange/examples/chipdb.cmake
@@ -1,6 +1,6 @@
function(create_rapidwright_device_db)
set(options)
- set(oneValueArgs part)
+ set(oneValueArgs device part)
set(multiValueArgs)
cmake_parse_arguments(
@@ -11,6 +11,7 @@ function(create_rapidwright_device_db)
${ARGN}
)
+ set(device ${create_rapidwright_device_db_device})
set(part ${create_rapidwright_device_db_part})
set(rapidwright_device_db ${CMAKE_CURRENT_BINARY_DIR}/${part}.device)
add_custom_command(
@@ -24,35 +25,32 @@ function(create_rapidwright_device_db)
${RAPIDWRIGHT_PATH}/scripts/invoke_rapidwright.sh
)
- add_custom_target(rapidwright-${part}-device DEPENDS ${rapidwright_device_db})
- set_property(TARGET rapidwright-${part}-device PROPERTY LOCATION ${rapidwright_device_db})
+ add_custom_target(rapidwright-${device}-device DEPENDS ${rapidwright_device_db})
+ set_property(TARGET rapidwright-${device}-device PROPERTY LOCATION ${rapidwright_device_db})
endfunction()
-function(generate_chipdb)
+function(create_patched_device_db)
set(options)
- set(oneValueArgs part)
+ set(oneValueArgs device)
set(multiValueArgs)
cmake_parse_arguments(
- generate_chipdb
+ create_patched_device_db
"${options}"
"${oneValueArgs}"
"${multiValueArgs}"
${ARGN}
)
- set(part ${generate_chipdb_part})
-
- create_rapidwright_device_db(part ${part})
+ set(device ${create_patched_device_db_device})
- set(rapidwright_device_target rapidwright-${part}-device)
- get_property(rapidwright_device_loc TARGET ${rapidwright_device_target} PROPERTY LOCATION)
+ get_property(rapidwright_device_loc TARGET rapidwright-${device}-device PROPERTY LOCATION)
- set(constraints_device ${CMAKE_CURRENT_BINARY_DIR}/${part}_constraints.device)
+ set(constraints_device ${CMAKE_CURRENT_BINARY_DIR}/${device}_constraints.device)
add_custom_command(
OUTPUT ${constraints_device}
COMMAND
- python3 -mfpga_interchange.patch
+ ${PYTHON_EXECUTABLE} -mfpga_interchange.patch
--schema_dir ${INTERCHANGE_SCHEMA_PATH}
--schema device
--patch_path constraints
@@ -61,16 +59,16 @@ function(generate_chipdb)
${PYTHON_INTERCHANGE_PATH}/test_data/series7_constraints.yaml
${constraints_device}
DEPENDS
- ${rapidwright_device_target}
+ rapidwright-${device}-device
)
- add_custom_target(constraints-${part}-device DEPENDS ${constraints_device})
+ add_custom_target(constraints-${device}-device DEPENDS ${constraints_device})
- set(constraints_luts_device ${CMAKE_CURRENT_BINARY_DIR}/${part}_constraints_luts.device)
+ set(constraints_luts_device ${CMAKE_CURRENT_BINARY_DIR}/${device}_constraints_luts.device)
add_custom_command(
OUTPUT ${constraints_luts_device}
COMMAND
- python3 -mfpga_interchange.patch
+ ${PYTHON_EXECUTABLE} -mfpga_interchange.patch
--schema_dir ${INTERCHANGE_SCHEMA_PATH}
--schema device
--patch_path lutDefinitions
@@ -82,26 +80,50 @@ function(generate_chipdb)
${constraints_device}
)
- add_custom_target(constraints-luts-${part}-device DEPENDS ${constraints_luts_device})
- set_property(TARGET constraints-luts-${part}-device PROPERTY LOCATION ${constraints_luts_device})
+ add_custom_target(constraints-luts-${device}-device DEPENDS ${constraints_luts_device})
+ set_property(TARGET constraints-luts-${device}-device PROPERTY LOCATION ${constraints_luts_device})
+endfunction()
+
+function(generate_chipdb)
+ set(options)
+ set(oneValueArgs device part)
+ set(multiValueArgs)
+
+ cmake_parse_arguments(
+ generate_chipdb
+ "${options}"
+ "${oneValueArgs}"
+ "${multiValueArgs}"
+ ${ARGN}
+ )
+
+ set(device ${generate_chipdb_device})
+ set(part ${generate_chipdb_part})
+
+ create_rapidwright_device_db(
+ device ${device}
+ part ${part}
+ )
+ create_patched_device_db(device ${device})
- set(chipdb_bba ${chipdb_dir}/chipdb-${part}.bba)
+ get_property(constrained_luts_device_loc TARGET constraints-luts-${device}-device PROPERTY LOCATION)
+ set(chipdb_bba ${chipdb_dir}/chipdb-${device}.bba)
add_custom_command(
OUTPUT ${chipdb_bba}
COMMAND
- python3 -mfpga_interchange.nextpnr_emit
+ ${PYTHON_EXECUTABLE} -mfpga_interchange.nextpnr_emit
--schema_dir ${INTERCHANGE_SCHEMA_PATH}
- --output_dir ${chipdb_dir}
+ --output_dir ${CMAKE_CURRENT_BINARY_DIR}
--bel_bucket_seeds ${PYTHON_INTERCHANGE_PATH}/test_data/series7_bel_buckets.yaml
- --device ${constraints_luts_device}
+ --device ${constrained_luts_device_loc}
COMMAND
- mv ${chipdb_dir}/chipdb.bba ${chipdb_bba}
+ mv ${CMAKE_CURRENT_BINARY_DIR}/chipdb.bba ${chipdb_bba}
DEPENDS
- ${constraints_luts_device}
+ constraints-luts-${device}-device
)
- add_custom_target(chipdb-${part}-bba DEPENDS ${chipdb_bba})
- add_dependencies(chipdb-${family}-bbas chipdb-${part}-bba)
+ add_custom_target(chipdb-${device}-bba DEPENDS ${chipdb_bba})
+ add_dependencies(chipdb-${family}-bbas chipdb-${device}-bba)
endfunction()
set(chipdb_dir ${CMAKE_CURRENT_BINARY_DIR}/${family}/chipdb)