diff options
| -rw-r--r-- | fpga_interchange/examples/chipdb.cmake | 131 | ||||
| -rw-r--r-- | fpga_interchange/examples/devices/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | fpga_interchange/family.cmake | 1 | 
3 files changed, 96 insertions, 41 deletions
diff --git a/fpga_interchange/examples/chipdb.cmake b/fpga_interchange/examples/chipdb.cmake index 81cc01f9..dbfcc249 100644 --- a/fpga_interchange/examples/chipdb.cmake +++ b/fpga_interchange/examples/chipdb.cmake @@ -1,4 +1,16 @@  function(create_rapidwright_device_db) +    # ~~~ +    # create_rapidwright_device_db( +    #    device <common device> +    #    part <part> +    # ) +    # ~~~ +    # +    # Generates a device database from RapidWright +    # +    # Targets generated: +    #   - rapidwright-<device>-device +      set(options)      set(oneValueArgs device part)      set(multiValueArgs) @@ -18,11 +30,11 @@ function(create_rapidwright_device_db)          OUTPUT ${rapidwright_device_db}          COMMAND              RAPIDWRIGHT_PATH=${RAPIDWRIGHT_PATH} -            ${RAPIDWRIGHT_PATH}/scripts/invoke_rapidwright.sh +            ${INVOKE_RAPIDWRIGHT}              com.xilinx.rapidwright.interchange.DeviceResourcesExample              ${part}          DEPENDS -            ${RAPIDWRIGHT_PATH}/scripts/invoke_rapidwright.sh +            ${INVOKE_RAPIDWRIGHT}      )      add_custom_target(rapidwright-${device}-device DEPENDS ${rapidwright_device_db}) @@ -30,8 +42,24 @@ function(create_rapidwright_device_db)  endfunction()  function(create_patched_device_db) +    # ~~~ +    # create_patched_device_db( +    #    device <common device> +    #    patch_name <patch_name> +    #    patch_path <patch_path> +    #    patch_format <patch_format> +    #    patch_data <patch_data> +    #    input_device <input_device target> +    # ) +    # ~~~ +    # +    # Generates a patched device database starting from an input device +    # +    # Targets generated: +    #   - <patch_name>-<device>-device +      set(options) -    set(oneValueArgs device) +    set(oneValueArgs device patch_name patch_path patch_format patch_data input_device)      set(multiValueArgs)      cmake_parse_arguments( @@ -43,50 +71,54 @@ function(create_patched_device_db)      )      set(device ${create_patched_device_db_device}) - -    get_property(rapidwright_device_loc TARGET rapidwright-${device}-device PROPERTY LOCATION) - -    set(constraints_device ${CMAKE_CURRENT_BINARY_DIR}/${device}_constraints.device) +    set(patch_name ${create_patched_device_db_patch_name}) +    set(patch_path ${create_patched_device_db_patch_path}) +    set(patch_format ${create_patched_device_db_patch_format}) +    set(patch_data ${create_patched_device_db_patch_data}) +    set(input_device ${create_patched_device_db_input_device}) + +    get_property(input_device_loc TARGET ${input_device} PROPERTY LOCATION) +    set(output_device_file ${CMAKE_CURRENT_BINARY_DIR}/${device}_${patch_name}.device)      add_custom_command( -        OUTPUT ${constraints_device} +        OUTPUT ${output_device_file}          COMMAND              ${PYTHON_EXECUTABLE} -mfpga_interchange.patch                  --schema_dir ${INTERCHANGE_SCHEMA_PATH}                  --schema device -                --patch_path constraints -                --patch_format yaml -                ${rapidwright_device_loc} -                ${PYTHON_INTERCHANGE_PATH}/test_data/series7_constraints.yaml -                ${constraints_device} +                --patch_path ${patch_path} +                --patch_format ${patch_format} +                ${input_device_loc} +                ${patch_data} +                ${output_device_file}          DEPENDS -            rapidwright-${device}-device +            ${input_device} +            ${input_device_loc}      ) -    add_custom_target(constraints-${device}-device DEPENDS ${constraints_device}) - -    set(constraints_luts_device ${CMAKE_CURRENT_BINARY_DIR}/${device}_constraints_luts.device) -    add_custom_command( -        OUTPUT ${constraints_luts_device} -        COMMAND -            ${PYTHON_EXECUTABLE} -mfpga_interchange.patch -                --schema_dir ${INTERCHANGE_SCHEMA_PATH} -                --schema device -                --patch_path lutDefinitions -                --patch_format yaml -                ${constraints_device} -                ${PYTHON_INTERCHANGE_PATH}/test_data/series7_luts.yaml -                ${constraints_luts_device} -        DEPENDS -            ${constraints_device} -    ) - -    add_custom_target(constraints-luts-${device}-device DEPENDS ${constraints_luts_device}) -    set_property(TARGET constraints-luts-${device}-device PROPERTY LOCATION ${constraints_luts_device}) +    add_custom_target(${patch_name}-${device}-device DEPENDS ${output_device_file}) +    set_property(TARGET ${patch_name}-${device}-device PROPERTY LOCATION ${output_device_file})  endfunction()  function(generate_chipdb) +    # ~~~ +    # create_patched_device_db( +    #    device <common device> +    #    part <part> +    # ) +    # ~~~ +    # +    # Generates a chipdb BBA file, starting from a RapidWright device database which is then patched. +    # Patches applied: +    #   - constraints patch +    #   - luts patch +    # +    # The chipdb file is moved to the <nextpnr-root>/build/fpga_interchange/chipdb/ directory +    # +    # Targets generated: +    #   - chipdb-<device>-bba +      set(options) -    set(oneValueArgs device part) +    set(oneValueArgs device part bel_bucket_seeds)      set(multiValueArgs)      cmake_parse_arguments( @@ -99,14 +131,34 @@ function(generate_chipdb)      set(device ${generate_chipdb_device})      set(part ${generate_chipdb_part}) +    set(bel_bucket_seeds ${generate_chipdb_bel_bucket_seeds})      create_rapidwright_device_db(          device ${device}          part ${part}      ) -    create_patched_device_db(device ${device}) -    get_property(constrained_luts_device_loc TARGET constraints-luts-${device}-device PROPERTY LOCATION) +    # Generate constraints patch +    create_patched_device_db( +        device ${device} +        patch_name constraints +        patch_path constraints +        patch_format yaml +        patch_data ${PYTHON_INTERCHANGE_PATH}/test_data/series7_constraints.yaml +        input_device rapidwright-${device}-device +    ) + +    # Generate lut constraints patch +    create_patched_device_db( +        device ${device} +        patch_name constraints-luts +        patch_path lutDefinitions +        patch_format yaml +        patch_data ${PYTHON_INTERCHANGE_PATH}/test_data/series7_luts.yaml +        input_device constraints-${device}-device +    ) + +    get_property(constraints_luts_device_loc TARGET constraints-luts-${device}-device PROPERTY LOCATION)      set(chipdb_bba ${chipdb_dir}/chipdb-${device}.bba)      add_custom_command(          OUTPUT ${chipdb_bba} @@ -114,12 +166,13 @@ function(generate_chipdb)             ${PYTHON_EXECUTABLE} -mfpga_interchange.nextpnr_emit                  --schema_dir ${INTERCHANGE_SCHEMA_PATH}                  --output_dir ${CMAKE_CURRENT_BINARY_DIR} -                --bel_bucket_seeds ${PYTHON_INTERCHANGE_PATH}/test_data/series7_bel_buckets.yaml -                --device ${constrained_luts_device_loc} +                --bel_bucket_seeds ${bel_bucket_seeds} +                --device ${constraints_luts_device_loc}          COMMAND              mv ${CMAKE_CURRENT_BINARY_DIR}/chipdb.bba ${chipdb_bba}          DEPENDS              constraints-luts-${device}-device +            ${constraints_luts_device_loc}      )      add_custom_target(chipdb-${device}-bba DEPENDS ${chipdb_bba}) diff --git a/fpga_interchange/examples/devices/CMakeLists.txt b/fpga_interchange/examples/devices/CMakeLists.txt index 8497484b..4bbd5802 100644 --- a/fpga_interchange/examples/devices/CMakeLists.txt +++ b/fpga_interchange/examples/devices/CMakeLists.txt @@ -1,4 +1,5 @@  generate_chipdb( -    device xc7a50t -    part xc7a50tfgg484-1 +    device xc7a35t +    part xc7a35tcsg324-1 +    bel_bucket_seeds ${PYTHON_INTERCHANGE_PATH}/test_data/series7_bel_buckets.yaml  ) diff --git a/fpga_interchange/family.cmake b/fpga_interchange/family.cmake index 112cb3dc..ec2d911e 100644 --- a/fpga_interchange/family.cmake +++ b/fpga_interchange/family.cmake @@ -6,6 +6,7 @@ endif()  find_package(ZLIB REQUIRED)  set(RAPIDWRIGHT_PATH $ENV{HOME}/RapidWright CACHE PATH "Path to RapidWright") +set(INVOKE_RAPIDWRIGHT ${RAPIDWRIGHT_PATH}/scripts/invoke_rapidwright.sh CACHE PATH "Path to RapidWright invocation script")  # FIXME: Make patch data available in the python package and remove this cached var  set(PYTHON_INTERCHANGE_PATH $ENV{HOME}/python-fpga-interchange CACHE PATH "Path to the FPGA interchange python library")  set(INTERCHANGE_SCHEMA_PATH $ENV{HOME}/fpga_interchange_schema CACHE PATH "Path to the FPGA interchange schema dir")  | 
