diff options
author | Friedrich Beckmann <friedrich.beckmann@hs-augsburg.de> | 2022-07-25 17:55:39 +0200 |
---|---|---|
committer | Friedrich Beckmann <friedrich.beckmann@hs-augsburg.de> | 2022-07-25 17:55:39 +0200 |
commit | 3fff6023602822531efdae30bc8ebf862967f1ef (patch) | |
tree | 16028102b8d850f8ab3115d28a8539ca6bc5f51d /VexRiscv/src/main/scala/vexriscv/plugin/Plugin.scala |
Initial Commit
Diffstat (limited to 'VexRiscv/src/main/scala/vexriscv/plugin/Plugin.scala')
-rw-r--r-- | VexRiscv/src/main/scala/vexriscv/plugin/Plugin.scala | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/VexRiscv/src/main/scala/vexriscv/plugin/Plugin.scala b/VexRiscv/src/main/scala/vexriscv/plugin/Plugin.scala new file mode 100644 index 0000000..96d2bc6 --- /dev/null +++ b/VexRiscv/src/main/scala/vexriscv/plugin/Plugin.scala @@ -0,0 +1,25 @@ +package vexriscv.plugin + +import vexriscv.{Pipeline, Stage} +import spinal.core.{Area, Nameable} + +/** + * Created by PIC32F_USER on 03/03/2017. + */ +trait Plugin[T <: Pipeline] extends Nameable{ + var pipeline : T = null.asInstanceOf[T] + setName(this.getClass.getSimpleName.replace("$","")) + + // Used to setup things with other plugins + def setup(pipeline: T) : Unit = {} + + //Used to flush out the required hardware (called after setup) + def build(pipeline: T) : Unit + + implicit class implicitsStage(stage: Stage){ + def plug[T <: Area](area : T) : T = {area.setCompositeName(stage,getName()).reflectNames();area} + } + implicit class implicitsPipeline(stage: Pipeline){ + def plug[T <: Area](area : T) = {area.setName(getName()).reflectNames();area} + } +} |