Using FuseSoC for automation

Topwrap uses the FuseSoC package manager and build tools for HDL code to automate project generation and the build process. When topwrap build is used with the --fuse option, it generates a FuseSoC .core file along with the top-level wrapper.

Default tool for synthesis, bitstream generation and programming the FPGA

Topwrap assumes that you’re using Vivado. You can change the default tool to something other than Vivado by modifying the generated .core file.

Additional build options

To enable .core file generation, supply the --fuse/-f flag to Topwrap build:

topwrap build -d design.yaml --fuse

If you have any additional directories with HDL sources or constraint files required for synthesis, you can specify them using the --sources/-s option. Sources from these directories get appended to the filesets.rtl.files entry in the generated FuseSoC .core file.

topwrap build -d design.yaml -f --sources ./srcs_v -s ./srcs_vhd

If you’re targeting a specific FPGA chip, you can additionally specify its number using the --part/-p option.

The supplied part number is passed to the FuseSoC .core file. It is included in the targets.default.tools.vivado.part entry, which is then supplied to Vivado when you run FuseSoC and use the default target. This can be any part number available to your local Vivado installation.

topwrap build -d design.yaml -f --part 'xc7z020clg400-3'

.core file template

A template for the .core file is bundled with Topwrap (templates/core.yaml.j2).

By default, topwrap.fuse_helper.FuseSocBuilder searches for the template file in working directory, meaning you must copy the template file into the project location. You may also need to edit the file to change the backend tool, add more targets, set additional Hooks and edit other parameters.

Synthesis

After generating the .core file, you can run FuseSoC to generate the bitstream and program the FPGA:

fusesoc --cores-root build run {design_name}

This requires having a suitable backend tool that is specified in the .core file under targets.default.tools available in your PATH (e.g. Vivado).


Last update: 2024-12-10