f4pga / f4pga-arch-defs

FOSS architecture definitions of FPGA hardware useful for doing PnR device generation.
https://f4pga.org
ISC License
273 stars 113 forks source link

Need help adding support for Spartan-7 board to arch-defs #2372

Open MidsummerNight opened 2 years ago

MidsummerNight commented 2 years ago

Hi there,

Since the prjxray-db of Spartan-7 was generated last month, I've been trying to add support for Spartan-7 to arch-defs. Following @acomodi's instructions, I add directories and files for Spartan-7, along with a simple blinking LED test targeting the Alinx AX7050 board (which carries the xc7s50fgga484-1 part). Both the HDL source code and XDC constraint file have been successfully implemented in Vivado and runs correctly on the board, so no problems there.

I successfully ran make build and found build/xc/xc7/tests/counter/Makefile indeed has the counter_ax7050_bit target. However, when I ran make counter_ax7050_bit, I got an error saying No rule to make target xc/xc7/tests/common/counter_ax7050.xdc that was needed to create top_synth.json. Upon further inspection, I found that the recipe for counter_ax7050_bit.dir/all in Makefile2 somehow does not include counter_ax7050.xdc. I wrote the CMakeLists.txt for tests/counter like this. Did I write it correctly? Or did something else cause my XDC file to not be in the recipe?

Thanks!

MidsummerNight commented 2 years ago

What is INPUT_XDC_FILES for? Should I use INPUT_IO_FILE instead? And why does INPUT_XDC_FILES always comes with INPUT_IO_FILE in the existing targets?

mithro commented 2 years ago

@acomodi / @kgugala - Can you help here?

MidsummerNight commented 2 years ago

The recipe for counter_ax7050_bit of the Makefile2 looks like this. You can see the XDC file is not included, as opposed to targets like counter_arty_bit.

# Target rules for target xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir

# All Build rule for target.
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/CMakeFiles/file_xc_xc7_ax7050_pinmap.csv.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/archs/artix7/CMakeFiles/file_env_conda_envs_symbiflow_arch_def_base_share_yosys_xilinx_cells_sim.v.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/archs/artix7/CMakeFiles/file_xc_xc7_techmap_cells_sim.v.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/archs/spartan7/devices/CMakeFiles/file_xc_xc7_archs_spartan7_devices_rr_graph_xc7s50_test.lookahead.bin.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/archs/spartan7/devices/CMakeFiles/file_xc_xc7_archs_spartan7_devices_rr_graph_xc7s50_test.place_delay.bin.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/archs/spartan7/devices/CMakeFiles/file_xc_xc7_archs_spartan7_devices_rr_graph_xc7s50_test.rr_graph.real.bin.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/archs/spartan7/devices/xc7s50-virt/CMakeFiles/file_xc_xc7_archs_spartan7_devices_xc7s50-virt_arch.timing.xml.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/tests/counter/CMakeFiles/file_xc_xc7_tests_counter_counter_ax7050.v.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/tests/counter/CMakeFiles/file_xc_xc7_tests_counter_counter_ax7050_spartan7-xc7s50-virt-xc7s50-test_top.eblif.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/tests/counter/CMakeFiles/file_xc_xc7_tests_counter_counter_ax7050_spartan7-xc7s50-virt-xc7s50-test_top_synth.sdc.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/tests/counter/CMakeFiles/file_xc_xc7_tests_counter_counter_ax7050_spartan7-xc7s50-virt-xc7s50-test_top.net.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/tests/counter/CMakeFiles/file_xc_xc7_tests_counter_counter_ax7050_spartan7-xc7s50-virt-xc7s50-test_top_io.place.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/tests/counter/CMakeFiles/file_xc_xc7_tests_counter_counter_ax7050_spartan7-xc7s50-virt-xc7s50-test_top_constraints.place.dir/all
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all: xc/xc7/tests/counter/CMakeFiles/file_xc_xc7_tests_counter_counter_ax7050_spartan7-xc7s50-virt-xc7s50-test_top.fasm.dir/all
    $(MAKE) $(MAKESILENT) -f xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/build.make xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/depend
    $(MAKE) $(MAKESILENT) -f xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/build.make xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/build
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/lbh/arch-defs-s7/symbiflow-arch-defs/build/CMakeFiles --progress-num= "Built target counter_ax7050_bit"
.PHONY : xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all

# Build rule for subdir invocation for target.
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/rule: cmake_check_build_system
    $(CMAKE_COMMAND) -E cmake_progress_start /home/lbh/arch-defs-s7/symbiflow-arch-defs/build/CMakeFiles 2
    $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/all
    $(CMAKE_COMMAND) -E cmake_progress_start /home/lbh/arch-defs-s7/symbiflow-arch-defs/build/CMakeFiles 0
.PHONY : xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/rule

# Convenience name for target.
counter_ax7050_bit: xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/rule
.PHONY : counter_ax7050_bit

# clean rule for target.
xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/clean:
    $(MAKE) $(MAKESILENT) -f xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/build.make xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/clean
.PHONY : xc/xc7/tests/counter/CMakeFiles/counter_ax7050_bit.dir/clean

#=============================================================================

Recipes for the XDC files does exist in Makefile2 though, just not invoked by counter_ax7050_bit:

# Target rules for target xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir

# All Build rule for target.
xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/all:
    $(MAKE) $(MAKESILENT) -f xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/build.make xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/depend
    $(MAKE) $(MAKESILENT) -f xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/build.make xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/build
    @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/lbh/arch-defs-s7/symbiflow-arch-defs/build/CMakeFiles --progress-num= "Built target file_xc_xc7_tests_common_counter_ax7050.xdc"
.PHONY : xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/all

# Build rule for subdir invocation for target.
xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/rule: cmake_check_build_system
    $(CMAKE_COMMAND) -E cmake_progress_start /home/lbh/arch-defs-s7/symbiflow-arch-defs/build/CMakeFiles 0
    $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/all
    $(CMAKE_COMMAND) -E cmake_progress_start /home/lbh/arch-defs-s7/symbiflow-arch-defs/build/CMakeFiles 0
.PHONY : xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/rule

# Convenience name for target.
file_xc_xc7_tests_common_counter_ax7050.xdc: xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/rule
.PHONY : file_xc_xc7_tests_common_counter_ax7050.xdc

# clean rule for target.
xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/clean:
    $(MAKE) $(MAKESILENT) -f xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/build.make xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/clean
.PHONY : xc/xc7/tests/common/CMakeFiles/file_xc_xc7_tests_common_counter_ax7050.xdc.dir/clean

#=============================================================================

I suppose I could manually add the XDC to counter_ax7050_bit's recipe, but it's obviously better to fix it from the source.

My work is in the add-spartan7-support branch of my arch-defs fork.

acomodi commented 2 years ago

Hi @MidsummerNight, thanks for the effort in adding support for the Spartan7 devices!

I suggest opening a PR with your WIP work, as it can run through CI, and is generally easier to understand the diffs.

Looking at your add-spartan7-support dev branch it seems that the counter_ax7050.xdc is not present in the common directory.

MidsummerNight commented 2 years ago

@acomodi Hi, but it's right here. Anyway I made the PR #2374 and let's see what needs to be done!

bl0x commented 1 year ago

@MidsummerNight I've got a board with an xc7s25 and could in principle help testing / adding to the support. However, I haven't worked with all the things yet, but I'm eager to learn =)

MidsummerNight commented 1 year ago

@bl0x Hi there, I haven't been active for the last year and thus can't recall all the details, so sorry for that. When I tried contributing to the project, the overall flow was:

  1. Obtain data of Xilinx 7-series parts via Project X-Ray
  2. Put the data obtained from Project X-Ray through the Architecture Definition (this repository) workflow. Ideally, in the end we should get a file named arch.timing.xml (architecture definition file), which as the name suggests, describes the architecture of the desired part in a way that the implementation tools (VPR was the target at the time) could understand, and now we have an open source toolchain for our chip.

Unfortunately I didn't succeed in generating the arch-def file for xc7s50. As for your case, well prjxray only supports Vivado 2017.2 so far, but 2017.2 doesn't support the xc7s25 chip you have. This means you cannot even start the arch-defs workflow for xc7s25 (since it requires data from prjxray in the first place). To the extent of my knowledge, 2 solutions lie ahead:

  1. Improve Project X-Ray so that it can use new Vivado versions (that support xc7s25). X-Ray is currently stuck to 2017.2 because of this issue. If you can help fix that, you should be able to prceed with arch-defs.
  2. For whatever reason X-Ray seems to have been in hiatus for a very long time. I think the devs are shifting focus to FPGA Interchange Formats. Never dived deep into this, but it seems like a method to extract the chips' architecture details with the help of a tool called RapidWright. Again I'm not clear on the details myself, though this might be useful.
MaksRawski commented 11 months ago

Doesn't #2658 solve this issue? If so I think this one could be closed.