Skip to content

PyFPGA/pyfpga

Repository files navigation

PyFPGA License

Vivado Quartus Libero ISE Openflow

PyFPGA is an abstraction layer for working with FPGA development tools in a vendor-agnostic, programmatic way. It is a Python package that provides:

  • One class per supported tool for project creation, synthesis, place and route, bitstream generation, and programming.
  • A set of command-line helpers for simple projects or quick evaluations.

With PyFPGA, you can create your own FPGA development workflow tailored to your needs!

Some of its benefits are:

  • It provides a unified API between tools/devices.
  • It's Version Control Systems and Continuous Integration friendly.
  • It ensures reproducibility and repeatability.
  • It consumes fewer system resources than GUI-based workflows.

Basic example

from fpga import Project

# Specify the backend tool and an optional project name
prj = Project('vivado', 'example')

# Set the device/part
prj.set_part('xc7z010-1-clg400')

# Add HDL sources to the project
prj.add_files('location1/*.v')
prj.add_files('location2/top.v')

# Optionally add constraint files to the project
prj.add_files('location3/example.xdc')

# Set the top-level unit name
prj.set_top('Top')

# Generate the bitstream running the tool
prj.generate()

The next steps are to read the docs or take a look at examples.

Support

PyFPGA is a Python package developed having GNU/Linux platform on mind, but it should run well on any POSIX-compatible OS, and probably others! If you encounter compatibility issues, please inform us via the issues tracker.

For a comprehensive list of supported tools, features and limitations, please refer to the tools support page.

NOTE: PyFPGA assumes that the underlying tools required for operation are ready to be executed from the running terminal. This includes having the tools installed, properly configured, and licensed (when needed).

Installation

PyFPGA requires Python>=3.7.

At the moment, it's only available as a git repository hosted on GitHub. It can be installed with pip:

pip install 'git+https://github.com/PyFPGA/pyfpga#egg=pyfpga'

Alternatively, you can get a copy of the repository either through git clone or downloading a tarball/zipfile, and then:

git clone https://github.com/PyFPGA/pyfpga.git
cd pyfpga
pip install -e .

With -e (--editable) your application is installed into site-packages via a kind of symlink. That allows pulling changes through git or changing the branch, avoiding the need to reinstall the package.