fpga_interchange: add bbasm step and archcheck

Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
This commit is contained in:
Alessandro Comodi 2021-03-15 10:51:37 +01:00
parent 0b62e540a3
commit 3f3cabea2d
7 changed files with 78 additions and 41 deletions

View File

@ -1,23 +0,0 @@
include ../common.mk
PACKAGE := csg324
.PHONY: check check_test_data
check: check_test_data
$(NEXTPNR_BIN) \
--chipdb $(BBA_PATH) \
--package $(PACKAGE) \
--test
check_test_data:
$(NEXTPNR_BIN) \
--chipdb $(BBA_PATH) \
--package $(PACKAGE) \
--run $(NEXTPNR_PATH)/python/check_arch_api.py
debug_check_test_data:
gdb --args $(NEXTPNR_BIN) \
--chipdb $(BBA_PATH) \
--package $(PACKAGE) \
--run $(NEXTPNR_PATH)/python/check_arch_api.py

View File

@ -184,18 +184,24 @@ function(generate_chipdb)
# generate_chipdb( # generate_chipdb(
# device <common device> # device <common device>
# part <part> # part <part>
# device_target <device target>
# bel_bucket_seeds <bel bucket seeds>
# package <package>
# ) # )
# ~~~ # ~~~
# #
# Generates a chipdb BBA file, starting from a device database. # Generates a chipdb BBA file, starting from a device database.
# #
# The chipdb file is moved to the <nextpnr-root>/build/fpga_interchange/chipdb/ directory # The chipdb binary file is directly generated to the
# <nextpnr-root>/build/fpga_interchange/chipdb/ directory.
#
# The package argument is only used to run the architecture check target.
# #
# Targets generated: # Targets generated:
# - chipdb-<device>-bba # - chipdb-<device>-bba
set(options) set(options)
set(oneValueArgs device part device_target bel_bucket_seeds) set(oneValueArgs device part device_target bel_bucket_seeds package)
set(multiValueArgs) set(multiValueArgs)
cmake_parse_arguments( cmake_parse_arguments(
@ -210,13 +216,14 @@ function(generate_chipdb)
set(part ${generate_chipdb_part}) set(part ${generate_chipdb_part})
set(device_target ${generate_chipdb_device_target}) set(device_target ${generate_chipdb_device_target})
set(bel_bucket_seeds ${generate_chipdb_bel_bucket_seeds}) set(bel_bucket_seeds ${generate_chipdb_bel_bucket_seeds})
set(package ${generate_chipdb_package})
get_target_property(device_loc ${device_target} LOCATION) get_target_property(device_loc ${device_target} LOCATION)
set(chipdb_bba ${chipdb_dir}/chipdb-${device}.bba) set(chipdb_bba ${CMAKE_CURRENT_BINARY_DIR}/chipdb-${device}.bba)
add_custom_command( add_custom_command(
OUTPUT ${chipdb_bba} OUTPUT ${chipdb_bba}
COMMAND COMMAND
${PYTHON_EXECUTABLE} -mfpga_interchange.nextpnr_emit ${PYTHON_EXECUTABLE} -mfpga_interchange.nextpnr_emit
--schema_dir ${INTERCHANGE_SCHEMA_PATH} --schema_dir ${INTERCHANGE_SCHEMA_PATH}
--output_dir ${CMAKE_CURRENT_BINARY_DIR} --output_dir ${CMAKE_CURRENT_BINARY_DIR}
--bel_bucket_seeds ${bel_bucket_seeds} --bel_bucket_seeds ${bel_bucket_seeds}
@ -230,5 +237,54 @@ function(generate_chipdb)
) )
add_custom_target(chipdb-${device}-bba DEPENDS ${chipdb_bba}) add_custom_target(chipdb-${device}-bba DEPENDS ${chipdb_bba})
set(chipdb_bin ${chipdb_dir}/chipdb-${device}.bin)
add_custom_command(
OUTPUT ${chipdb_bin}
COMMAND
bbasm -l ${chipdb_bba} ${chipdb_bin}
DEPENDS
chipdb-${device}-bba
${chipdb_bba}
bbasm
)
add_custom_target(chipdb-${device}-bin DEPENDS ${chipdb_bin})
# Generate architecture check target
set(test_data_source ${CMAKE_CURRENT_SOURCE_DIR}/test_data.yaml)
set(test_data_binary ${CMAKE_CURRENT_BINARY_DIR}/test_data.yaml)
add_custom_command(
OUTPUT ${test_data_binary}
COMMAND
${CMAKE_COMMAND} -E create_symlink
${test_data_source}
${test_data_binary}
DEPENDS
${test_data_source}
)
add_custom_target(
chipdb-${device}-bin-check
COMMAND
nextpnr-fpga_interchange
--chipdb ${chipdb_bin}
--package ${package}
--test
DEPENDS
${chipdb_bin}
)
add_custom_target(
chipdb-${device}-bin-check-test-data
COMMAND
nextpnr-fpga_interchange
--chipdb ${chipdb_bin}
--package ${package}
--run ${root_dir}/python/check_arch_api.py
DEPENDS
${chipdb_bin}
${test_data_binary}
)
endfunction() endfunction()

View File

@ -1,11 +1 @@
generate_xc7_device_db( add_subdirectory(xc7a35t)
device xc7a35t
part xc7a35tcsg324-1
)
generate_chipdb(
device xc7a35t
part xc7a35tcsg324-1
device_target ${device_target}
bel_bucket_seeds ${PYTHON_INTERCHANGE_PATH}/test_data/series7_bel_buckets.yaml
)

View File

@ -0,0 +1,12 @@
generate_xc7_device_db(
device xc7a35t
part xc7a35tcsg324-1
)
generate_chipdb(
device xc7a35t
part xc7a35tcsg324-1
device_target ${device_target}
bel_bucket_seeds ${PYTHON_INTERCHANGE_PATH}/test_data/series7_bel_buckets.yaml
package csg324
)

View File

@ -82,7 +82,7 @@ function(add_interchange_test)
add_custom_target(test-${family}-${name}-netlist DEPENDS ${netlist}) add_custom_target(test-${family}-${name}-netlist DEPENDS ${netlist})
set(chipdb_target chipdb-${device}-bba) set(chipdb_target chipdb-${device}-bin)
# Physical Netlist # Physical Netlist
set(phys ${CMAKE_CURRENT_BINARY_DIR}/${name}.phys) set(phys ${CMAKE_CURRENT_BINARY_DIR}/${name}.phys)
@ -90,7 +90,7 @@ function(add_interchange_test)
OUTPUT ${phys} OUTPUT ${phys}
COMMAND COMMAND
nextpnr-fpga_interchange nextpnr-fpga_interchange
--chipdb ${chipdb_dir}/chipdb-${device}.bba --chipdb ${chipdb_dir}/chipdb-${device}.bin
--xdc ${xdc} --xdc ${xdc}
--netlist ${netlist} --netlist ${netlist}
--phys ${phys} --phys ${phys}
@ -98,7 +98,7 @@ function(add_interchange_test)
DEPENDS DEPENDS
${netlist} ${netlist}
${chipdb_target} ${chipdb_target}
${chipdb_dir}/chipdb-${device}.bba ${chipdb_dir}/chipdb-${device}.bin
) )
add_custom_target(test-${family}-${name}-phys DEPENDS ${phys}) add_custom_target(test-${family}-${name}-phys DEPENDS ${phys})

View File

@ -19,6 +19,8 @@ include(${family}/examples/tests.cmake)
set(chipdb_dir ${CMAKE_CURRENT_BINARY_DIR}/${family}/chipdb) set(chipdb_dir ${CMAKE_CURRENT_BINARY_DIR}/${family}/chipdb)
file(MAKE_DIRECTORY ${chipdb_dir}) file(MAKE_DIRECTORY ${chipdb_dir})
set(root_dir ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_target(all-${family}-tests) add_custom_target(all-${family}-tests)
add_subdirectory(${family}/examples/devices) add_subdirectory(${family}/examples/devices)
add_subdirectory(${family}/examples/tests) add_subdirectory(${family}/examples/tests)