Skip to content

Commit

Permalink
More plugin doc
Browse files Browse the repository at this point in the history
Dolu1990 committed Jan 12, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 29c5c1a commit fc720a3
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion source/SpinalHDL/Libraries/Misc/service_plugin.rst
Original file line number Diff line number Diff line change
@@ -30,6 +30,33 @@ While VexRiscv use a strict synchronous 2 phase system (setup/build callback), N

The Plugin API provide a NaxRiscv like system to define composable components using plugins.

Execution order
--------------------

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

- Setup phase, in which plugins can lock/retain each others. The idea is not to start negociation / elaboration yet.
- Build phase, in which plugins can negociation / elaboration hardware.

The build phase will not start before all FiberPlugin are done with their setup phase.

.. code-block:: scala
class MyPlugin extends FiberPlugin {
val logic = during setup new Area {
// Here we are executing code in the setup phase
awaitBuild()
// Here we are executing code in the build phase
}
}
class MyPlugin2 extends FiberPlugin {
val logic = during build new Area {
// Here we are executing code in the build phase
}
}
Simple example
--------------------

@@ -114,7 +141,7 @@ Here is an example based on the above `Simple example` but that time, the Driver
by an amount set by other plugins (SetupPlugin in our case). And to ensure that the DriverPlugin doesn't generate the hardware too early,
the SetupPlugin uses the DriverPlugin.retain/release functions.

.. code-block:: verilog
.. code-block:: scala
import spinal.core._
import spinal.lib.misc.plugin._

0 comments on commit fc720a3

Please sign in to comment.