tsfpga.examples package

Subpackages

Submodules

tsfpga.examples.build_fpga module

tsfpga.examples.build_fpga.main() None

Main function for building FPGA projects. If you are setting up a new build flow from scratch, you probably want to copy and modify this function, and reuse the others.

tsfpga.examples.build_fpga_single_project module

Build FPGA projects from the command line. Note that this is an example script that illustrates how FPGA build projects can be built one by one. This is not the recommended standard build flow, see ‘build_fpga.py’ instead.

The benefit of building one by one is that build status is written directly to STDOUT.

tsfpga.examples.build_fpga_single_project.main() None

Main function for building single FPGA projects. Note that this is not the recommended standard build flow, see ‘build_fpga.py’ instead.

tsfpga.examples.build_fpga_single_project.setup_and_run(modules: ModuleList, projects: BuildProjectList, args: argparse.Namespace, collect_artifacts_function: Callable[[VivadoProject, Path], bool] | None) int

Setup and execute build projects one by one. As instructed by the arguments.

Note that this is not the recommended standard build flow, see ‘build_fpga.py’ instead.

Note that this functions is a modified clone of the one in ‘build_fpga_utils.py’.

Parameters:
  • modules – When running a register generation, registers from these modules will be included.

  • projects – These build projects will be built.

  • args – Command line argument namespace.

  • collect_artifacts_function – Function pointer to a function that collects build artifacts. Will be run after a successful implementation build. The function must return True if successful and False otherwise. It will receive the project and output_path as arguments. Can be None if no special artifact collection operation shall be run.

Returns:

0 if everything passed, otherwise non-zero. Can be used for system exit code.

tsfpga.examples.build_fpga_utils module

tsfpga.examples.build_fpga_utils.arguments(default_temp_dir: Path) Namespace

Setup of arguments for the example build flow.

Parameters:

default_temp_dir – Default value for output paths (can be overridden by command line argument).

tsfpga.examples.build_fpga_utils.collect_artifacts(project: VivadoProject, output_path: Path) bool

Example of a function to collect build artifacts. Will create a zip file with the bitstream, hardware definition (.xsa) and register artifacts.

Parameters:
  • project – Project object that has been built, and who’s artifacts shall now be collected.

  • output_path – Path to the build output. Artifact zip will be placed here as well.

Returns:

True if everything went well.

tsfpga.examples.build_fpga_utils.generate_register_artifacts(modules: ModuleList, output_path: Path) None

Example of a function to generate register artifacts from the given modules. Will generate pretty much all register artifacts available. In your own build flow you might want to only generate a subset of these.

Parameters:
  • modules – Registers from these modules will be included.

  • output_path – Register artifacts will be placed here.

tsfpga.examples.build_fpga_utils.setup_and_run(modules: ModuleList, project_list: BuildProjectList, args: argparse.Namespace, collect_artifacts_function: Callable[[VivadoProject, Path], bool] | None) int

Example of a function to setup and execute build projects. As instructed by the arguments.

Parameters:
  • modules – When running a register generation, registers from these modules will be included.

  • project_list – These build projects will be built.

  • args – Command line argument namespace.

  • collect_artifacts_function

    Function pointer to a function that collects build artifacts. Will be run after a successful implementation build. The function must return True if successful and False otherwise. It will receive the project and output_path as arguments.

    Can be None if no special artifact collection operation shall be run. Which is typically the case for synthesis-only builds such as netlist builds.

Returns:

0 if everything passed, otherwise non-zero. Can be used for system exit code.

tsfpga.examples.build_module_documentation module

tsfpga.examples.build_module_documentation.generate_documentation() None
tsfpga.examples.build_module_documentation.main() None

tsfpga.examples.conf module

Configuration file for the Sphinx documentation builder. For building documentation of the example modules.

tsfpga.examples.example_env module

Common functions and definitions in the example build environment.

tsfpga.examples.example_env.get_default_registers() list[Register]

Default registers for tsfpga examples.

tsfpga.examples.example_env.get_hdl_modules(names_include: set[str] | None = None, names_avoid: set[str] | None = None) ModuleList

Wrapper of get_modules() which returns the hdl-modules module objects (https://hdl-modules.com), if available.

If hdl-modules can not be found in the default repo checkout location, the function will assert False.

Arguments will be passed on to get_modules().

Returns:

The module objects.

Return type:

ModuleList

tsfpga.examples.example_env.get_tsfpga_example_modules(names_include: set[str] | None = None, names_avoid: set[str] | None = None) ModuleList

Wrapper of the regular get_modules() call with correct settings for tsfpga example modules.

tsfpga.examples.example_pythonpath module

Import this file in order to have the default locations of the hdl-registers/hdl-registers and vunit/vunit repos added to PYTHONPATH.

tsfpga.examples.simulate module

tsfpga.examples.simulation_utils module