summaryrefslogtreecommitdiff
path: root/plugin/src/main
diff options
context:
space:
mode:
authorAdam Izraelevitz2020-09-14 10:17:49 -0700
committerGitHub2020-09-14 17:17:49 +0000
commit69e27b2fd9e02d4e3a024eec0cafce5b4b46c10a (patch)
treeda496ac9fcc2ae6d02560edf9cf10d10e9b3964b /plugin/src/main
parent3b5fda0c604b393833769250ade9f7d13ca4e5e7 (diff)
Documentation and minor plugin changes. (#1573)
* Added documentation. Bugfix in plugin. Moved plugin APIs to separate package * Revert reg naming behavior (omit underscore) * Added documentation and a test * Addressed reviewer feedback.
Diffstat (limited to 'plugin/src/main')
-rw-r--r--plugin/src/main/resources/scalac-plugin.xml2
-rw-r--r--plugin/src/main/scala-2.12/chisel3/internal/plugin/ChiselPlugin.scala (renamed from plugin/src/main/scala-2.12/chisel3/plugin/ChiselPlugin.scala)18
2 files changed, 10 insertions, 10 deletions
diff --git a/plugin/src/main/resources/scalac-plugin.xml b/plugin/src/main/resources/scalac-plugin.xml
index b2b44fc6..abe51d12 100644
--- a/plugin/src/main/resources/scalac-plugin.xml
+++ b/plugin/src/main/resources/scalac-plugin.xml
@@ -1,4 +1,4 @@
<plugin>
<name>chiselplugin</name>
- <classname>chisel3.plugin.ChiselPlugin</classname>
+ <classname>chisel3.internal.plugin.ChiselPlugin</classname>
</plugin>
diff --git a/plugin/src/main/scala-2.12/chisel3/plugin/ChiselPlugin.scala b/plugin/src/main/scala-2.12/chisel3/internal/plugin/ChiselPlugin.scala
index 3b3b52e9..2197430c 100644
--- a/plugin/src/main/scala-2.12/chisel3/plugin/ChiselPlugin.scala
+++ b/plugin/src/main/scala-2.12/chisel3/internal/plugin/ChiselPlugin.scala
@@ -1,6 +1,6 @@
// See LICENSE for license details.
-package chisel3.plugin
+package chisel3.internal.plugin
import scala.tools.nsc
import nsc.{Global, Phase}
@@ -13,14 +13,14 @@ import scala.tools.nsc.transform.TypingTransformers
class ChiselPlugin(val global: Global) extends Plugin {
val name = "chiselplugin"
val description = "Plugin for Chisel 3 Hardware Description Language"
- val components = List[PluginComponent](new ChiselComponent(global))
+ val components: List[PluginComponent] = List[PluginComponent](new ChiselComponent(global))
}
// The component of the chisel plugin. Not sure exactly what the difference is between
// a Plugin and a PluginComponent.
class ChiselComponent(val global: Global) extends PluginComponent with TypingTransformers {
import global._
- val runsAfter = List[String]("typer")
+ val runsAfter: List[String] = List[String]("typer")
val phaseName: String = "chiselcomponent"
def newPhase(_prev: Phase): ChiselComponentPhase = new ChiselComponentPhase(_prev)
class ChiselComponentPhase(prev: Phase) extends StdPhase(prev) {
@@ -115,21 +115,21 @@ class ChiselComponent(val global: Global) extends PluginComponent with TypingTra
// If a Data and in a Bundle, just get the name but not a prefix
case dd @ ValDef(mods, name, tpt, rhs) if okVal(dd, tq"chisel3.Data") && inBundle(dd) =>
val TermName(str: String) = name
- val newRHS = super.transform(rhs)
- val named = q"chisel3.experimental.autoNameRecursively($str, $newRHS)"
+ val newRHS = transform(rhs)
+ val named = q"chisel3.internal.plugin.autoNameRecursively($str, $newRHS)"
treeCopy.ValDef(dd, mods, name, tpt, localTyper typed named)
// If a Data or a Memory, get the name and a prefix
case dd @ ValDef(mods, name, tpt, rhs) if okVal(dd, tq"chisel3.Data", tq"chisel3.MemBase[_]") =>
val TermName(str: String) = name
- val newRHS = super.transform(rhs)
+ val newRHS = transform(rhs)
val prefixed = q"chisel3.experimental.prefix.apply[$tpt](name=$str)(f=$newRHS)"
- val named = q"chisel3.experimental.autoNameRecursively($str, $prefixed)"
+ val named = q"chisel3.internal.plugin.autoNameRecursively($str, $prefixed)"
treeCopy.ValDef(dd, mods, name, tpt, localTyper typed named)
// If an instance, just get a name but no prefix
case dd @ ValDef(mods, name, tpt, rhs) if okVal(dd, tq"chisel3.experimental.BaseModule") =>
val TermName(str: String) = name
- val newRHS = super.transform(rhs)
- val named = q"chisel3.experimental.autoNameRecursively($str, $newRHS)"
+ val newRHS = transform(rhs)
+ val named = q"chisel3.internal.plugin.autoNameRecursively($str, $newRHS)"
treeCopy.ValDef(dd, mods, name, tpt, localTyper typed named)
// Otherwise, continue
case _ => super.transform(tree)