diff --git a/.github/workflows/interchange_ci.yml b/.github/workflows/interchange_ci.yml index 2c939d0e6d..3103646543 100644 --- a/.github/workflows/interchange_ci.yml +++ b/.github/workflows/interchange_ci.yml @@ -108,7 +108,7 @@ jobs: env: RAPIDWRIGHT_PATH: ${{ github.workspace }}/RapidWright PYTHON_INTERCHANGE_PATH: ${{ github.workspace }}/python-fpga-interchange - PYTHON_INTERCHANGE_TAG: v0.0.7 + PYTHON_INTERCHANGE_TAG: v0.0.9 PRJOXIDE_REVISION: a85135648c3ef2f7b3fd53ae2187ef6460e34b16 DEVICE: ${{ matrix.device }} run: | diff --git a/fpga_interchange/examples/boards.cmake b/fpga_interchange/examples/boards.cmake index c44ab93090..3639080b7b 100644 --- a/fpga_interchange/examples/boards.cmake +++ b/fpga_interchange/examples/boards.cmake @@ -2,6 +2,7 @@ function(add_board) # ~~~ # add_board( # name + # device_family # device # package # ) @@ -12,6 +13,8 @@ function(add_board) # # Arguments: # - name: name of the board. E.g. arty + # - device_family: the name of the family this device belongs to. + # E.g. the xc7a35t device belongs to the xc7 family # - device: common device name of a set of parts. E.g. xc7a35tcsg324-1 and xc7a35tcpg236-1 # share the same xc7a35t device prefix # - package: one of the packages available for a given device. E.g. cpg236 @@ -20,7 +23,7 @@ function(add_board) # - board- set(options) - set(oneValueArgs name device package) + set(oneValueArgs name device_family device package) set(multiValueArgs) cmake_parse_arguments( @@ -32,6 +35,7 @@ function(add_board) ) set(name ${add_board_name}) + set(device_family ${add_board_device_family}) set(device ${add_board_device}) set(package ${add_board_package}) @@ -39,6 +43,7 @@ function(add_board) set_target_properties( board-${name} PROPERTIES + DEVICE_FAMILY ${device_family} DEVICE ${device} PACKAGE ${package} ) diff --git a/fpga_interchange/examples/boards/CMakeLists.txt b/fpga_interchange/examples/boards/CMakeLists.txt index 18c8f96bb9..89951058ae 100644 --- a/fpga_interchange/examples/boards/CMakeLists.txt +++ b/fpga_interchange/examples/boards/CMakeLists.txt @@ -1,29 +1,34 @@ add_board( name arty35t + device_family xc7 device xc7a35t package csg324 ) add_board( name arty100t + device_family xc7 device xc7a100t package csg324 ) add_board( name nexys_video + device_family xc7 device xc7a200t package sbg484 ) add_board( name basys3 + device_family xc7 device xc7a35t package cpg236 ) add_board( name zybo + device_family xc7 device xc7z010 package clg400 ) diff --git a/fpga_interchange/examples/tests.cmake b/fpga_interchange/examples/tests.cmake index 8614872991..a5c31d6ffe 100644 --- a/fpga_interchange/examples/tests.cmake +++ b/fpga_interchange/examples/tests.cmake @@ -10,6 +10,8 @@ function(add_interchange_test) # sources # [top ] # [techmap ] + # [output_fasm] + # [device_family ] # ) # # Generates targets to run desired tests @@ -18,6 +20,8 @@ function(add_interchange_test) # - name: test name. This must be unique and no other tests with the same # name should exist # - family: nextpnr architecture family (e.g. fpga_interchange) + # - device_family: common device name of a set of parts. E.g. xc7a35tcsg324-1 and xc7a35tcpg236-1 + # share the same xc7a35t device prefix # - device: common device name of a set of parts. E.g. xc7a35tcsg324-1 and xc7a35tcpg236-1 # share the same xc7a35t device prefix # - package: package among the ones available for the device @@ -27,6 +31,9 @@ function(add_interchange_test) # - top (optional): name of the top level module. # If not provided, "top" is assigned as top level module # - techmap (optional): techmap file used during synthesis + # - output_fasm (optional): generates a fasm output + # - device_family (optional): this information is used during FASM generation, therfore it is + # required only if the `output_fasm` option is enabled # # Targets generated: # - test-fpga_interchange--json : synthesis output @@ -34,8 +41,8 @@ function(add_interchange_test) # - test-fpga_interchange--phys : interchange physical netlist # - test-fpga_interchange--dcp : design checkpoint with RapidWright - set(options skip_dcp) - set(oneValueArgs name family device package tcl xdc top techmap) + set(options skip_dcp output_fasm) + set(oneValueArgs name family device package tcl xdc top techmap device_family) set(multiValueArgs sources) cmake_parse_arguments( @@ -51,10 +58,12 @@ function(add_interchange_test) set(device ${add_interchange_test_device}) set(package ${add_interchange_test_package}) set(skip_dcp ${add_interchange_test_skip_dcp}) + set(output_fasm ${add_interchange_test_output_fasm}) set(top ${add_interchange_test_top}) set(tcl ${CMAKE_CURRENT_SOURCE_DIR}/${add_interchange_test_tcl}) set(xdc ${CMAKE_CURRENT_SOURCE_DIR}/${add_interchange_test_xdc}) set(techmap ${CMAKE_CURRENT_SOURCE_DIR}/${add_interchange_test_techmap}) + set(device_family ${add_interchange_test_device_family}) set(sources) foreach(source ${add_interchange_test_sources}) @@ -247,9 +256,9 @@ function(add_interchange_test) add_custom_target(test-${family}-${name}-phys-yaml DEPENDS ${phys_yaml}) + set(last_target "") if(skip_dcp) - add_dependencies(all-${family}-tests test-${family}-${name}-phys-yaml) - add_dependencies(all-${device}-tests test-${family}-${name}-phys-yaml) + set(last_target test-${family}-${name}-phys) else() set(dcp ${CMAKE_CURRENT_BINARY_DIR}/${name}.dcp) add_custom_command( @@ -266,8 +275,38 @@ function(add_interchange_test) ) add_custom_target(test-${family}-${name}-dcp DEPENDS ${dcp}) - add_dependencies(all-${family}-tests test-${family}-${name}-dcp) - add_dependencies(all-${device}-tests test-${family}-${name}-dcp) + set(last_target test-${family}-${name}-dcp) + endif() + + add_dependencies(all-${device}-tests ${last_target}) + add_dependencies(all-${family}-tests ${last_target}) + + if(output_fasm) + if(NOT DEFINED device_family) + message(FATAL_ERROR "If FASM output is enabled, the device family must be provided as well!") + endif() + + # Output FASM target + set(fasm ${CMAKE_CURRENT_BINARY_DIR}/${name}.fasm) + add_custom_command( + OUTPUT ${fasm} + COMMAND + ${PYTHON_EXECUTABLE} -mfpga_interchange.fasm_generator + --schema_dir ${INTERCHANGE_SCHEMA_PATH} + --family ${device_family} + ${device_loc} + ${netlist} + ${phys} + ${fasm} + DEPENDS + ${device_target} + ${netlist} + ${phys} + ) + + add_custom_target(test-${family}-${name}-fasm DEPENDS ${fasm} ${last_target}) + add_dependencies(all-${device}-tests test-${family}-${name}-fasm) + add_dependencies(all-${family}-tests test-${family}-${name}-fasm) endif() endfunction() @@ -301,7 +340,7 @@ function(add_interchange_group_test) # Note: it is assumed that there exists an XDC file for each board, with the following naming # convention: .xdc - set(options) + set(options output_fasm) set(oneValueArgs name family tcl top techmap) set(multiValueArgs sources board_list) @@ -319,6 +358,13 @@ function(add_interchange_group_test) set(tcl ${add_interchange_group_test_tcl}) set(techmap ${add_interchange_group_test_techmap}) set(sources ${add_interchange_group_test_sources}) + set(output_fasm ${add_interchange_group_test_output_fasm}) + + set(output_fasm_arg "") + if(output_fasm) + set(output_fasm_arg "output_fasm") + endif() + if (NOT DEFINED top) # Setting default top value @@ -326,6 +372,7 @@ function(add_interchange_group_test) endif() foreach(board ${add_interchange_group_test_board_list}) + get_property(device_family TARGET board-${board} PROPERTY DEVICE_FAMILY) get_property(device TARGET board-${board} PROPERTY DEVICE) get_property(package TARGET board-${board} PROPERTY PACKAGE) @@ -333,12 +380,14 @@ function(add_interchange_group_test) name ${name}_${board} family ${family} device ${device} + device_family ${device_family} package ${package} tcl ${tcl} xdc ${board}.xdc sources ${sources} top ${top} techmap ${techmap} + ${output_fasm_arg} ) endforeach() endfunction() diff --git a/fpga_interchange/examples/tests/const_wire/CMakeLists.txt b/fpga_interchange/examples/tests/const_wire/CMakeLists.txt index ba013e47d9..3fff5fbbd3 100644 --- a/fpga_interchange/examples/tests/const_wire/CMakeLists.txt +++ b/fpga_interchange/examples/tests/const_wire/CMakeLists.txt @@ -1,19 +1,7 @@ -add_interchange_test( - name const_wire_basys3 +add_interchange_group_test( + name const_wire family ${family} - device xc7a35t - package cpg236 + board_list basys3 arty35t arty100t tcl run.tcl - xdc wire_basys3.xdc - sources wire.v -) - -add_interchange_test( - name const_wire_arty - family ${family} - device xc7a35t - package csg324 - tcl run.tcl - xdc wire_arty.xdc sources wire.v ) diff --git a/fpga_interchange/examples/tests/const_wire/wire_arty.xdc b/fpga_interchange/examples/tests/const_wire/arty100t.xdc similarity index 52% rename from fpga_interchange/examples/tests/const_wire/wire_arty.xdc rename to fpga_interchange/examples/tests/const_wire/arty100t.xdc index 0d96fc45ae..a6e69de507 100644 --- a/fpga_interchange/examples/tests/const_wire/wire_arty.xdc +++ b/fpga_interchange/examples/tests/const_wire/arty100t.xdc @@ -1,7 +1,7 @@ -set_property PACKAGE_PIN N15 [get_ports o] -set_property PACKAGE_PIN N16 [get_ports o2] -set_property PACKAGE_PIN P17 [get_ports o3] -set_property PACKAGE_PIN R17 [get_ports o4] +set_property PACKAGE_PIN H5 [get_ports o] +set_property PACKAGE_PIN J5 [get_ports o2] +set_property PACKAGE_PIN T9 [get_ports o3] +set_property PACKAGE_PIN T10 [get_ports o4] set_property IOSTANDARD LVCMOS33 [get_ports o] set_property IOSTANDARD LVCMOS33 [get_ports o2] diff --git a/fpga_interchange/examples/tests/const_wire/arty35t.xdc b/fpga_interchange/examples/tests/const_wire/arty35t.xdc new file mode 100644 index 0000000000..a6e69de507 --- /dev/null +++ b/fpga_interchange/examples/tests/const_wire/arty35t.xdc @@ -0,0 +1,9 @@ +set_property PACKAGE_PIN H5 [get_ports o] +set_property PACKAGE_PIN J5 [get_ports o2] +set_property PACKAGE_PIN T9 [get_ports o3] +set_property PACKAGE_PIN T10 [get_ports o4] + +set_property IOSTANDARD LVCMOS33 [get_ports o] +set_property IOSTANDARD LVCMOS33 [get_ports o2] +set_property IOSTANDARD LVCMOS33 [get_ports o3] +set_property IOSTANDARD LVCMOS33 [get_ports o4] diff --git a/fpga_interchange/examples/tests/const_wire/wire_basys3.xdc b/fpga_interchange/examples/tests/const_wire/basys3.xdc similarity index 100% rename from fpga_interchange/examples/tests/const_wire/wire_basys3.xdc rename to fpga_interchange/examples/tests/const_wire/basys3.xdc diff --git a/fpga_interchange/examples/tests/counter/CMakeLists.txt b/fpga_interchange/examples/tests/counter/CMakeLists.txt index 2f1509c273..38c104ff6d 100644 --- a/fpga_interchange/examples/tests/counter/CMakeLists.txt +++ b/fpga_interchange/examples/tests/counter/CMakeLists.txt @@ -1,8 +1,9 @@ add_interchange_group_test( name counter family ${family} - board_list basys3 arty35t arty100t + board_list basys3 arty35t arty100t zybo tcl run.tcl sources counter.v techmap ../../remap.v + output_fasm ) diff --git a/fpga_interchange/examples/tests/counter/zybo.xdc b/fpga_interchange/examples/tests/counter/zybo.xdc new file mode 100644 index 0000000000..e7764d527b --- /dev/null +++ b/fpga_interchange/examples/tests/counter/zybo.xdc @@ -0,0 +1,14 @@ +# zybo board +set_property PACKAGE_PIN K17 [get_ports clk] +set_property PACKAGE_PIN K18 [get_ports rst] +set_property PACKAGE_PIN M14 [get_ports io_led[4]] +set_property PACKAGE_PIN M15 [get_ports io_led[5]] +set_property PACKAGE_PIN G14 [get_ports io_led[6]] +set_property PACKAGE_PIN D18 [get_ports io_led[7]] + +set_property IOSTANDARD LVCMOS33 [get_ports clk] +set_property IOSTANDARD LVCMOS33 [get_ports rst] +set_property IOSTANDARD LVCMOS33 [get_ports io_led[4]] +set_property IOSTANDARD LVCMOS33 [get_ports io_led[5]] +set_property IOSTANDARD LVCMOS33 [get_ports io_led[6]] +set_property IOSTANDARD LVCMOS33 [get_ports io_led[7]] diff --git a/fpga_interchange/examples/tests/ff/CMakeLists.txt b/fpga_interchange/examples/tests/ff/CMakeLists.txt index ccf16d44b6..e119b7c3db 100644 --- a/fpga_interchange/examples/tests/ff/CMakeLists.txt +++ b/fpga_interchange/examples/tests/ff/CMakeLists.txt @@ -1,19 +1,8 @@ -add_interchange_test( - name ff_basys3 +add_interchange_group_test( + name ff family ${family} - device xc7a35t - package cpg236 + board_list basys3 arty35t arty100t tcl run.tcl - xdc ff_basys3.xdc - sources ff.v -) - -add_interchange_test( - name ff_arty - family ${family} - device xc7a35t - package csg324 - tcl run.tcl - xdc ff_arty.xdc sources ff.v + output_fasm ) diff --git a/fpga_interchange/examples/tests/ff/ff_arty.xdc b/fpga_interchange/examples/tests/ff/arty100t.xdc similarity index 52% rename from fpga_interchange/examples/tests/ff/ff_arty.xdc rename to fpga_interchange/examples/tests/ff/arty100t.xdc index 3c132f1d1e..29456f2a43 100644 --- a/fpga_interchange/examples/tests/ff/ff_arty.xdc +++ b/fpga_interchange/examples/tests/ff/arty100t.xdc @@ -1,7 +1,7 @@ -set_property PACKAGE_PIN P17 [get_ports clk] -set_property PACKAGE_PIN N15 [get_ports d] -set_property PACKAGE_PIN N16 [get_ports r] -set_property PACKAGE_PIN M17 [get_ports q] +set_property PACKAGE_PIN E3 [get_ports clk] +set_property PACKAGE_PIN A8 [get_ports d] +set_property PACKAGE_PIN D9 [get_ports r] +set_property PACKAGE_PIN H5 [get_ports q] set_property IOSTANDARD LVCMOS33 [get_ports clk] set_property IOSTANDARD LVCMOS33 [get_ports d] diff --git a/fpga_interchange/examples/tests/ff/arty35t.xdc b/fpga_interchange/examples/tests/ff/arty35t.xdc new file mode 100644 index 0000000000..29456f2a43 --- /dev/null +++ b/fpga_interchange/examples/tests/ff/arty35t.xdc @@ -0,0 +1,9 @@ +set_property PACKAGE_PIN E3 [get_ports clk] +set_property PACKAGE_PIN A8 [get_ports d] +set_property PACKAGE_PIN D9 [get_ports r] +set_property PACKAGE_PIN H5 [get_ports q] + +set_property IOSTANDARD LVCMOS33 [get_ports clk] +set_property IOSTANDARD LVCMOS33 [get_ports d] +set_property IOSTANDARD LVCMOS33 [get_ports r] +set_property IOSTANDARD LVCMOS33 [get_ports q] diff --git a/fpga_interchange/examples/tests/ff/ff_basys3.xdc b/fpga_interchange/examples/tests/ff/basys3.xdc similarity index 100% rename from fpga_interchange/examples/tests/ff/ff_basys3.xdc rename to fpga_interchange/examples/tests/ff/basys3.xdc diff --git a/fpga_interchange/examples/tests/lut/CMakeLists.txt b/fpga_interchange/examples/tests/lut/CMakeLists.txt index f5503f71b9..77a4b4da99 100644 --- a/fpga_interchange/examples/tests/lut/CMakeLists.txt +++ b/fpga_interchange/examples/tests/lut/CMakeLists.txt @@ -1,19 +1,8 @@ -add_interchange_test( - name lut_basys3 +add_interchange_group_test( + name lut family ${family} - device xc7a35t - package cpg236 + board_list basys3 arty35t arty100t tcl run.tcl - xdc lut_basys3.xdc - sources lut.v -) - -add_interchange_test( - name lut_arty - family ${family} - device xc7a35t - package csg324 - tcl run.tcl - xdc lut_arty.xdc sources lut.v + output_fasm ) diff --git a/fpga_interchange/examples/tests/lut/lut_arty.xdc b/fpga_interchange/examples/tests/lut/arty100t.xdc similarity index 52% rename from fpga_interchange/examples/tests/lut/lut_arty.xdc rename to fpga_interchange/examples/tests/lut/arty100t.xdc index 4f390f25e1..1dba65740c 100644 --- a/fpga_interchange/examples/tests/lut/lut_arty.xdc +++ b/fpga_interchange/examples/tests/lut/arty100t.xdc @@ -1,6 +1,6 @@ -set_property PACKAGE_PIN N16 [get_ports i0] -set_property PACKAGE_PIN N15 [get_ports i1] -set_property PACKAGE_PIN M17 [get_ports o] +set_property PACKAGE_PIN A8 [get_ports i0] +set_property PACKAGE_PIN C11 [get_ports i1] +set_property PACKAGE_PIN H5 [get_ports o] set_property IOSTANDARD LVCMOS33 [get_ports i0] set_property IOSTANDARD LVCMOS33 [get_ports i1] diff --git a/fpga_interchange/examples/tests/lut/arty35t.xdc b/fpga_interchange/examples/tests/lut/arty35t.xdc new file mode 100644 index 0000000000..1dba65740c --- /dev/null +++ b/fpga_interchange/examples/tests/lut/arty35t.xdc @@ -0,0 +1,7 @@ +set_property PACKAGE_PIN A8 [get_ports i0] +set_property PACKAGE_PIN C11 [get_ports i1] +set_property PACKAGE_PIN H5 [get_ports o] + +set_property IOSTANDARD LVCMOS33 [get_ports i0] +set_property IOSTANDARD LVCMOS33 [get_ports i1] +set_property IOSTANDARD LVCMOS33 [get_ports o] diff --git a/fpga_interchange/examples/tests/lut/lut_basys3.xdc b/fpga_interchange/examples/tests/lut/basys3.xdc similarity index 100% rename from fpga_interchange/examples/tests/lut/lut_basys3.xdc rename to fpga_interchange/examples/tests/lut/basys3.xdc diff --git a/fpga_interchange/examples/tests/ram/CMakeLists.txt b/fpga_interchange/examples/tests/ram/CMakeLists.txt index 4625edb311..56db487011 100644 --- a/fpga_interchange/examples/tests/ram/CMakeLists.txt +++ b/fpga_interchange/examples/tests/ram/CMakeLists.txt @@ -1,10 +1,8 @@ -add_interchange_test( - name ram_basys3 +add_interchange_group_test( + name ram family ${family} - device xc7a35t - package cpg236 + board_list basys3 tcl run.tcl - xdc basys3.xdc sources ram.v ) diff --git a/fpga_interchange/examples/tests/wire/CMakeLists.txt b/fpga_interchange/examples/tests/wire/CMakeLists.txt index 7b6567ae97..6308a6e920 100644 --- a/fpga_interchange/examples/tests/wire/CMakeLists.txt +++ b/fpga_interchange/examples/tests/wire/CMakeLists.txt @@ -4,4 +4,5 @@ add_interchange_group_test( board_list basys3 arty35t zybo arty100t nexys_video tcl run.tcl sources wire.v + output_fasm ) diff --git a/fpga_interchange/family.cmake b/fpga_interchange/family.cmake index fdfa700461..14d86563e4 100644 --- a/fpga_interchange/family.cmake +++ b/fpga_interchange/family.cmake @@ -24,6 +24,7 @@ set(chipdb_dir ${CMAKE_CURRENT_BINARY_DIR}/${family}/chipdb) file(MAKE_DIRECTORY ${chipdb_dir}) add_custom_target(all-${family}-tests) +add_custom_target(all-${family}-fasm) add_custom_target(all-${family}-archcheck-tests) add_subdirectory(${family}/examples/devices) add_subdirectory(${family}/examples/boards)