From 720f64ea6017fa3e42f80eba64cc615c64788914 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Tue, 23 Mar 2021 09:41:45 -0700 Subject: [FPGA interchange] Add support for global buffers from chipdb. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- fpga_interchange/arch.h | 14 +++++++++++++- fpga_interchange/chipdb.h | 9 +++++++-- fpga_interchange/examples/chipdb.cmake | 14 ++++++++------ fpga_interchange/examples/devices/xc7a35t/CMakeLists.txt | 2 +- 4 files changed, 29 insertions(+), 10 deletions(-) (limited to 'fpga_interchange') diff --git a/fpga_interchange/arch.h b/fpga_interchange/arch.h index 1f0eb80d..25f3dbfe 100644 --- a/fpga_interchange/arch.h +++ b/fpga_interchange/arch.h @@ -344,7 +344,19 @@ struct Arch : ArchAPI bool getBelGlobalBuf(BelId bel) const final { - // FIXME: This probably needs to be fixed! + auto &bel_data = bel_info(chip_info, bel); + IdString bel_name(bel_data.name); + + // Note: Check profiles and see if this should be something other than + // a linear scan. Expectation is that for most arches, this will be + // fast enough. + for (int32_t global_bel : chip_info->cell_map->global_buffers) { + IdString global_bel_name(global_bel); + if (bel_name == global_bel_name) { + return true; + } + } + return false; } diff --git a/fpga_interchange/chipdb.h b/fpga_interchange/chipdb.h index 5c9a9c52..d78e3b61 100644 --- a/fpga_interchange/chipdb.h +++ b/fpga_interchange/chipdb.h @@ -34,7 +34,7 @@ NEXTPNR_NAMESPACE_BEGIN * kExpectedChipInfoVersion */ -static constexpr int32_t kExpectedChipInfoVersion = 4; +static constexpr int32_t kExpectedChipInfoVersion = 5; // Flattened site indexing. // @@ -229,7 +229,12 @@ NPNR_PACKED_STRUCT(struct LutCellPOD { NPNR_PACKED_STRUCT(struct CellMapPOD { // Cell names supported in this arch. - RelSlice cell_names; // constids + RelSlice cell_names; // constids + + // BEL names that are global buffers. + RelSlice global_buffers; // constids + + // Name of BelBuckets. RelSlice cell_bel_buckets; // constids RelSlice cell_bel_map; diff --git a/fpga_interchange/examples/chipdb.cmake b/fpga_interchange/examples/chipdb.cmake index 676c8c77..986ae571 100644 --- a/fpga_interchange/examples/chipdb.cmake +++ b/fpga_interchange/examples/chipdb.cmake @@ -210,7 +210,7 @@ function(generate_chipdb) # device # part # device_target - # bel_bucket_seeds + # device_config # test_package # ) # ~~~ @@ -228,7 +228,9 @@ function(generate_chipdb) # share the same xc7a35t device prefix # - part: one among the parts available for a given device # - device_target: target for the device from which the chipdb is generated - # - bel_bucket_seeds: path to the bel bucket seeds YAML file + # - device_config: path to the device configYAML file + # This file specifies some nextpnr specific data, such as BEL bucket + # seeds and global BEL names. # - test_package: package among the ones available for the device. This is used for architecture # testing only # @@ -241,7 +243,7 @@ function(generate_chipdb) # as the binary chipdb set(options) - set(oneValueArgs family device part device_target bel_bucket_seeds test_package) + set(oneValueArgs family device part device_target device_config test_package) set(multiValueArgs) cmake_parse_arguments( @@ -256,7 +258,7 @@ function(generate_chipdb) set(device ${generate_chipdb_device}) set(part ${generate_chipdb_part}) set(device_target ${generate_chipdb_device_target}) - set(bel_bucket_seeds ${generate_chipdb_bel_bucket_seeds}) + set(device_config ${generate_chipdb_device_config}) set(test_package ${generate_chipdb_test_package}) get_target_property(device_loc ${device_target} LOCATION) @@ -267,10 +269,10 @@ function(generate_chipdb) ${PYTHON_EXECUTABLE} -mfpga_interchange.nextpnr_emit --schema_dir ${INTERCHANGE_SCHEMA_PATH} --output_dir ${CMAKE_CURRENT_BINARY_DIR} - --bel_bucket_seeds ${bel_bucket_seeds} + --device_config ${device_config} --device ${device_loc} DEPENDS - ${bel_bucket_seeds} + ${device_config} ${device_target} ${device_loc} ) diff --git a/fpga_interchange/examples/devices/xc7a35t/CMakeLists.txt b/fpga_interchange/examples/devices/xc7a35t/CMakeLists.txt index ce5d5d2d..636440c4 100644 --- a/fpga_interchange/examples/devices/xc7a35t/CMakeLists.txt +++ b/fpga_interchange/examples/devices/xc7a35t/CMakeLists.txt @@ -9,6 +9,6 @@ generate_chipdb( device xc7a35t part xc7a35tcsg324-1 device_target ${xc7a35t_target} - bel_bucket_seeds ${PYTHON_INTERCHANGE_PATH}/test_data/series7_bel_buckets.yaml + device_config ${PYTHON_INTERCHANGE_PATH}/test_data/series7_device_config.yaml test_package csg324 ) -- cgit v1.2.3