PyFPGA is a Python Class for vendor-independent FPGA development. It allows using a single project file and programmatically executing synthesis, implementation, generation of bitstream and/or transference to supported boards.
Create your custom FPGA Tool using a workflow tailored to your needs!
WARNING: (2022-05-15) PyFPGA is in the process of being strongly rewritten/simplified. Most changes are internal, but the API (
Project
class) will change.
A minimal example of how to use PyFPGA:
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()
Now, you can read the docs or find more examples in subdir examples.
The API implemented by the Project class
provides:
PyFPGA is a Python 3 package, which is developed on Debian GNU/Linux. It should run on any other POSIX compatible OS and probably also on different OS. Should you achieve either success of failure on non-POSIX systems, please let us know through the issue tracker.
--synth
) allows converting VHDL sources into a VHDL 1993 netlist.ghdl-yosys-plugin
) and supports multiple
output formats: JSON, Verilog, EDIF, etc.
Notes:
PyFPGA requires Python >=3.6
. For now, 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'
On GNU/Linux, installing pip packages on the system requires
sudo
. Alternatively, use--local
for installing PyFPGA in your HOME.
You can get a copy of the repository either through git clone or downloading a tarball/zipfile:
git clone https://github.com/PyFPGA/pyfpga.git
cd pyfpga
Then, use pip from the root of the repo:
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, without the need to reinstall the package.