PyFPGA / pyfpga

A Python package to use FPGA development tools programmatically.
https://pyfpga.github.io/pyfpga/
GNU General Public License v3.0
81 stars 10 forks source link
actel altera amd fpga ghdl icestorm intel ise lattice libero microchip microsemi nextpnr python quartus tcl trellis vivado xilinx yosys

PyFPGA License

GDHL icestorm nextpnr prjtrellis Yosys

ISE Libero Quartus Vivado

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.

Usage

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:

Support

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.

Notes:

Installation

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.