Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
3d9b185
Updated README.md and modified version (0.3.0-dev)
rodrigomelo9 May 15, 2022
c18b44b
resources: submodule added
rodrigomelo9 May 15, 2022
1e8a546
test: added mocks (for vendors tools)
rodrigomelo9 May 23, 2022
06c31d4
ci: fixed an 'exit status 2' issue
rodrigomelo9 May 25, 2022
b896134
ci: added python 3.10
rodrigomelo9 May 25, 2022
fda3a82
ci: added schedule based on cron
rodrigomelo9 May 25, 2022
dbfc133
fpga: renamed add_path as add_vlog_include
rodrigomelo9 May 26, 2022
579f275
fpga: added add_vlog_define and set_vhdl_arch in project.py (not impl…
rodrigomelo9 May 26, 2022
6699cd9
fpga: renamed set_param as add_param
rodrigomelo9 May 27, 2022
d1bd35c
fpga: renamed 'imp' as 'par'
rodrigomelo9 May 27, 2022
bbdc605
Updated shields in README.md
rodrigomelo9 May 27, 2022
fe8bcbc
fpga: renamed 'init' as 'meta'
rodrigomelo9 May 27, 2022
8777ee8
fix: ModuleNotFoundError: No module named 'fpga.helpers'
lmcapacho Jan 31, 2023
7f49fdf
Improved existing mocks
rodrigomelo9 May 20, 2024
31e33d1
Merge branch 'rewrite' of github.com:PyFPGA/pyfpga into rewrite
rodrigomelo9 May 20, 2024
4cc3513
Added a new WIP Project class under the pyfpga directory
rodrigomelo9 May 26, 2024
a9a25b1
ci: updated, modified to analyze pyfpga instead of fpga
rodrigomelo9 May 26, 2024
4b037ae
ci: renamed doc as docs, disabled docs and test
rodrigomelo9 May 26, 2024
8288159
ci: fixed lint action
rodrigomelo9 May 26, 2024
7347667
ci: updated Makefile and used for the lint action
rodrigomelo9 May 26, 2024
4d845b6
Modified project to employ enumerations
rodrigomelo9 May 26, 2024
049af6b
Added docs with the skeleton generated by sphinx-quickstart
rodrigomelo9 May 26, 2024
2f67bde
ci: updated docs
rodrigomelo9 May 26, 2024
35534eb
Moved content from doc/images into docs/images and docs/_static
rodrigomelo9 May 26, 2024
fe57927
Moved doc contento to docs/wip
rodrigomelo9 May 26, 2024
0717dc1
docs: added intro (empty) and api (automodule)
rodrigomelo9 May 26, 2024
33bfdcc
ci: updated/enabled docs
rodrigomelo9 May 26, 2024
ece35b0
Removed unused config files
rodrigomelo9 May 26, 2024
c2957c0
ci: updated docs and lint to be similar
rodrigomelo9 May 26, 2024
3d29a99
docs: fixed to find pyfpga.project
rodrigomelo9 May 26, 2024
fa24be1
Implemented some simple methods of project.py
rodrigomelo9 May 26, 2024
c545884
ci: simplified/enabled test
rodrigomelo9 May 26, 2024
d886fb3
Added the target docs at Makefile
rodrigomelo9 May 28, 2024
5d798be
Renamed test to tests
rodrigomelo9 May 28, 2024
833cb4a
Removed tool and data from Project
rodrigomelo9 May 28, 2024
292e6ea
ci: attempt to fix test
rodrigomelo9 May 28, 2024
13b5169
Added add_cons for constraint files
rodrigomelo9 May 28, 2024
f6958f6
Added logging into the new Project class and an example
rodrigomelo9 May 29, 2024
9bcc170
Added a Makefile target to update the resources module
rodrigomelo9 May 29, 2024
1b2fbe9
Renamed logging.py as logger.py (examples/misc) to avoid circular dep…
rodrigomelo9 May 29, 2024
abbb2b5
Added a private method to run the underlaying tool
rodrigomelo9 May 30, 2024
1b1f5a2
Replaced add_hook by a one functions for each hook
rodrigomelo9 May 30, 2024
992cfab
docs: added hooks
rodrigomelo9 May 30, 2024
b9700cd
Updated the NOTICE about PyFPGA being rewritten
rodrigomelo9 May 30, 2024
5c9f31e
Moved templates from fpga/tool to pyfpga/templates
rodrigomelo9 May 30, 2024
93eeb26
Content of vivado.jinja was split into 4 templates
rodrigomelo9 May 30, 2024
5c2ad6f
Templates clean-up
rodrigomelo9 May 30, 2024
b20db61
Added two hook stages, returned to the single function version
rodrigomelo9 May 31, 2024
b48ad68
Templates simplified, still WIP
rodrigomelo9 Jun 1, 2024
52e82f1
Renamed step PRJ as CFG
rodrigomelo9 Jun 1, 2024
d1eb4b1
Last iteration on templates before final customization
rodrigomelo9 Jun 1, 2024
504b1fc
docs: re-added previously removed sections, with a WIP notice
rodrigomelo9 Jun 1, 2024
a01bcd7
README updated/simplified
rodrigomelo9 Jun 1, 2024
087e3a6
Moved helpers from fpga to pyfpga
rodrigomelo9 Jun 1, 2024
e9f2dca
Renamed fpga/project.py as pyfpga/factory.py
rodrigomelo9 Jun 1, 2024
b6a0356
Simplified some methods at project, defined internal data structure, …
rodrigomelo9 Jun 1, 2024
16b3999
Fixed pylint complaint
rodrigomelo9 Jun 1, 2024
2bf79bc
Fixed pylint complaints
rodrigomelo9 Jun 1, 2024
c88eaa6
Renamed and implemented _add_file, implemented add_hook
rodrigomelo9 Jun 1, 2024
ecb3aa4
Added some pending doc-strings
rodrigomelo9 Jun 2, 2024
316dfdc
Removed already processed things
rodrigomelo9 Jun 2, 2024
739b12f
Removed test_top.py (top autodiscovery was deprecated)
rodrigomelo9 Jun 2, 2024
62e2fd9
Renamed hooks as internals, added info about the internal data structure
rodrigomelo9 Jun 2, 2024
ea3c468
Added a directory with empty files, to test methods that deal with di…
rodrigomelo9 Jun 2, 2024
1455a09
Removed unused things
rodrigomelo9 Jun 2, 2024
df2a2a2
Removed test_files.py
rodrigomelo9 Jun 2, 2024
79175ed
Implemented directory/file exists check
rodrigomelo9 Jun 2, 2024
53bb363
Moved things from fpga to pyfpga
rodrigomelo9 Jun 5, 2024
29aae52
Removed unused things, commented others
rodrigomelo9 Jun 5, 2024
7d10d7b
Added to check if the needed underlying tool is available
rodrigomelo9 Jun 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .btd.yml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/doc.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 'docs'

on:
push:
branches:
# - main

jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: pip install sphinx sphinx-rtd-theme
- name: Build documentation
run: make docs
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
14 changes: 5 additions & 9 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
pip install pycodestyle
pip install pylint
pip install .
- name: Lint
run: |
pycodestyle fpga examples test
pylint fpga
run: pip install pycodestyle pylint
- name: Run linters
run: make lint
35 changes: 15 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,23 @@ on:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
os: ['ubuntu']
pyver: ['3.8', '3.9', '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}-latest
name: ${{ matrix.os }} | ${{ matrix.pyver }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
- name: Checkout repository
uses: actions/checkout@v4
with:
python-version: ${{ matrix.python-version }}
submodules: true
fetch-depth: 0
- name: Set up Python ${{ matrix.pyver }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.pyver }}
- name: Install dependencies
run: |
pip install pytest
pip install .
- name: Pull container images
run: |
docker pull hdlc/prjtrellis
docker pull hdlc/ghdl:yosys
docker pull hdlc/icestorm
docker pull hdlc/nextpnr:ecp5
docker pull hdlc/nextpnr:ice40
- name: Test
run: |
pytest
make -C examples
run: pip install pytest
- name: Run tests
run: make test
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "resources"]
path = resources
url = https://github.com/PyFPGA/resources
16 changes: 0 additions & 16 deletions .pylintrc

This file was deleted.

22 changes: 18 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
#!/usr/bin/make

check:
pycodestyle fpga examples test
pylint -s n fpga
.PHONY: docs

docs:
cd docs; make html

lint:
pycodestyle pyfpga examples tests
pylint -s n pyfpga
git diff --check --cached
pytest test

test:
cd tests; pytest

clean:
py3clean .
cd docs; make clean
rm -fr build .pytest_cache

submodule-init:
git submodule update --init

submodule-update:
cd resources; git checkout main; git pull
110 changes: 28 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
# PyFPGA [![License](https://img.shields.io/badge/License-GPL--3.0-darkgreen?style=flat-square)](LICENSE)

![GDHL](https://img.shields.io/badge/GHDL-last-brightgreen.svg?style=flat-square)
![icestorm](https://img.shields.io/badge/icestorm-last-brightgreen.svg?style=flat-square)
![nextpnr](https://img.shields.io/badge/nextpnr-last-brightgreen.svg?style=flat-square)
![prjtrellis](https://img.shields.io/badge/prjtrellis-last-brightgreen.svg?style=flat-square)
![Yosys](https://img.shields.io/badge/Yosys-last-brightgreen.svg?style=flat-square)

![ISE](https://img.shields.io/badge/ISE-14.7-blue.svg?style=flat-square)
![Libero](https://img.shields.io/badge/Libero--Soc-12.2-blue.svg?style=flat-square)
![Quartus](https://img.shields.io/badge/Quartus--Prime-19.1-blue.svg?style=flat-square)
![Vivado](https://img.shields.io/badge/Vivado-2019.2-blue.svg?style=flat-square)
![Quartus](https://img.shields.io/badge/Quartus--Prime-19.1-blue.svg?style=flat-square)
![Libero](https://img.shields.io/badge/Libero--Soc-12.2-blue.svg?style=flat-square)
![ISE](https://img.shields.io/badge/ISE-14.7-blue.svg?style=flat-square)
![Openflow](https://img.shields.io/badge/Openflow-GHDL%20%7C%20Yosys%20%7C%20nextpnr%20%7C%20icestorm%20%7C%20prjtrellis-darkgreen.svg?style=flat-square)

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!
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.

> **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.
With PyFPGA, you can create your own FPGA development workflow tailored to your needs!

## Usage
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.

A minimal example of how to use PyFPGA:
## Basic example

```py
from fpga import Project
Expand All @@ -53,80 +43,36 @@ prj.set_top('Top')
prj.generate()
```

Now, you can read the [docs](https://pyfpga.github.io/pyfpga/) or find
more examples in subdir [examples](examples).
The next steps are to read the [docs](https://pyfpga.github.io/pyfpga) or take a look at [examples](examples).

The API implemented by the `Project class` provides:
## Support

- 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
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](https://github.com/PyFPGA/pyfpga/issues) tracker.

## Support
For a comprehensive list of supported tools, features and limitations, please refer to the [tools support](https://pyfpga.github.io/pyfpga/tools.html) page.

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](https://github.com/PyFPGA/pyfpga/issues) 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](https://github.com/ghdl/docker) project, so
[Docker](https://www.docker.com/) ~~or [Podman](https://podman.io/)~~ 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).
> **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.6`. For now, it's only available as a git repository
hosted on GitHub. It can be installed with pip:
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'
```

> 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:
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
```

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.
> 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.
57 changes: 0 additions & 57 deletions doc/Makefile

This file was deleted.

8 changes: 0 additions & 8 deletions doc/api.rst

This file was deleted.

Loading