Skip to content

Commit a4ffd5d

Browse files
committed
docs: improve the extending section
1 parent f203de1 commit a4ffd5d

File tree

1 file changed

+56
-20
lines changed

1 file changed

+56
-20
lines changed

docs/extending.rst

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,76 @@
11
Extending
22
=========
33

4-
1. Add support for the new tool:
4+
.. note::
55

6-
.. code-block:: python
6+
All <TOOL> classes inherit from project.py.
7+
8+
This is a guide on how to add support for a new TOOL.
9+
10+
Add support for the new tool
11+
----------------------------
12+
13+
.. code-block:: bash
714
815
pyfpga/templates/<NEWTOOL>.jinja
916
pyfpga/templates/<NEWTOOL>-prog.jinja
1017
pyfpga/<NEWTOOL>.py
18+
pyfpga/factory.py # UPDATE
19+
pyfpga/helpers/prj2bit.py # UPDATE
1120
12-
2. Include the new tool on Factory:
21+
Add tests and a tool mock-up
22+
----------------------------
1323

14-
.. code-block:: python
24+
.. code-block:: bash
1525
16-
pyfpga/factory.py
26+
tests/test_tools.py # UPDATE
27+
tests/support.py # UPDATE if exceptions are needed
28+
tests/mocks/<NEWCOMMAND>
1729
18-
3. Add tests and a tool mock-up:
30+
Add examples
31+
------------
1932

20-
.. code-block:: python
33+
.. code-block:: bash
2134
22-
tests/test_tools.py
23-
tests/mocks/<NEWTOOL_EXECUTABLE>
35+
examples/sources/cons/<NEWBOARD>/timing.<EXT>
36+
examples/sources/cons/<NEWBOARD>/clk.<EXT>
37+
examples/sources/cons/<NEWBOARD>/led.<EXT>
38+
examples/projects/<NEWTOOL>.py
39+
examples/projects/regress.sh # UPDATE
40+
examples/helpers/<NEWTOOL>.sh
41+
examples/hooks/<NEWTOOL>.py # OPTIONAL
2442
25-
4. Updated the project's documentation:
43+
Verify the code
44+
---------------
2645

27-
.. code-block:: python
46+
Run it at the root of the repo.
2847

29-
README.md
30-
docs
48+
.. code-block:: bash
3149
32-
5. [OPTIONAL] Add examples:
50+
make docs
51+
make lint
52+
make test
3353
34-
.. code-block:: python
54+
.. tip::
3555

36-
examples/sources/cons/<NEWBOARD>/timing.<EXT>
37-
examples/sources/cons/<NEWBOARD>/clk.<EXT>
38-
examples/sources/cons/<NEWBOARD>/led.<EXT>
39-
examples/projects/<NEWTOOL>.py
40-
examples/hooks/<NEWTOOL>.py
56+
You can simply run ``make`` to perform all the operations.
57+
Running ``make clean`` will remove all the generated files.
58+
59+
Verify the functionality
60+
------------------------
61+
62+
.. code-block:: bash
63+
64+
cd examples/projects/
65+
bash regress.sh <NEWTOOL>
66+
cd ../../tests/
67+
python3 support.py --tool <NEWTOOL>
68+
69+
Updated the documentation
70+
-------------------------
71+
72+
.. code-block:: bash
73+
74+
README.md
75+
docs/intro.rst
76+
docs/tools.rst

0 commit comments

Comments
 (0)