Skip to content

Commit 15f4d8e

Browse files
authored
Merge pull request #62 from PyFPGA/0.4.0-rc0
0.4.0 rc0
2 parents c6d47be + eefc9f2 commit 15f4d8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+319
-297
lines changed

Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
.PHONY: docs
44

5+
ifeq ($(OS),Windows_NT)
6+
PATH_SEP := ;
7+
else
8+
PATH_SEP := :
9+
endif
10+
export PATH := $(CURDIR)/tests/mocks$(PATH_SEP)$(PATH)
11+
512
all: docs lint test
613

714
docs:
@@ -13,8 +20,8 @@ lint:
1320
git diff --check --cached
1421

1522
test:
16-
pytest
17-
cd examples/projects && bash regress.sh --notool
23+
pytest -vv
24+
cd tests && bash regress.sh
1825

1926
clean:
2027
py3clean .

docs/extending.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ Add support for the new tool
1818
pyfpga/factory.py # UPDATE
1919
pyfpga/helpers/prj2bit.py # UPDATE
2020
21-
Add tests and a tool mock-up
21+
Add tests and tools mock-ups
2222
----------------------------
2323

2424
.. code-block:: bash
2525
2626
tests/test_tools.py # UPDATE
27+
tests/regress.sh # UPDATE
2728
tests/support.py # UPDATE if exceptions are needed
2829
tests/mocks/<NEWCOMMAND>
2930
@@ -36,7 +37,6 @@ Add examples
3637
examples/sources/cons/<NEWBOARD>/clk.<EXT>
3738
examples/sources/cons/<NEWBOARD>/led.<EXT>
3839
examples/projects/<NEWTOOL>.py
39-
examples/projects/regress.sh # UPDATE
4040
examples/helpers/<NEWTOOL>.sh
4141
examples/hooks/<NEWTOOL>.py # OPTIONAL
4242
@@ -61,9 +61,7 @@ Verify the functionality
6161

6262
.. code-block:: bash
6363
64-
cd examples/projects/
65-
bash regress.sh <NEWTOOL>
66-
cd ../../tests/
64+
cd tests
6765
python3 support.py --tool <NEWTOOL>
6866
6967
Updated the documentation

examples/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ In this section, you will find:
55
* `projects`: basic but complete examples for each supported tool.
66
* `helpers`: examples of the PyFPGA helpers.
77
* `hooks`: how to use this feature.
8-
* `misc`: miscellaneous examples.
98

109
For an example where all the tools are employed based on the same code, you can check
1110
[support.py](../tests/support.py) (located under the [tests](../tests) directory).

examples/helpers/diamond.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
HDIR=../../pyfpga/helpers
6+
7+
python3 $HDIR/hdl2bit.py -t diamond -o results/diamond-vlog -p lfxp2-5e-5tn144c \
8+
-i ../sources/vlog/include1 -i ../sources/vlog/include2 \
9+
-f ../sources/vlog/blink.v -f ../sources/vlog/top.v \
10+
-f ../sources/cons/brevia2/clk.lpf -f ../sources/cons/brevia2/led.lpf \
11+
--define DEFINE1 1 --define DEFINE2 1 --param FREQ 125000000 --param SECS 1 Top
12+
13+
python3 $HDIR/hdl2bit.py -t diamond -o results/diamond-vhdl -p lfxp2-5e-5tn144c --project example \
14+
-f ../sources/vhdl/blink.vhdl,blink_lib -f ../sources/vhdl/blink_pkg.vhdl,blink_lib -f ../sources/vhdl/top.vhdl \
15+
-f ../sources/cons/brevia2/clk.lpf -f ../sources/cons/brevia2/led.lpf \
16+
--param FREQ 125000000 --param SECS 1 --last cfg Top
17+
18+
python3 $HDIR/prj2bit.py results/diamond-vhdl/example.ldf
19+
20+
# Diamond programming is not yet supported

examples/helpers/ise.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ python3 $HDIR/hdl2bit.py -t ise -o results/ise-vhdl -p xc6slx16-3-csg32 --projec
1616
--param FREQ 125000000 --param SECS 1 --last cfg Top
1717

1818
python3 $HDIR/prj2bit.py results/ise-vhdl/example.xise
19+
20+
python3 $HDIR/bitprog.py -t ise results/ise-vhdl/example.bit

examples/helpers/libero.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ python3 $HDIR/hdl2bit.py -t libero -o results/libero-vhdl -p m2s010-1-tq144 --pr
1616
--param FREQ 125000000 --param SECS 1 --last cfg Top
1717

1818
python3 $HDIR/prj2bit.py results/libero-vhdl/libero/example.prjx
19+
20+
python3 $HDIR/bitprog.py -t libero results/libero-vhdl/example.ppd

examples/helpers/openflow.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,12 @@ python3 $HDIR/hdl2bit.py -t openflow -o results/openflow-vlog -p hx1k-tq144 \
99
-f ../sources/vlog/blink.v -f ../sources/vlog/top.v \
1010
-f ../sources/cons/icestick/clk.pcf -f ../sources/cons/icestick/led.pcf \
1111
--define DEFINE1 1 --define DEFINE2 1 --param FREQ 100000000 --param SECS 1 Top
12+
13+
python3 $HDIR/hdl2bit.py -t openflow -o results/openflow-vhdl -p hx1k-tq144 --project example \
14+
-f ../sources/vhdl/blink.vhdl,blink_lib -f ../sources/vhdl/blink_pkg.vhdl,blink_lib -f ../sources/vhdl/top.vhdl \
15+
-f ../sources/cons/icestick/clk.pcf -f ../sources/cons/icestick/led.pcf \
16+
--param FREQ 125000000 --param SECS 1 --last syn Top
17+
18+
# OpenFlow doesn't have a project file, so it is not supported by prj2bit
19+
20+
python3 $HDIR/bitprog.py -t openflow results/openflow-vhdl/openflow.bit

examples/helpers/quartus.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ python3 $HDIR/hdl2bit.py -t quartus -o results/quartus-vhdl -p 5CSEBA6U23I7 --pr
1616
--param FREQ 125000000 --param SECS 1 --last cfg Top
1717

1818
python3 $HDIR/prj2bit.py results/quartus-vhdl/example.qpf
19+
20+
python3 $HDIR/bitprog.py -t quartus results/quartus-vhdl/example.sof

examples/helpers/vivado.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ python3 $HDIR/hdl2bit.py -t vivado -o results/vivado-vhdl -p xc7z010-1-clg400 --
1616
--param FREQ 125000000 --param SECS 1 --last cfg Top
1717

1818
python3 $HDIR/prj2bit.py results/vivado-vhdl/example.xpr
19+
20+
python3 $HDIR/bitprog.py -t vivado results/vivado-vhdl/example.bit

examples/projects/diamond.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
parser.add_argument(
1616
'--action', choices=['make', 'prog', 'all'], default='make'
1717
)
18-
parser.add_argument(
19-
'--notool', action='store_true'
20-
)
2118
args = parser.parse_args()
2219

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

4744
prj.set_top('Top')
4845

49-
try:
50-
if args.action in ['make', 'all']:
51-
prj.make()
52-
if args.action in ['prog', 'all']:
53-
prj.prog()
54-
except RuntimeError:
55-
if not args.notool:
56-
raise
46+
if args.action in ['make', 'all']:
47+
prj.make()
48+
if args.action in ['prog', 'all']:
49+
prj.prog()

0 commit comments

Comments
 (0)