Git Product home page Git Product logo

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.

  • The workflow is command-line centric.
  • It's friendly with Version Control Systems and Continuous Integration (CI).
  • Allows reproducibility and repeatability.
  • Consumes fewer system resources than GUI based workflows.

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:

  • A constructor where the TOOL must be specified and an optional PROJECT NAME can be indicated
  • Methods to set the target device PART, to add multiple HDL, Constraint and Tcl files to the project (in case of VHDL an optional PACKAGE NAME can be specified) and to specify the TOP-LEVEL
  • Methods to specify a different OUTPUT directory or get some project configurations
  • Methods to generate a bitstream and transfer it to a device (running the selected EDA Tool)
  • The capability of specifying an optimization strategy (area, power or speed) when the bitstream is generated
  • A method to add Verilog Included File directories
  • A method to specify generics/parameters values
  • Methods to add Tcl commands in up to six different parts of the Flow (workaround for not yet implemented features)
  • Optional logging capabilities which include the display of the Tool Execution Time

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.

  • The whole development flow (from reading HDL and constraint sources to producing a bitstream) can be performed with ISE (Xilinx), Vivado (Xilinx), Quarts Prime (Intel/Altera), Libero-SoC (Microsemi) and/or with open-source tools.
  • GDHL (--synth) allows converting VHDL sources into a VHDL 1993 netlist.
  • Yosys allows synthesising Verilog and VHDL (using ghdl-yosys-plugin) and supports multiple output formats: JSON, Verilog, EDIF, etc.
    • nextpnr can be used for implementation of JSON netlists.
    • Also, ISE and Vivado are supported for implementation of Verilog netlists.
  • Transferring bitstreams and programming devices:
    • ISE (Impact) can be used for programming FPGAs and/or memories (BPI and SPI) through JTAG.
    • Vivado, Quartus and iceprog (IceStorm, for ice40 devices) can be used to programming FPGAs.
    • Programming with Libero-SoC and programming ECP5 devices (prjtrellis, openocd) is not yet supported.

Notes:

  • The open-source tools are supported trough container images from the ghdl/docker project, so Docker or Podman must be installed. The same workflow can be used in CI services.
  • ISE, Libero-Soc, Quartus Prime and Vivado, must be ready to be executed from the terminal (installed and well configured).

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.

pyfpga's Projects

hdl2vlog icon hdl2vlog

VHDL / System Verilog to Verilog converter, based on Yosys and the plugins ghdl-yosys-plugin and synlig.

openflow icon openflow

A Python library, and CLI utilities, which solves HDL-to-bitstream based on FOSS.

poc icon poc

Proofs of concept about FPGA EDA tools.

pyfpga icon pyfpga

A Python package to use FPGA development tools programmatically.

resources icon resources

Shared resources (HDL and constraint files) between projects of the PyFPGA organization.

symbiflow_cli icon symbiflow_cli

A possible replacement for openflow, which would be ideally contributed to the SymbiFlow project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.