You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/SpinalHDL/Libraries/Misc/service_plugin.rst
+29-13Lines changed: 29 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,14 +8,21 @@ Introduction
8
8
------------
9
9
10
10
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 :
19
26
20
27
- PcPlugin
21
28
- FetchPlugin
@@ -24,18 +31,24 @@ and their hardware parts are injected using plugins. For instance :
24
31
- IntAluPlugin
25
32
- ...
26
33
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.
28
36
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.
30
41
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.
32
44
33
45
Execution order
34
46
---------------
35
47
36
48
The main idea is that you have multiple 2 executions phases :
37
49
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.
39
52
- Build phase, in which plugins can negotiation / elaboration hardware.
40
53
41
54
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
60
73
Simple example
61
74
--------------
62
75
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 :
64
77
65
78
.. code-block:: scala
66
79
@@ -247,3 +260,6 @@ Clearly, those examples are overkilled for what they do, the idea in general is
247
260
- Negotiate / create interfaces between plugins (ex jump / flush ports)
248
261
- Schedule the elaboration (ex decode / dispatch specification)
249
262
- Provide a distributed framework which can scale up (minimal hardcoding)
263
+
264
+
More information can be found `in the documentation of VexiiRiscv
0 commit comments