Skip to content

Commit db64379

Browse files
authored
Merge pull request #307 from SpinalHDL/improve-service-plugin-doc
Improve service plugin doc
2 parents 3a2b2eb + abf845b commit db64379

2 files changed

Lines changed: 30 additions & 14 deletions

File tree

source/SpinalHDL/Libraries/Misc/service_plugin.rst

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,21 @@ Introduction
88
------------
99

1010
For some design, instead of implementing your Component's hardware directly in it,
11-
you may instead want to compose its hardware by using some sorts of Plugins. This can provide a few key features :
12-
13-
- You can extend the features of your component by adding new plugins in its parameters. For instance adding Floating point support in a CPU.
14-
- You can swap various implementations of the same functionality just by using another set of plugins. For instance one implementation of a CPU multiplier may fit well on some FPGA, while others may fit well on ASIC.
15-
- It avoid the very very very large hand written toplevel syndrome where everything has to be connected manually. Instead plugins can discover their neighborhood by looking/using the software interface of other plugins.
16-
17-
VexRiscv and NaxRiscv projects are an example of this. Their are CPUs which have a mostly empty toplevel,
18-
and their hardware parts are injected using plugins. For instance :
11+
you may instead want to compose its hardware by using some sorts of Plugins.
12+
This can provide a few key features :
13+
14+
- You can extend the features of your component by adding new plugins in its
15+
parameters. For instance adding Floating point support in a CPU.
16+
- You can swap various implementations of the same functionality just by using
17+
another set of plugins. For instance one implementation of a CPU multiplier
18+
may fit well on some FPGA, while others may fit well on ASIC.
19+
- It avoid the very very very large hand written toplevel syndrome where everything
20+
has to be connected manually. Instead plugins can discover their neighborhood
21+
by looking/using the software interface of other plugins.
22+
23+
VexRiscv and NaxRiscv are projects that use their own implementation of this concept.
24+
Their are CPUs which have a mostly empty toplevel, and their hardware parts
25+
are injected using plugins. For instance :
1926

2027
- PcPlugin
2128
- FetchPlugin
@@ -24,18 +31,24 @@ and their hardware parts are injected using plugins. For instance :
2431
- IntAluPlugin
2532
- ...
2633

27-
And those plugins will then negotiate/propagate/interconnect to each others via their pool of services.
34+
And those plugins will then negotiate/propagate/interconnect to each others via
35+
their pool of services.
2836

29-
While VexRiscv use a strict synchronous 2 phase system (setup/build callback), NaxRiscv uses a more flexible approach which uses the spinal.core.fiber API to fork elaboration threads which can interlock each others in order to ensure a workable elaboration ordering.
37+
While VexRiscv use a strict synchronous 2 phase system (setup/build callback),
38+
NaxRiscv uses a more flexible approach which uses the :ref:`spinal.core.fiber API <fiber>`
39+
to fork elaboration threads which can interlock each others in order to ensure
40+
a workable elaboration ordering.
3041

31-
The Plugin API provide a NaxRiscv like system to define composable components using plugins.
42+
The ``spinal.lib.misc.plugin`` API provide a NaxRiscv like system to define
43+
composable components using plugins. It is used for example in VexiiRiscv.
3244

3345
Execution order
3446
---------------
3547

3648
The main idea is that you have multiple 2 executions phases :
3749

38-
- Setup phase, in which plugins can lock/retain each others. The idea is not to start negotiation / elaboration yet.
50+
- Setup phase, in which plugins can lock/retain each others. The idea is not
51+
to start negotiation / elaboration yet.
3952
- Build phase, in which plugins can negotiation / elaboration hardware.
4053

4154
The build phase will not start before all ``FiberPlugin`` are done with their setup phase.
@@ -60,7 +73,7 @@ The build phase will not start before all ``FiberPlugin`` are done with their se
6073
Simple example
6174
--------------
6275

63-
Here is a simple dummy example with a SubComponent which will be composed using 2 plugins :
76+
Here is a simple dummy example with a ``SubComponent`` which will be composed using 2 plugins :
6477

6578
.. code-block:: scala
6679
@@ -247,3 +260,6 @@ Clearly, those examples are overkilled for what they do, the idea in general is
247260
- Negotiate / create interfaces between plugins (ex jump / flush ports)
248261
- Schedule the elaboration (ex decode / dispatch specification)
249262
- Provide a distributed framework which can scale up (minimal hardcoding)
263+
264+
More information can be found `in the documentation of VexiiRiscv
265+
<https://spinalhdl.github.io/VexiiRiscv-RTD/master/VexiiRiscv/Framework/index.html#plugin-fiber-retainer>`_.

source/SpinalHDL/Sequential logic/memory.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ There are currently 4 kinds of technologies possible:
379379
* ``distributedLut``
380380
* ``registerFile``
381381

382-
Blackboxing can insert HDL attributes if ``SpinalConfig#setDevice(Device)``
382+
Blackboxing can insert HDL attributes if ``SpinalConfig#device``
383383
has been configured for your device-vendor.
384384

385385
The resulting HDL attributes might look like:

0 commit comments

Comments
 (0)