Skip to content

0.4.0 rc0 #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Mar 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
c1c35e7
Bump version
rodrigomelo9 Mar 17, 2025
0d79f78
Attempt to fix path issues on Windows
rodrigomelo9 Mar 17, 2025
0318d13
Add mock-ups and improve regression
rodrigomelo9 Mar 17, 2025
5b9f028
Fix pylint complaint
rodrigomelo9 Mar 17, 2025
176431f
Removed misc
rodrigomelo9 Mar 17, 2025
b105387
Moved regress.sh from examples/projects to tests
rodrigomelo9 Mar 17, 2025
f909097
docs: update extending after last changes
rodrigomelo9 Mar 17, 2025
f189629
Fix PATH for Windows, add Windows mock-ups (bat)
rodrigomelo9 Mar 17, 2025
9273f51
Simplify bat files
rodrigomelo9 Mar 17, 2025
c37cb52
tests: files creation simplified
rodrigomelo9 Mar 17, 2025
c7f3f38
Add verbosity for pylint
rodrigomelo9 Mar 18, 2025
1c32dd6
Test (data) simplified
rodrigomelo9 Mar 18, 2025
d27ad20
Add missing position for programming templates
rodrigomelo9 Mar 21, 2025
d52dd57
Fix ise-prog template
rodrigomelo9 Mar 21, 2025
611bacf
Move bitstream discovery into a new private method
rodrigomelo9 Mar 21, 2025
9e10a71
Fix icestorm based examples
rodrigomelo9 Mar 22, 2025
684bf79
Small fixes on _get_bitstream
rodrigomelo9 Mar 22, 2025
1dacd42
Add to test slashes on paths (wip)
rodrigomelo9 Mar 22, 2025
671f23b
Fix Quartus programming file extension
rodrigomelo9 Mar 22, 2025
1fe7d9c
Completed slashes test
rodrigomelo9 Mar 22, 2025
5568bb1
Add to check helpers into the regress script
rodrigomelo9 Mar 22, 2025
d96a12a
prj2bit: add support for diamond
rodrigomelo9 Mar 22, 2025
e784191
bitprog: remove support for SPI and BPI
rodrigomelo9 Mar 22, 2025
eefc9f2
Add bitprog examples
rodrigomelo9 Mar 22, 2025
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
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

.PHONY: docs

ifeq ($(OS),Windows_NT)
PATH_SEP := ;
else
PATH_SEP := :
endif
export PATH := $(CURDIR)/tests/mocks$(PATH_SEP)$(PATH)

all: docs lint test

docs:
Expand All @@ -13,8 +20,8 @@ lint:
git diff --check --cached

test:
pytest
cd examples/projects && bash regress.sh --notool
pytest -vv
cd tests && bash regress.sh

clean:
py3clean .
Expand Down
8 changes: 3 additions & 5 deletions docs/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ Add support for the new tool
pyfpga/factory.py # UPDATE
pyfpga/helpers/prj2bit.py # UPDATE

Add tests and a tool mock-up
Add tests and tools mock-ups
----------------------------

.. code-block:: bash

tests/test_tools.py # UPDATE
tests/regress.sh # UPDATE
tests/support.py # UPDATE if exceptions are needed
tests/mocks/<NEWCOMMAND>

Expand All @@ -36,7 +37,6 @@ Add examples
examples/sources/cons/<NEWBOARD>/clk.<EXT>
examples/sources/cons/<NEWBOARD>/led.<EXT>
examples/projects/<NEWTOOL>.py
examples/projects/regress.sh # UPDATE
examples/helpers/<NEWTOOL>.sh
examples/hooks/<NEWTOOL>.py # OPTIONAL

Expand All @@ -61,9 +61,7 @@ Verify the functionality

.. code-block:: bash

cd examples/projects/
bash regress.sh <NEWTOOL>
cd ../../tests/
cd tests
python3 support.py --tool <NEWTOOL>

Updated the documentation
Expand Down
1 change: 0 additions & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ In this section, you will find:
* `projects`: basic but complete examples for each supported tool.
* `helpers`: examples of the PyFPGA helpers.
* `hooks`: how to use this feature.
* `misc`: miscellaneous examples.

For an example where all the tools are employed based on the same code, you can check
[support.py](../tests/support.py) (located under the [tests](../tests) directory).
20 changes: 20 additions & 0 deletions examples/helpers/diamond.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -e

HDIR=../../pyfpga/helpers

python3 $HDIR/hdl2bit.py -t diamond -o results/diamond-vlog -p lfxp2-5e-5tn144c \
-i ../sources/vlog/include1 -i ../sources/vlog/include2 \
-f ../sources/vlog/blink.v -f ../sources/vlog/top.v \
-f ../sources/cons/brevia2/clk.lpf -f ../sources/cons/brevia2/led.lpf \
--define DEFINE1 1 --define DEFINE2 1 --param FREQ 125000000 --param SECS 1 Top

python3 $HDIR/hdl2bit.py -t diamond -o results/diamond-vhdl -p lfxp2-5e-5tn144c --project example \
-f ../sources/vhdl/blink.vhdl,blink_lib -f ../sources/vhdl/blink_pkg.vhdl,blink_lib -f ../sources/vhdl/top.vhdl \
-f ../sources/cons/brevia2/clk.lpf -f ../sources/cons/brevia2/led.lpf \
--param FREQ 125000000 --param SECS 1 --last cfg Top

python3 $HDIR/prj2bit.py results/diamond-vhdl/example.ldf

# Diamond programming is not yet supported
2 changes: 2 additions & 0 deletions examples/helpers/ise.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ python3 $HDIR/hdl2bit.py -t ise -o results/ise-vhdl -p xc6slx16-3-csg32 --projec
--param FREQ 125000000 --param SECS 1 --last cfg Top

python3 $HDIR/prj2bit.py results/ise-vhdl/example.xise

python3 $HDIR/bitprog.py -t ise results/ise-vhdl/example.bit
2 changes: 2 additions & 0 deletions examples/helpers/libero.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ python3 $HDIR/hdl2bit.py -t libero -o results/libero-vhdl -p m2s010-1-tq144 --pr
--param FREQ 125000000 --param SECS 1 --last cfg Top

python3 $HDIR/prj2bit.py results/libero-vhdl/libero/example.prjx

python3 $HDIR/bitprog.py -t libero results/libero-vhdl/example.ppd
9 changes: 9 additions & 0 deletions examples/helpers/openflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ python3 $HDIR/hdl2bit.py -t openflow -o results/openflow-vlog -p hx1k-tq144 \
-f ../sources/vlog/blink.v -f ../sources/vlog/top.v \
-f ../sources/cons/icestick/clk.pcf -f ../sources/cons/icestick/led.pcf \
--define DEFINE1 1 --define DEFINE2 1 --param FREQ 100000000 --param SECS 1 Top

python3 $HDIR/hdl2bit.py -t openflow -o results/openflow-vhdl -p hx1k-tq144 --project example \
-f ../sources/vhdl/blink.vhdl,blink_lib -f ../sources/vhdl/blink_pkg.vhdl,blink_lib -f ../sources/vhdl/top.vhdl \
-f ../sources/cons/icestick/clk.pcf -f ../sources/cons/icestick/led.pcf \
--param FREQ 125000000 --param SECS 1 --last syn Top

# OpenFlow doesn't have a project file, so it is not supported by prj2bit

python3 $HDIR/bitprog.py -t openflow results/openflow-vhdl/openflow.bit
2 changes: 2 additions & 0 deletions examples/helpers/quartus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ python3 $HDIR/hdl2bit.py -t quartus -o results/quartus-vhdl -p 5CSEBA6U23I7 --pr
--param FREQ 125000000 --param SECS 1 --last cfg Top

python3 $HDIR/prj2bit.py results/quartus-vhdl/example.qpf

python3 $HDIR/bitprog.py -t quartus results/quartus-vhdl/example.sof
2 changes: 2 additions & 0 deletions examples/helpers/vivado.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ python3 $HDIR/hdl2bit.py -t vivado -o results/vivado-vhdl -p xc7z010-1-clg400 --
--param FREQ 125000000 --param SECS 1 --last cfg Top

python3 $HDIR/prj2bit.py results/vivado-vhdl/example.xpr

python3 $HDIR/bitprog.py -t vivado results/vivado-vhdl/example.bit
15 changes: 4 additions & 11 deletions examples/projects/diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Diamond(odir=f'results/diamond/{args.source}/{args.board}')
Expand Down Expand Up @@ -46,11 +43,7 @@

prj.set_top('Top')

try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
15 changes: 4 additions & 11 deletions examples/projects/ise.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Ise(odir=f'results/ise/{args.source}/{args.board}')
Expand Down Expand Up @@ -48,11 +45,7 @@

prj.set_top('Top')

try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
15 changes: 4 additions & 11 deletions examples/projects/libero.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Libero(odir=f'results/libero/{args.source}/{args.board}')
Expand Down Expand Up @@ -53,11 +50,7 @@

prj.set_top('Top')

try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
21 changes: 7 additions & 14 deletions examples/projects/openflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,18 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Openflow(odir=f'results/openflow/{args.source}/{args.board}')

if args.board == 'icestick':
prj.set_part('hx1k-tq144')
prj.add_param('FREQ', '100000000')
prj.add_param('FREQ', '12000000')
prj.add_cons('../sources/cons/icestick/clk.pcf')
prj.add_cons('../sources/cons/icestick/led.pcf')
if args.board == 'edu-ciaa':
prj.set_part('hx1k-tq144')
prj.add_param('FREQ', '100000000')
prj.set_part('hx4k-tq144')
prj.add_param('FREQ', '12000000')
prj.add_cons('../sources/cons/edu-ciaa/clk.pcf')
prj.add_cons('../sources/cons/edu-ciaa/led.pcf')
if args.board == 'orangecrab':
Expand Down Expand Up @@ -62,11 +59,7 @@

prj.set_top('Top')

try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
15 changes: 4 additions & 11 deletions examples/projects/quartus.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Quartus(odir=f'results/quartus/{args.source}/{args.board}')
Expand Down Expand Up @@ -47,11 +44,7 @@

prj.set_top('Top')

try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
53 changes: 0 additions & 53 deletions examples/projects/regress.sh

This file was deleted.

15 changes: 4 additions & 11 deletions examples/projects/vivado.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
parser.add_argument(
'--action', choices=['make', 'prog', 'all'], default='make'
)
parser.add_argument(
'--notool', action='store_true'
)
args = parser.parse_args()

prj = Vivado(odir=f'results/vivado/{args.source}/{args.board}')
Expand Down Expand Up @@ -53,11 +50,7 @@

prj.set_top('Top')

try:
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
except RuntimeError:
if not args.notool:
raise
if args.action in ['make', 'all']:
prj.make()
if args.action in ['prog', 'all']:
prj.prog()
2 changes: 1 addition & 1 deletion pyfpga/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""PyFPGA"""

__version__ = '0.3.1'
__version__ = '0.4.0'
Loading