summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAditya Naik2024-05-29 17:28:22 -0700
committerAditya Naik2024-05-29 17:28:22 -0700
commitbc92bb62f9f6a090e74392993e4fcfdd1f6b0676 (patch)
tree160eb4cc2770eaf0c189fab9442d04b2b00b7919
parent878d488a7c8e0d6973de58b3164022c6a102e449 (diff)
i got 99 errors but "firrtl not found" aint one
-rw-r--r--build.sbt273
-rw-r--r--core/src/main/scala/chisel3/Aggregate.scala134
-rw-r--r--core/src/main/scala/chisel3/Bits.scala450
-rw-r--r--core/src/main/scala/chisel3/Clock.scala9
-rw-r--r--core/src/main/scala/chisel3/CompileOptions.scala10
-rw-r--r--core/src/main/scala/chisel3/Data.scala19
-rw-r--r--core/src/main/scala/chisel3/Mem.scala90
-rw-r--r--core/src/main/scala/chisel3/Module.scala16
-rw-r--r--core/src/main/scala/chisel3/MultiClock.scala2
-rw-r--r--core/src/main/scala/chisel3/Mux.scala9
-rw-r--r--core/src/main/scala/chisel3/Num.scala65
-rw-r--r--core/src/main/scala/chisel3/Printf.scala28
-rw-r--r--core/src/main/scala/chisel3/RawModule.scala13
-rw-r--r--core/src/main/scala/chisel3/Reg.scala2
-rw-r--r--core/src/main/scala/chisel3/SeqUtils.scala21
-rw-r--r--core/src/main/scala/chisel3/VerificationStatement.scala1080
-rw-r--r--core/src/main/scala/chisel3/When.scala1
-rw-r--r--core/src/main/scala/chisel3/experimental/ChiselEnum.scala60
-rw-r--r--core/src/main/scala/chisel3/experimental/package.scala126
-rw-r--r--core/src/main/scala/chisel3/internal/MonoConnect.scala1
-rw-r--r--core/src/main/scala/chisel3/internal/Namer.scala4
-rw-r--r--core/src/main/scala/chisel3/internal/SourceInfo.scala17
-rw-r--r--project/build.properties2
23 files changed, 952 insertions, 1480 deletions
diff --git a/build.sbt b/build.sbt
index 9d89766f..62664213 100644
--- a/build.sbt
+++ b/build.sbt
@@ -2,13 +2,11 @@
import com.typesafe.tools.mima.core._
-enablePlugins(SiteScaladocPlugin)
+Compile / compile / logLevel := Level.Error
-val defaultVersions = Map(
- "firrtl" -> "edu.berkeley.cs" %% "firrtl" % "1.5.6",
- "treadle" -> "edu.berkeley.cs" %% "treadle" % "1.5.6",
- "chiseltest" -> "edu.berkeley.cs" %% "chiseltest" % "0.5.6",
-)
+// enablePlugins(SiteScaladocPlugin)
+
+val scala3Version = "3.4.1"
lazy val commonSettings = Seq (
resolvers ++= Seq(
@@ -18,10 +16,10 @@ lazy val commonSettings = Seq (
organization := "edu.berkeley.cs",
version := "3.5.6",
autoAPIMappings := true,
- scalaVersion := "2.12.17",
- crossScalaVersions := Seq("2.13.10", "2.12.17"),
- scalacOptions := Seq("-deprecation", "-feature"),
- libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
+ scalaVersion := scala3Version,
+ crossScalaVersions := Seq("2.13.10", "2.12.17", scala3Version),
+ scalacOptions := Seq("-rewrite", "-source:3.4-migration"),
+ // libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
// Macros paradise is integrated into 2.13 but requires a scalacOption
scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
@@ -29,12 +27,12 @@ lazy val commonSettings = Seq (
case _ => Nil
}
},
- libraryDependencies ++= {
- CrossVersion.partialVersion(scalaVersion.value) match {
- case Some((2, n)) if n >= 13 => Nil
- case _ => compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full) :: Nil
- }
- }
+ // libraryDependencies ++= {
+ // CrossVersion.partialVersion(scalaVersion.value) match {
+ // case Some((2, n)) if n >= 13 => Nil
+ // case _ => compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full) :: Nil
+ // }
+ // }
)
lazy val publishSettings = Seq (
@@ -72,114 +70,98 @@ lazy val publishSettings = Seq (
lazy val chiselSettings = Seq (
name := "chisel3",
-
- libraryDependencies ++= Seq(
- "org.scalatest" %% "scalatest" % "3.2.10" % "test",
- "org.scalatestplus" %% "scalacheck-1-14" % "3.2.2.0" % "test",
- "com.lihaoyi" %% "os-lib" % "0.8.0",
- ),
-) ++ (
- // Tests from other projects may still run concurrently
- // if we're not running with -DminimalResources.
- // Another option would be to experiment with:
- // concurrentRestrictions in Global += Tags.limit(Tags.Test, 1),
- sys.props.contains("minimalResources") match {
- case true => Seq( Test / parallelExecution := false )
- case false => Seq( fork := true,
- Test / testForkedParallel := true )
- }
)
-autoCompilerPlugins := true
+// autoCompilerPlugins := true
// Plugin must be fully cross-versioned (published for Scala minor version)
// The plugin only works in Scala 2.12+
-lazy val pluginScalaVersions = Seq(
- // scalamacros paradise version used is not published for 2.12.0 and 2.12.1
- "2.12.2",
- "2.12.3",
- "2.12.4",
- "2.12.5",
- "2.12.6",
- "2.12.7",
- "2.12.8",
- "2.12.9",
- "2.12.10",
- "2.12.11",
- "2.12.12",
- "2.12.13",
- "2.12.14",
- "2.12.15",
- "2.12.16",
- "2.12.17",
- "2.13.0",
- "2.13.1",
- "2.13.2",
- "2.13.3",
- "2.13.4",
- "2.13.5",
- "2.13.6",
- "2.13.7",
- "2.13.8",
- "2.13.9",
- "2.13.10",
-)
+// lazy val pluginScalaVersions = Seq(
+// // scalamacros paradise version used is not published for 2.12.0 and 2.12.1
+// "2.12.2",
+// "2.12.3",
+// "2.12.4",
+// "2.12.5",
+// "2.12.6",
+// "2.12.7",
+// "2.12.8",
+// "2.12.9",
+// "2.12.10",
+// "2.12.11",
+// "2.12.12",
+// "2.12.13",
+// "2.12.14",
+// "2.12.15",
+// "2.12.16",
+// "2.12.17",
+// "2.13.0",
+// "2.13.1",
+// "2.13.2",
+// "2.13.3",
+// "2.13.4",
+// "2.13.5",
+// "2.13.6",
+// "2.13.7",
+// "2.13.8",
+// "2.13.9",
+// "2.13.10",
+// )
-lazy val plugin = (project in file("plugin")).
- settings(name := "chisel3-plugin").
- settings(commonSettings: _*).
- settings(publishSettings: _*).
- settings(
- libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
- scalacOptions += "-Xfatal-warnings",
- crossScalaVersions := pluginScalaVersions,
- // Must be published for Scala minor version
- crossVersion := CrossVersion.full,
- crossTarget := {
- // workaround for https://github.com/sbt/sbt/issues/5097
- target.value / s"scala-${scalaVersion.value}"
- }
- ).
- settings(
- // Given that the plugin is 1) a compile-time only dependency and 2) package chisel3.internal,
- // I'm not really sure why we both checking binary compatbility
- mimaBinaryIssueFilters ++= Seq(
- // MyTypingTransformer is private (https://github.com/lightbend/mima/issues/53)
- ProblemFilters.exclude[DirectMissingMethodProblem]("chisel3.internal.plugin.BundleComponent#MyTypingTransformer.isBundle"),
- ProblemFilters.exclude[DirectMissingMethodProblem]("chisel3.internal.plugin.BundleComponent#MyTypingTransformer.getConstructorAndParams")
- ),
- mimaPreviousArtifacts := {
- // There are not yet artifacts for 2.12.17, 2.13.9, nor 2.13.10; suppress until 3.5.5 is released
- val skipVersions = Seq("2.12.17", "2.13.9", "2.13.10")
- if (skipVersions.contains(scalaVersion.value)) {
- Set()
- } else {
- Set("edu.berkeley.cs" % "chisel3-plugin" % "3.5.4" cross CrossVersion.full)
- }
- }
- )
+// lazy val plugin = (project in file("plugin")).
+// settings(name := "chisel3-plugin").
+// settings(commonSettings: _*).
+// settings(publishSettings: _*).
+// settings(
+// // libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
+// scalacOptions += "-Xfatal-warnings",
+// crossScalaVersions := pluginScalaVersions,
+// // Must be published for Scala minor version
+// crossVersion := CrossVersion.full,
+// crossTarget := {
+// // workaround for https://github.com/sbt/sbt/issues/5097
+// target.value / s"scala-${scalaVersion.value}"
+// }
+// ).
+// settings(
+// // Given that the plugin is 1) a compile-time only dependency and 2) package chisel3.internal,
+// // I'm not really sure why we both checking binary compatbility
+// mimaBinaryIssueFilters ++= Seq(
+// // MyTypingTransformer is private (https://github.com/lightbend/mima/issues/53)
+// ProblemFilters.exclude[DirectMissingMethodProblem]("chisel3.internal.plugin.BundleComponent#MyTypingTransformer.isBundle"),
+// ProblemFilters.exclude[DirectMissingMethodProblem]("chisel3.internal.plugin.BundleComponent#MyTypingTransformer.getConstructorAndParams")
+// ),
+// mimaPreviousArtifacts := {
+// // There are not yet artifacts for 2.12.17, 2.13.9, nor 2.13.10; suppress until 3.5.5 is released
+// val skipVersions = Seq("2.12.17", "2.13.9", "2.13.10")
+// if (skipVersions.contains(scalaVersion.value)) {
+// Set()
+// } else {
+// Set("edu.berkeley.cs" % "chisel3-plugin" % "3.5.4" cross CrossVersion.full)
+// }
+// }
+// )
-lazy val usePluginSettings = Seq(
- scalacOptions in Compile ++= {
- val jar = (plugin / Compile / Keys.`package`).value
- val addPlugin = "-Xplugin:" + jar.getAbsolutePath
- // add plugin timestamp to compiler options to trigger recompile of
- // main after editing the plugin. (Otherwise a 'clean' is needed.)
- val dummy = "-Jdummy=" + jar.lastModified
- Seq(addPlugin, dummy)
- }
-)
+// lazy val usePluginSettings = Seq(
+// scalacOptions in Compile ++= {
+// val jar = (plugin / Compile / Keys.`package`).value
+// val addPlugin = "-Xplugin:" + jar.getAbsolutePath
+// // add plugin timestamp to compiler options to trigger recompile of
+// // main after editing the plugin. (Otherwise a 'clean' is needed.)
+// val dummy = "-Jdummy=" + jar.lastModified
+// Seq(addPlugin, dummy)
+// }
+// )
-lazy val macros = (project in file("macros")).
- settings(name := "chisel3-macros").
- settings(commonSettings: _*).
- settings(publishSettings: _*).
- settings(mimaPreviousArtifacts := Set("edu.berkeley.cs" %% "chisel3-macros" % "3.5.4"))
+// lazy val macros = (project in file("macros")).
+// settings(name := "chisel3-macros").
+// settings(commonSettings: _*).
+// settings(publishSettings: _*).
+// settings(mimaPreviousArtifacts := Set("edu.berkeley.cs" %% "chisel3-macros" % "3.5.4"))
-lazy val firrtlRef = ProjectRef(workspaceDirectory / "firrtl", "firrtl")
+// lazy val firrtlRef = ProjectRef(workspaceDirectory / "firrtl", "firrtl")
lazy val core = (project in file("core")).
- sourceDependency(firrtlRef, defaultVersions("firrtl")).
+ // sourceDependency(firrtlRef, defaultVersions("firrtl")).
settings(commonSettings: _*).
enablePlugins(BuildInfoPlugin).
settings(
@@ -189,6 +171,7 @@ lazy val core = (project in file("core")).
).
settings(publishSettings: _*).
settings(
+ libraryDependencies += "edu.berkeley.cs" % "firrtl_3" % "1.6-SNAPSHOT",
mimaPreviousArtifacts := Set("edu.berkeley.cs" %% "chisel3-core" % "3.5.4"),
mimaBinaryIssueFilters ++= Seq(
// This is not a problem because the relevant method is implemented (and final) in Vec and Record
@@ -227,33 +210,33 @@ lazy val core = (project in file("core")).
"-Xlint:infer-any"
// , "-Xlint:missing-interpolator"
)
- ).
- dependsOn(macros)
+ )
+ // dependsOn(macros)
// This will always be the root project, even if we are a sub-project.
lazy val root = RootProject(file("."))
lazy val chisel = (project in file(".")).
- enablePlugins(ScalaUnidocPlugin).
+ // enablePlugins(ScalaUnidocPlugin).
settings(commonSettings: _*).
settings(chiselSettings: _*).
settings(publishSettings: _*).
- settings(usePluginSettings: _*).
- dependsOn(macros).
+ // settings(usePluginSettings: _*).
+ // dependsOn(macros).
dependsOn(core).
- aggregate(macros, core, plugin).
+ aggregate(core).
settings(
mimaPreviousArtifacts := Set("edu.berkeley.cs" %% "chisel3" % "3.5.4"),
mimaBinaryIssueFilters ++= Seq(
// Modified package private methods (https://github.com/lightbend/mima/issues/53)
ProblemFilters.exclude[DirectMissingMethodProblem]("chisel3.stage.ChiselOptions.this"),
),
- libraryDependencies += defaultVersions("treadle") % "test",
- Test / scalacOptions += "-P:chiselplugin:genBundleElements",
+ // libraryDependencies += defaultVersions("treadle") % "test",
+ // Test / scalacOptions += "-P:chiselplugin:genBundleElements",
// Forward doc command to unidoc
- Compile / doc := (ScalaUnidoc / doc).value,
+ // Compile / doc := (ScalaUnidoc / doc).value,
// Include unidoc as the ScalaDoc for publishing
- Compile / packageDoc / mappings := (ScalaUnidoc / packageDoc / mappings).value,
+ // Compile / packageDoc / mappings := (ScalaUnidoc / packageDoc / mappings).value,
scalacOptions in Test ++= Seq("-language:reflectiveCalls"),
scalacOptions in Compile in doc ++= Seq(
"-diagrams",
@@ -274,13 +257,13 @@ lazy val chisel = (project in file(".")).
}
s"https://github.com/chipsalliance/chisel3/tree/$branch€{FILE_PATH_EXT}#L€{FILE_LINE}"
}
- ) ++
+ )
// Suppress compiler plugin for source files in core
// We don't need this in regular compile because we just don't add the chisel3-plugin to core's scalacOptions
// This works around an issue where unidoc uses the exact same arguments for all source files.
// This is probably fundamental to how ScalaDoc works so there may be no solution other than this workaround.
// See https://github.com/sbt/sbt-unidoc/issues/107
- (core / Compile / sources).value.map("-P:chiselplugin:INTERNALskipFile:" + _)
+ // (core / Compile / sources).value.map("-P:chiselplugin:INTERNALskipFile:" + _)
)
// tests elaborating and executing/formally verifying a Chisel circuit with chiseltest
@@ -288,30 +271,30 @@ lazy val integrationTests = (project in file ("integration-tests")).
dependsOn(chisel).
settings(commonSettings: _*).
settings(chiselSettings: _*).
- settings(usePluginSettings: _*).
+ // settings(usePluginSettings: _*).
settings(Seq(
libraryDependencies += "edu.berkeley.cs" %% "chiseltest" % "0.5-SNAPSHOT" % "test"
))
-lazy val docs = project // new documentation project
- .in(file("docs-target")) // important: it must not be docs/
- .dependsOn(chisel)
- .enablePlugins(MdocPlugin)
- .settings(usePluginSettings: _*)
- .settings(commonSettings)
- .settings(
- scalacOptions ++= Seq(
- "-language:reflectiveCalls",
- "-language:implicitConversions"
- ),
- mdocIn := file("docs/src"),
- mdocOut := file("docs/generated"),
- // None of our links are hygienic because they're primarily used on the website with .html
- mdocExtraArguments := Seq("--cwd", "docs", "--no-link-hygiene"),
- mdocVariables := Map(
- "BUILD_DIR" -> "docs-target" // build dir for mdoc programs to dump temp files
- )
- )
+// lazy val docs = project // new documentation project
+// .in(file("docs-target")) // important: it must not be docs/
+// .dependsOn(chisel)
+// // .enablePlugins(MdocPlugin)
+// // .settings(usePluginSettings: _*)
+// .settings(commonSettings)
+// .settings(
+// scalacOptions ++= Seq(
+// "-language:reflectiveCalls",
+// "-language:implicitConversions"
+// ),
+// mdocIn := file("docs/src"),
+// mdocOut := file("docs/generated"),
+// // None of our links are hygienic because they're primarily used on the website with .html
+// mdocExtraArguments := Seq("--cwd", "docs", "--no-link-hygiene"),
+// mdocVariables := Map(
+// "BUILD_DIR" -> "docs-target" // build dir for mdoc programs to dump temp files
+// )
+// )
addCommandAlias("com", "all compile")
addCommandAlias("lint", "; compile:scalafix --check ; test:scalafix --check")
diff --git a/core/src/main/scala/chisel3/Aggregate.scala b/core/src/main/scala/chisel3/Aggregate.scala
index 5d460c2d..52d96ce6 100644
--- a/core/src/main/scala/chisel3/Aggregate.scala
+++ b/core/src/main/scala/chisel3/Aggregate.scala
@@ -6,7 +6,6 @@ import chisel3.experimental.VecLiterals.AddVecLiteralConstructor
import scala.collection.immutable.{SeqMap, VectorMap}
import scala.collection.mutable.{HashSet, LinkedHashMap}
-import scala.language.experimental.macros
import chisel3.experimental.{BaseModule, BundleLiteralException, OpaqueType, VecLiteralException}
import chisel3.internal._
import chisel3.internal.Builder.pushCommand
@@ -68,8 +67,8 @@ sealed abstract class Aggregate extends Data {
}
}
- override def do_asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
- SeqUtils.do_asUInt(flatten.map(_.asUInt()))
+ override def asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
+ SeqUtils.asUInt(flatten.map(_.asUInt()))
}
private[chisel3] override def connectFromBits(
@@ -95,7 +94,7 @@ sealed abstract class Aggregate extends Data {
}
}
-trait VecFactory extends SourceInfoDoc {
+trait VecFactory {
/** Creates a new [[Vec]] with `n` entries of the specified data type.
*
@@ -112,9 +111,6 @@ trait VecFactory extends SourceInfoDoc {
private[chisel3] def truncateIndex(
idx: UInt,
n: BigInt
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
): UInt = {
val w = (n - 1).bitLength
if (n <= 1) 0.U
@@ -167,7 +163,7 @@ sealed class Vec[T <: Data] private[chisel3] (gen: => T, val length: Int) extend
private[chisel3] override def typeEquivalent(that: Data): Boolean = that match {
case that: Vec[T] =>
this.length == that.length &&
- (this.sample_element.typeEquivalent(that.sample_element))
+ (this.sample_element.typeEquivalent(that.sample_element))
case _ => false
}
@@ -246,10 +242,7 @@ sealed class Vec[T <: Data] private[chisel3] (gen: => T, val length: Int) extend
/** Creates a dynamically indexed read or write accessor into the array.
*/
- override def apply(p: UInt): T = macro CompileOptionsTransform.pArg
-
- /** @group SourceInfoTransformMacro */
- def do_apply(p: UInt)(implicit compileOptions: CompileOptions): T = {
+ def apply(p: UInt)(implicit compileOptions: CompileOptions): T = {
requireIsHardware(this, "vec")
requireIsHardware(p, "vec index")
@@ -305,8 +298,6 @@ sealed class Vec[T <: Data] private[chisel3] (gen: => T, val length: Int) extend
* val sumOut = inputNums.reduceTree((a: T, b: T) => (a + b))
* }}}
*/
- def reduceTree(redOp: (T, T) => T): T = macro VecTransform.reduceTreeDefault
-
/** A reduce operation in a tree like structure instead of sequentially
* @example A pipelined adder tree
* {{{
@@ -316,9 +307,7 @@ sealed class Vec[T <: Data] private[chisel3] (gen: => T, val length: Int) extend
* )
* }}}
*/
- def reduceTree(redOp: (T, T) => T, layerOp: (T) => T): T = macro VecTransform.reduceTree
-
- def do_reduceTree(
+ def reduceTree(
redOp: (T, T) => T,
layerOp: (T) => T = (x: T) => x
)(
@@ -523,7 +512,7 @@ sealed class Vec[T <: Data] private[chisel3] (gen: => T, val length: Int) extend
}
}
-object VecInit extends SourceInfoDoc {
+object VecInit {
/** Gets the correct connect operation (directed hardware assign or bulk connect) for element in Vec.
*/
@@ -553,10 +542,7 @@ object VecInit extends SourceInfoDoc {
* element
* @note output elements are connected from the input elements
*/
- def apply[T <: Data](elts: Seq[T]): Vec[T] = macro VecTransform.apply_elts
-
- /** @group SourceInfoTransformMacro */
- def do_apply[T <: Data](elts: Seq[T])(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = {
+ def apply[T <: Data](elts: Seq[T])(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = {
// REVIEW TODO: this should be removed in favor of the apply(elts: T*)
// varargs constructor, which is more in line with the style of the Scala
// collection API. However, a deprecation phase isn't possible, since
@@ -585,10 +571,7 @@ object VecInit extends SourceInfoDoc {
* element
* @note output elements are connected from the input elements
*/
- def apply[T <: Data](elt0: T, elts: T*): Vec[T] = macro VecTransform.apply_elt0
-
- /** @group SourceInfoTransformMacro */
- def do_apply[T <: Data](elt0: T, elts: T*)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] =
+ def apply[T <: Data](elt0: T, elts: T*)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] =
apply(elt0 +: elts.toSeq)
/** Creates a new [[Vec]] of length `n` composed of the results of the given
@@ -599,10 +582,7 @@ object VecInit extends SourceInfoDoc {
* @param gen function that takes in an Int (the index) and returns a
* [[Data]] that becomes the output element
*/
- def tabulate[T <: Data](n: Int)(gen: (Int) => T): Vec[T] = macro VecTransform.tabulate
-
- /** @group SourceInfoTransformMacro */
- def do_tabulate[T <: Data](
+ def tabulate[T <: Data](
n: Int
)(gen: (Int) => T
)(
@@ -620,10 +600,7 @@ object VecInit extends SourceInfoDoc {
* @param gen function that takes in an Int (the index) and returns a
* [[Data]] that becomes the output element
*/
- def tabulate[T <: Data](n: Int, m: Int)(gen: (Int, Int) => T): Vec[Vec[T]] = macro VecTransform.tabulate2D
-
- /** @group SourceInfoTransformMacro */
- def do_tabulate[T <: Data](
+ def tabulate[T <: Data](
n: Int,
m: Int
)(gen: (Int, Int) => T
@@ -659,11 +636,7 @@ object VecInit extends SourceInfoDoc {
* @param gen function that takes in an Int (the index) and returns a
* [[Data]] that becomes the output element
*/
- def tabulate[T <: Data](n: Int, m: Int, p: Int)(gen: (Int, Int, Int) => T): Vec[Vec[Vec[T]]] =
- macro VecTransform.tabulate3D
-
- /** @group SourceInfoTransformMacro */
- def do_tabulate[T <: Data](
+ def tabulate[T <: Data](
n: Int,
m: Int,
p: Int
@@ -701,10 +674,7 @@ object VecInit extends SourceInfoDoc {
* @param gen function that takes in an element T and returns an output
* element of the same type
*/
- def fill[T <: Data](n: Int)(gen: => T): Vec[T] = macro VecTransform.fill
-
- /** @group SourceInfoTransformMacro */
- def do_fill[T <: Data](n: Int)(gen: => T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] =
+ def fill[T <: Data](n: Int)(gen: => T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] =
apply(Seq.fill(n)(gen))
/** Creates a new 2D [[Vec]] of length `n by m` composed of the result of the given
@@ -715,10 +685,7 @@ object VecInit extends SourceInfoDoc {
* @param gen function that takes in an element T and returns an output
* element of the same type
*/
- def fill[T <: Data](n: Int, m: Int)(gen: => T): Vec[Vec[T]] = macro VecTransform.fill2D
-
- /** @group SourceInfoTransformMacro */
- def do_fill[T <: Data](
+ def fill[T <: Data](
n: Int,
m: Int
)(gen: => T
@@ -726,7 +693,7 @@ object VecInit extends SourceInfoDoc {
implicit sourceInfo: SourceInfo,
compileOptions: CompileOptions
): Vec[Vec[T]] = {
- do_tabulate(n, m)((_, _) => gen)
+ tabulate(n, m)((_, _) => gen)
}
/** Creates a new 3D [[Vec]] of length `n by m by p` composed of the result of the given
@@ -738,10 +705,7 @@ object VecInit extends SourceInfoDoc {
* @param gen function that takes in an element T and returns an output
* element of the same type
*/
- def fill[T <: Data](n: Int, m: Int, p: Int)(gen: => T): Vec[Vec[Vec[T]]] = macro VecTransform.fill3D
-
- /** @group SourceInfoTransformMacro */
- def do_fill[T <: Data](
+ def fill[T <: Data](
n: Int,
m: Int,
p: Int
@@ -750,7 +714,7 @@ object VecInit extends SourceInfoDoc {
implicit sourceInfo: SourceInfo,
compileOptions: CompileOptions
): Vec[Vec[Vec[T]]] = {
- do_tabulate(n, m, p)((_, _, _) => gen)
+ tabulate(n, m, p)((_, _, _) => gen)
}
/** Creates a new [[Vec]] of length `n` composed of the result of the given
@@ -761,10 +725,7 @@ object VecInit extends SourceInfoDoc {
* @param f Function that applies the element T from previous index and returns the output
* element to the next index
*/
- def iterate[T <: Data](start: T, len: Int)(f: (T) => T): Vec[T] = macro VecTransform.iterate
-
- /** @group SourceInfoTransformMacro */
- def do_iterate[T <: Data](
+ def iterate[T <: Data](
start: T,
len: Int
)(f: (T) => T
@@ -773,16 +734,12 @@ object VecInit extends SourceInfoDoc {
compileOptions: CompileOptions
): Vec[T] =
apply(Seq.iterate(start, len)(f))
-}
-/** A trait for [[Vec]]s containing common hardware generators for collection
- * operations.
- */
-trait VecLike[T <: Data] extends IndexedSeq[T] with HasId with SourceInfoDoc {
- def apply(p: UInt): T = macro CompileOptionsTransform.pArg
- /** @group SourceInfoTransformMacro */
- def do_apply(p: UInt)(implicit compileOptions: CompileOptions): T
+ /** A trait for [[Vec]]s containing common hardware generators for collection
+ * operations.
+ */
+ def apply[T <: Data](p: UInt)(implicit compileOptions: CompileOptions): T
// IndexedSeq has its own hashCode/equals that we must not use
override def hashCode: Int = super[HasId].hashCode
@@ -790,35 +747,23 @@ trait VecLike[T <: Data] extends IndexedSeq[T] with HasId with SourceInfoDoc {
/** Outputs true if p outputs true for every element.
*/
- def forall(p: T => Bool): Bool = macro SourceInfoTransform.pArg
-
- /** @group SourceInfoTransformMacro */
- def do_forall(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def forall[T <: Data](p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
(this.map(p)).fold(true.B)(_ && _)
/** Outputs true if p outputs true for at least one element.
*/
- def exists(p: T => Bool): Bool = macro SourceInfoTransform.pArg
-
- /** @group SourceInfoTransformMacro */
- def do_exists(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def exists(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
(this.map(p)).fold(false.B)(_ || _)
/** Outputs true if the vector contains at least one element equal to x (using
* the === operator).
*/
- def contains(x: T)(implicit ev: T <:< UInt): Bool = macro VecTransform.contains
-
- /** @group SourceInfoTransformMacro */
- def do_contains(x: T)(implicit sourceInfo: SourceInfo, ev: T <:< UInt, compileOptions: CompileOptions): Bool =
+ def contains(x: T)(implicit sourceInfo: SourceInfo, ev: T <:< UInt, compileOptions: CompileOptions): Bool =
this.exists(_ === x)
/** Outputs the number of elements for which p is true.
*/
- def count(p: T => Bool): UInt = macro SourceInfoTransform.pArg
-
- /** @group SourceInfoTransformMacro */
- def do_count(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def count(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
SeqUtils.count(this.map(p))
/** Helper function that appends an index (literal value) to each element,
@@ -828,18 +773,12 @@ trait VecLike[T <: Data] extends IndexedSeq[T] with HasId with SourceInfoDoc {
/** Outputs the index of the first element for which p outputs true.
*/
- def indexWhere(p: T => Bool): UInt = macro SourceInfoTransform.pArg
-
- /** @group SourceInfoTransformMacro */
- def do_indexWhere(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def indexWhere(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
SeqUtils.priorityMux(indexWhereHelper(p))
/** Outputs the index of the last element for which p outputs true.
*/
- def lastIndexWhere(p: T => Bool): UInt = macro SourceInfoTransform.pArg
-
- /** @group SourceInfoTransformMacro */
- def do_lastIndexWhere(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def lastIndexWhere(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
SeqUtils.priorityMux(indexWhereHelper(p).reverse)
/** Outputs the index of the element for which p outputs true, assuming that
@@ -852,10 +791,7 @@ trait VecLike[T <: Data] extends IndexedSeq[T] with HasId with SourceInfoDoc {
* true is NOT checked (useful in cases where the condition doesn't always
* hold, but the results are not used in those cases)
*/
- def onlyIndexWhere(p: T => Bool): UInt = macro SourceInfoTransform.pArg
-
- /** @group SourceInfoTransformMacro */
- def do_onlyIndexWhere(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def onlyIndexWhere(p: T => Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
SeqUtils.oneHotMux(indexWhereHelper(p))
}
@@ -1110,12 +1046,12 @@ abstract class Record(private[chisel3] implicit val compileOptions: CompileOptio
private[chisel3] override def typeEquivalent(that: Data): Boolean = that match {
case that: Record =>
this.getClass == that.getClass &&
- this.elements.size == that.elements.size &&
- this.elements.forall {
- case (name, model) =>
- that.elements.contains(name) &&
- (that.elements(name).typeEquivalent(model))
- }
+ this.elements.size == that.elements.size &&
+ this.elements.forall {
+ case (name, model) =>
+ that.elements.contains(name) &&
+ (that.elements(name).typeEquivalent(model))
+ }
case _ => false
}
diff --git a/core/src/main/scala/chisel3/Bits.scala b/core/src/main/scala/chisel3/Bits.scala
index 2811f30d..b73eaa8a 100644
--- a/core/src/main/scala/chisel3/Bits.scala
+++ b/core/src/main/scala/chisel3/Bits.scala
@@ -2,8 +2,6 @@
package chisel3
-import scala.language.experimental.macros
-
import chisel3.internal._
import chisel3.internal.Builder.pushOp
import chisel3.internal.firrtl._
@@ -23,21 +21,7 @@ import _root_.firrtl.{constraint => firrtlconstraint}
* @note This is a workaround because macros cannot override abstract methods.
*/
private[chisel3] sealed trait ToBoolable extends Element {
-
- /** Casts this $coll to a [[Bool]]
- *
- * @note The width must be known and equal to 1
- */
- final def asBool: Bool = macro SourceInfoWhiteboxTransform.noArg
-
- @deprecated(
- "Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
- "Chisel 3.5"
- )
- final def asBool(dummy: Int*): Bool = macro SourceInfoWhiteboxTransform.noArgDummy
-
- /** @group SourceInfoTransformMacro */
- def do_asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
+ def asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
}
/** A data type for values represented by a single bitvector. This provides basic bitwise operations.
@@ -64,7 +48,6 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @return This $coll with the `n` most significant bits removed.
* @group Bitwise
*/
- final def tail(n: Int): UInt = macro SourceInfoTransform.nArg
/** Head operator
*
@@ -72,10 +55,8 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @return The `n` most significant bits of this $coll
* @group Bitwise
*/
- final def head(n: Int): UInt = macro SourceInfoTransform.nArg
- /** @group SourceInfoTransformMacro */
- def do_tail(n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
+ def tail(n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
val w = width match {
case KnownWidth(x) =>
require(x >= n, s"Can't tail($n) for width $x < $n")
@@ -85,8 +66,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
binop(sourceInfo, UInt(width = w), TailOp, n)
}
- /** @group SourceInfoTransformMacro */
- def do_head(n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
+ def head(n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
width match {
case KnownWidth(x) => require(x >= n, s"Can't head($n) for width $x < $n")
case UnknownWidth() =>
@@ -99,10 +79,8 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @param x an index
* @return the specified bit
*/
- final def extract(x: BigInt): Bool = macro SourceInfoTransform.xArg
- /** @group SourceInfoTransformMacro */
- final def do_extract(x: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
+ final def extract(x: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
if (x < 0) {
Builder.error(s"Negative bit indices are illegal (got $x)")
}
@@ -127,10 +105,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @param x an index
* @return the specified bit
*/
- final def apply(x: BigInt): Bool = macro IntLiteralApplyTransform.safeApply
-
- /** @group SourceInfoTransformMacro */
- final def do_apply(x: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ final def apply(x: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
do_extract(x)
/** Returns the specified bit on this $coll as a [[Bool]], statically addressed.
@@ -138,10 +113,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @param x an index
* @return the specified bit
*/
- final def apply(x: Int): Bool = macro IntLiteralApplyTransform.safeApply
-
- /** @group SourceInfoTransformMacro */
- final def do_apply(x: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ final def apply(x: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
do_extract(BigInt(x))
/** Returns the specified bit on this wire as a [[Bool]], dynamically addressed.
@@ -149,10 +121,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @param x a hardware component whose value will be used for dynamic addressing
* @return the specified bit
*/
- final def extract(x: UInt): Bool = macro SourceInfoTransform.xArg
-
- /** @group SourceInfoTransformMacro */
- final def do_extract(x: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
+ final def extract(x: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
val theBits = this >> x
theBits(0)
}
@@ -162,10 +131,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @param x a hardware component whose value will be used for dynamic addressing
* @return the specified bit
*/
- final def apply(x: UInt): Bool = macro SourceInfoTransform.xArg
-
- /** @group SourceInfoTransformMacro */
- final def do_apply(x: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ final def apply(x: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
do_extract(x)
/** Returns a subset of bits on this $coll from `hi` to `lo` (inclusive), statically addressed.
@@ -179,10 +145,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @param y the low bit
* @return a hardware component contain the requested bits
*/
- final def apply(x: Int, y: Int): UInt = macro SourceInfoTransform.xyArg
-
- /** @group SourceInfoTransformMacro */
- final def do_apply(x: Int, y: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
+ final def apply(x: Int, y: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
if (x < y || y < 0) {
Builder.error(s"Invalid bit range ($x,$y)")
}
@@ -216,10 +179,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @param y the low bit
* @return a hardware component contain the requested bits
*/
- final def apply(x: BigInt, y: BigInt): UInt = macro SourceInfoTransform.xyArg
-
- /** @group SourceInfoTransformMacro */
- final def do_apply(x: BigInt, y: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ final def apply(x: BigInt, y: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
do_apply(castToInt(x, "High index"), castToInt(y, "Low index"))
private[chisel3] def unop[T <: Data](sourceInfo: SourceInfo, dest: T, op: PrimOp): T = {
@@ -253,10 +213,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @note For [[SInt]]s only, this will do sign extension.
* @group Bitwise
*/
- final def pad(that: Int): this.type = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_pad(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): this.type = this.width match {
+ def pad(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): this.type = this.width match {
case KnownWidth(w) if w >= that => this
case _ => binop(sourceInfo, cloneTypeWidth(this.width.max(Width(that))), PadOp, that)
}
@@ -266,16 +223,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @return this $coll with each bit inverted
* @group Bitwise
*/
- final def unary_~ : Bits = macro SourceInfoWhiteboxTransform.noArg
-
- @deprecated(
- "Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
- "Chisel 3.5"
- )
- final def unary_~(dummy: Int*): Bits = macro SourceInfoWhiteboxTransform.noArgDummy
-
- /** @group SourceInfoTransformMacro */
- def do_unary_~(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
+ def unary_~(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
/** Static left shift operator
*
@@ -284,12 +232,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* $sumWidthInt
* @group Bitwise
*/
- // REVIEW TODO: redundant
- // REVIEW TODO: should these return this.type or Bits?
- final def <<(that: BigInt): Bits = macro SourceInfoWhiteboxTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_<<(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
+ def <<(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
/** Static left shift operator
*
@@ -298,10 +241,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* $sumWidthInt
* @group Bitwise
*/
- final def <<(that: Int): Bits = macro SourceInfoWhiteboxTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_<<(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
+ def <<(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
/** Dynamic left shift operator
*
@@ -310,10 +250,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @note The width of the returned $coll is `width of this + pow(2, width of that) - 1`.
* @group Bitwise
*/
- final def <<(that: UInt): Bits = macro SourceInfoWhiteboxTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_<<(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
+ def <<(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
/** Static right shift operator
*
@@ -322,11 +259,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* $unchangedWidth
* @group Bitwise
*/
- // REVIEW TODO: redundant
- final def >>(that: BigInt): Bits = macro SourceInfoWhiteboxTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_>>(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
+ def >>(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
/** Static right shift operator
*
@@ -335,10 +268,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* $unchangedWidth
* @group Bitwise
*/
- final def >>(that: Int): Bits = macro SourceInfoWhiteboxTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_>>(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
+ def >>(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
/** Dynamic right shift operator
*
@@ -348,22 +278,10 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* $unchangedWidth
* @group Bitwise
*/
- final def >>(that: UInt): Bits = macro SourceInfoWhiteboxTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_>>(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
+ def >>(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bits
/** Returns the contents of this wire as a [[scala.collection.Seq]] of [[Bool]]. */
- final def asBools: Seq[Bool] = macro SourceInfoTransform.noArg
-
- @deprecated(
- "Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
- "Chisel 3.5"
- )
- final def asBools(dummy: Int*): Seq[Bool] = macro SourceInfoWhiteboxTransform.noArgDummy
-
- /** @group SourceInfoTransformMacro */
- def do_asBools(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Seq[Bool] =
+ def asBools(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Seq[Bool] =
Seq.tabulate(this.getWidth)(i => this(i))
/** Reinterpret this $coll as an [[SInt]]
@@ -371,18 +289,9 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* @note The arithmetic value is not preserved if the most-significant bit is set. For example, a [[UInt]] of
* width 3 and value 7 (0b111) would become an [[SInt]] of width 3 and value -1.
*/
- final def asSInt: SInt = macro SourceInfoTransform.noArg
-
- @deprecated(
- "Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
- "Chisel 3.5"
- )
- final def asSInt(dummy: Int*): SInt = macro SourceInfoWhiteboxTransform.noArgDummy
-
- /** @group SourceInfoTransformMacro */
- def do_asSInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt
+ def asSInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt
- final def do_asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
+ final def asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
width match {
case KnownWidth(1) => this(0)
case _ => throwException(s"can't covert ${this.getClass.getSimpleName}$width to Bool")
@@ -396,10 +305,7 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
* $sumWidth
* @group Bitwise
*/
- final def ##(that: Bits): UInt = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_##(that: Bits)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
+ def ##(that: Bits)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
val w = this.width + that.width
pushOp(DefPrim(sourceInfo, UInt(w), ConcatOp, this.ref, that.ref))
}
@@ -443,13 +349,10 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $constantWidth
* @group Arithmetic
*/
- final def unary_- : UInt = macro SourceInfoTransform.noArg
-
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def unary_-(dummy: Int*): UInt = macro SourceInfoTransform.noArgDummy
/** Unary negation (constant width)
*
@@ -457,27 +360,19 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $constantWidth
* @group Arithmetic
*/
- final def unary_-% : UInt = macro SourceInfoTransform.noArg
- @deprecated(
- "Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
- "Chisel 3.5"
- )
- final def unary_%(dummy: Int*): UInt = macro SourceInfoTransform.noArgDummy
+ def unary_-(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = 0.U - this
- /** @group SourceInfoTransformMacro */
- def do_unary_-(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = 0.U - this
- /** @group SourceInfoTransformMacro */
- def do_unary_-%(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = 0.U -% this
+ def unary_-%(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = 0.U -% this
- override def do_+(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = this +% that
- override def do_-(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = this -% that
- override def do_/(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def +(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = this +% that
+ override def -(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = this -% that
+ override def /(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width), DivideOp, that)
- override def do_%(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def %(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width.min(that.width)), RemOp, that)
- override def do_*(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def *(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width + that.width), TimesOp, that)
/** Multiplication operator
@@ -488,10 +383,7 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $singleCycleMul
* @group Arithmetic
*/
- final def *(that: SInt): SInt = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_*(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = that * this
+ def *(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = that * this
/** Addition operator (expanding width)
*
@@ -500,7 +392,6 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $maxWidthPlusOne
* @group Arithmetic
*/
- final def +&(that: UInt): UInt = macro SourceInfoTransform.thatArg
/** Addition operator (constant width)
*
@@ -509,7 +400,6 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $maxWidth
* @group Arithmetic
*/
- final def +%(that: UInt): UInt = macro SourceInfoTransform.thatArg
/** Subtraction operator (increasing width)
*
@@ -518,7 +408,6 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $maxWidthPlusOne
* @group Arithmetic
*/
- final def -&(that: UInt): UInt = macro SourceInfoTransform.thatArg
/** Subtraction operator (constant width)
*
@@ -527,22 +416,17 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $maxWidth
* @group Arithmetic
*/
- final def -%(that: UInt): UInt = macro SourceInfoTransform.thatArg
- /** @group SourceInfoTransformMacro */
- def do_+&(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def +&(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt((this.width.max(that.width)) + 1), AddOp, that)
- /** @group SourceInfoTransformMacro */
- def do_+%(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def +%(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
(this +& that).tail(1)
- /** @group SourceInfoTransformMacro */
- def do_-&(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def -&(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
(this.subtractAsSInt(that)).asUInt
- /** @group SourceInfoTransformMacro */
- def do_-%(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def -%(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
(this.subtractAsSInt(that)).tail(1)
/** Bitwise and operator
@@ -552,7 +436,6 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $maxWidth
* @group Bitwise
*/
- final def &(that: UInt): UInt = macro SourceInfoTransform.thatArg
/** Bitwise or operator
*
@@ -561,7 +444,6 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $maxWidth
* @group Bitwise
*/
- final def |(that: UInt): UInt = macro SourceInfoTransform.thatArg
/** Bitwise exclusive or (xor) operator
*
@@ -570,25 +452,19 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* $maxWidth
* @group Bitwise
*/
- final def ^(that: UInt): UInt = macro SourceInfoTransform.thatArg
- // override def abs: UInt = macro SourceInfoTransform.noArgDummy
- def do_abs(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = this
+ def abs(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = this
- /** @group SourceInfoTransformMacro */
- def do_&(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def &(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width.max(that.width)), BitAndOp, that)
- /** @group SourceInfoTransformMacro */
- def do_|(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def |(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width.max(that.width)), BitOrOp, that)
- /** @group SourceInfoTransformMacro */
- def do_^(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def ^(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width.max(that.width)), BitXorOp, that)
- /** @group SourceInfoTransformMacro */
- def do_unary_~(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def unary_~(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
unop(sourceInfo, UInt(width = width), BitNotOp)
// REVIEW TODO: Can these be defined on Bits?
@@ -597,56 +473,47 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* @return a hardware [[Bool]] resulting from every bit of this $coll or'd together
* @group Bitwise
*/
- final def orR: Bool = macro SourceInfoTransform.noArg
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def orR(dummy: Int*): Bool = macro SourceInfoTransform.noArgDummy
/** And reduction operator
*
* @return a hardware [[Bool]] resulting from every bit of this $coll and'd together
* @group Bitwise
*/
- final def andR: Bool = macro SourceInfoTransform.noArg
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def andR(dummy: Int*): Bool = macro SourceInfoTransform.noArgDummy
/** Exclusive or (xor) reduction operator
*
* @return a hardware [[Bool]] resulting from every bit of this $coll xor'd together
* @group Bitwise
*/
- final def xorR: Bool = macro SourceInfoTransform.noArg
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def xorR(dummy: Int*): Bool = macro SourceInfoTransform.noArgDummy
- /** @group SourceInfoTransformMacro */
- def do_orR(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = redop(sourceInfo, OrReduceOp)
+ def orR(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = redop(sourceInfo, OrReduceOp)
- /** @group SourceInfoTransformMacro */
- def do_andR(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = redop(sourceInfo, AndReduceOp)
+ def andR(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = redop(sourceInfo, AndReduceOp)
- /** @group SourceInfoTransformMacro */
- def do_xorR(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = redop(sourceInfo, XorReduceOp)
+ def xorR(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = redop(sourceInfo, XorReduceOp)
- override def do_<(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ override def <(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, LessOp, that)
- override def do_>(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ override def >(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, GreaterOp, that)
- override def do_<=(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ override def <=(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, LessEqOp, that)
- override def do_>=(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ override def >=(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, GreaterEqOp, that)
/** Dynamic not equals operator
@@ -655,7 +522,6 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* @return a hardware [[Bool]] asserted if this $coll is not equal to `that`
* @group Comparison
*/
- final def =/=(that: UInt): Bool = macro SourceInfoTransform.thatArg
/** Dynamic equals operator
*
@@ -663,14 +529,10 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* @return a hardware [[Bool]] asserted if this $coll is equal to `that`
* @group Comparison
*/
- final def ===(that: UInt): Bool = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_=/=(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def =/=(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, NotEqualOp, that)
- /** @group SourceInfoTransformMacro */
- def do_===(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def ===(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, EqualOp, that)
/** Unary not
@@ -678,28 +540,25 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* @return a hardware [[Bool]] asserted if this $coll equals zero
* @group Bitwise
*/
- final def unary_! : Bool = macro SourceInfoTransform.noArg
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def unary_!(dummy: Int*): Bool = macro SourceInfoTransform.noArgDummy
- /** @group SourceInfoTransformMacro */
- def do_unary_!(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = this === 0.U(1.W)
+ def unary_!(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = this === 0.U(1.W)
- override def do_<<(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def <<(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width + that), ShiftLeftOp, validateShiftAmount(that))
- override def do_<<(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def <<(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
this << castToInt(that, "Shift amount")
- override def do_<<(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def <<(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width.dynamicShiftLeft(that.width)), DynamicShiftLeftOp, that)
- override def do_>>(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def >>(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width.shiftRight(that)), ShiftRightOp, validateShiftAmount(that))
- override def do_>>(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def >>(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
this >> castToInt(that, "Shift amount")
- override def do_>>(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def >>(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
binop(sourceInfo, UInt(this.width), DynamicShiftRightOp, that)
/**
@@ -707,9 +566,7 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* @param that number of bits to rotate
* @return UInt of same width rotated left n bits
*/
- final def rotateLeft(that: Int): UInt = macro SourceInfoWhiteboxTransform.thatArg
-
- def do_rotateLeft(n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = width match {
+ def rotateLeft(n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = width match {
case _ if (n == 0) => this
case KnownWidth(w) if (w <= 1) => this
case KnownWidth(w) if n >= w => do_rotateLeft(n % w)
@@ -722,17 +579,13 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* @param that number of bits to rotate
* @return UInt of same width rotated right n bits
*/
- final def rotateRight(that: Int): UInt = macro SourceInfoWhiteboxTransform.thatArg
-
- def do_rotateRight(n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = width match {
+ def rotateRight(n: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = width match {
case _ if (n <= 0) => do_rotateLeft(-n)
case KnownWidth(w) if (w <= 1) => this
case KnownWidth(w) if n >= w => do_rotateRight(n % w)
case _ => this(n - 1, 0) ## (this >> n)
}
- final def rotateRight(that: UInt): UInt = macro SourceInfoWhiteboxTransform.thatArg
-
private def dynamicShift(
n: UInt,
staticShift: (UInt, Int) => UInt
@@ -744,12 +597,10 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
case (in, (en, sh)) => Mux(en, staticShift(in, 1 << sh), in)
}
- def do_rotateRight(n: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def rotateRight(n: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
dynamicShift(n, _ rotateRight _)
- final def rotateLeft(that: UInt): UInt = macro SourceInfoWhiteboxTransform.thatArg
-
- def do_rotateLeft(n: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ def rotateLeft(n: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
dynamicShift(n, _ rotateLeft _)
/** Conditionally set or clear a bit
@@ -759,10 +610,7 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* @return a hrdware $coll with bit `off` set or cleared based on the value of `dat`
* $unchangedWidth
*/
- final def bitSet(off: UInt, dat: Bool): UInt = macro UIntTransform.bitset
-
- /** @group SourceInfoTransformMacro */
- def do_bitSet(off: UInt, dat: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
+ def bitSet(off: UInt, dat: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
val bit = 1.U(1.W) << off
Mux(dat, this | bit, ~(~this | bit))
}
@@ -774,21 +622,16 @@ sealed class UInt private[chisel3] (width: Width) extends Bits(width) with Num[U
* @return an [[SInt]] equal to this $coll with an additional zero in its most significant bit
* @note The width of the returned [[SInt]] is `width of this` + `1`.
*/
- final def zext: SInt = macro SourceInfoTransform.noArg
-
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def zext(dummy: Int*): SInt = macro SourceInfoTransform.noArgDummy
-
- /** @group SourceInfoTransformMacro */
- def do_zext(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ def zext(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
pushOp(DefPrim(sourceInfo, SInt(width + 1), ConvertOp, ref))
- override def do_asSInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def asSInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
pushOp(DefPrim(sourceInfo, SInt(width), AsSIntOp, ref))
- override def do_asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = this
+ override def asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = this
private[chisel3] override def connectFromBits(
that: Bits
@@ -831,46 +674,37 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* $constantWidth
* @group Arithmetic
*/
- final def unary_- : SInt = macro SourceInfoTransform.noArg
-
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def unary_-(dummy: Int*): SInt = macro SourceInfoTransform.noArgDummy
-
/** Unary negation (constant width)
*
* @return a hardware $coll equal to zero minus `this` shifted right by one
* $constantWidth
* @group Arithmetic
*/
- final def unary_-% : SInt = macro SourceInfoTransform.noArg
-
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def unary_-%(dummy: Int*): SInt = macro SourceInfoTransform.noArgDummy
- /** @group SourceInfoTransformMacro */
- def do_unary_-(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = 0.S - this
+ def unary_-(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = 0.S - this
- /** @group SourceInfoTransformMacro */
- def do_unary_-%(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = 0.S -% this
+ def unary_-%(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = 0.S -% this
/** add (default - no growth) operator */
- override def do_+(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def +(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
this +% that
/** subtract (default - no growth) operator */
- override def do_-(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def -(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
this -% that
- override def do_*(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def *(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, SInt(this.width + that.width), TimesOp, that)
- override def do_/(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def /(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, SInt(this.width + 1), DivideOp, that)
- override def do_%(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def %(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, SInt(this.width.min(that.width)), RemOp, that)
/** Multiplication operator
@@ -881,10 +715,7 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* $singleCycleMul
* @group Arithmetic
*/
- final def *(that: UInt): SInt = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_*(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = {
+ def *(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = {
val thatToSInt = that.zext
val result = binop(sourceInfo, SInt(this.width + thatToSInt.width), TimesOp, thatToSInt)
result.tail(1).asSInt
@@ -897,8 +728,6 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* $maxWidthPlusOne
* @group Arithmetic
*/
- final def +&(that: SInt): SInt = macro SourceInfoTransform.thatArg
-
/** Addition operator (constant width)
*
* @param that a hardware $coll
@@ -906,8 +735,6 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* $maxWidth
* @group Arithmetic
*/
- final def +%(that: SInt): SInt = macro SourceInfoTransform.thatArg
-
/** Subtraction operator (increasing width)
*
* @param that a hardware $coll
@@ -915,8 +742,6 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* $maxWidthPlusOne
* @group Arithmetic
*/
- final def -&(that: SInt): SInt = macro SourceInfoTransform.thatArg
-
/** Subtraction operator (constant width)
*
* @param that a hardware $coll
@@ -924,22 +749,16 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* $maxWidth
* @group Arithmetic
*/
- final def -%(that: SInt): SInt = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_+&(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ def +&(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, SInt((this.width.max(that.width)) + 1), AddOp, that)
- /** @group SourceInfoTransformMacro */
- def do_+%(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ def +%(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
(this +& that).tail(1).asSInt
- /** @group SourceInfoTransformMacro */
- def do_-&(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ def -&(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, SInt((this.width.max(that.width)) + 1), SubOp, that)
- /** @group SourceInfoTransformMacro */
- def do_-%(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ def -%(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
(this -& that).tail(1).asSInt
/** Bitwise and operator
@@ -949,8 +768,6 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* $maxWidth
* @group Bitwise
*/
- final def &(that: SInt): SInt = macro SourceInfoTransform.thatArg
-
/** Bitwise or operator
*
* @param that a hardware $coll
@@ -958,8 +775,6 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* $maxWidth
* @group Bitwise
*/
- final def |(that: SInt): SInt = macro SourceInfoTransform.thatArg
-
/** Bitwise exclusive or (xor) operator
*
* @param that a hardware $coll
@@ -967,31 +782,25 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* $maxWidth
* @group Bitwise
*/
- final def ^(that: SInt): SInt = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_&(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ def &(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, UInt(this.width.max(that.width)), BitAndOp, that).asSInt
- /** @group SourceInfoTransformMacro */
- def do_|(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ def |(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, UInt(this.width.max(that.width)), BitOrOp, that).asSInt
- /** @group SourceInfoTransformMacro */
- def do_^(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ def ^(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, UInt(this.width.max(that.width)), BitXorOp, that).asSInt
- /** @group SourceInfoTransformMacro */
- def do_unary_~(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ def unary_~(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
unop(sourceInfo, UInt(width = width), BitNotOp).asSInt
- override def do_<(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ override def <(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, LessOp, that)
- override def do_>(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ override def >(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, GreaterOp, that)
- override def do_<=(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ override def <=(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, LessEqOp, that)
- override def do_>=(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ override def >=(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, GreaterEqOp, that)
/** Dynamic not equals operator
@@ -1000,54 +809,46 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
* @return a hardware [[Bool]] asserted if this $coll is not equal to `that`
* @group Comparison
*/
- final def =/=(that: SInt): Bool = macro SourceInfoTransform.thatArg
-
/** Dynamic equals operator
*
* @param that a hardware $coll
* @return a hardware [[Bool]] asserted if this $coll is equal to `that`
* @group Comparison
*/
- final def ===(that: SInt): Bool = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_=/=(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def =/=(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, NotEqualOp, that)
- /** @group SourceInfoTransformMacro */
- def do_===(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def ===(that: SInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, EqualOp, that)
-// final def abs(): UInt = macro SourceInfoTransform.noArgDummy
-
- def do_abs(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = {
+ def abs(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = {
Mux(this < 0.S, -this, this)
}
- override def do_<<(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def <<(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, SInt(this.width + that), ShiftLeftOp, validateShiftAmount(that))
- override def do_<<(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def <<(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
this << castToInt(that, "Shift amount")
- override def do_<<(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def <<(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, SInt(this.width.dynamicShiftLeft(that.width)), DynamicShiftLeftOp, that)
- override def do_>>(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def >>(that: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, SInt(this.width.shiftRight(that)), ShiftRightOp, validateShiftAmount(that))
- override def do_>>(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def >>(that: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
this >> castToInt(that, "Shift amount")
- override def do_>>(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
+ override def >>(that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt =
binop(sourceInfo, SInt(this.width), DynamicShiftRightOp, that)
- override def do_asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = pushOp(
+ override def asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = pushOp(
DefPrim(sourceInfo, UInt(this.width), AsUIntOp, ref)
)
- override def do_asSInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = this
+ override def asSInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt = this
private[chisel3] override def connectFromBits(
that: Bits
)(
implicit sourceInfo: SourceInfo,
compileOptions: CompileOptions
- ) {
+ ) = {
this := that.asSInt
}
}
@@ -1055,16 +856,11 @@ sealed class SInt private[chisel3] (width: Width) extends Bits(width) with Num[S
sealed trait Reset extends Element with ToBoolable {
/** Casts this $coll to an [[AsyncReset]] */
- final def asAsyncReset: AsyncReset = macro SourceInfoWhiteboxTransform.noArg
-
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def asAsyncReset(dummy: Int*): AsyncReset = macro SourceInfoTransform.noArgDummy
-
- /** @group SourceInfoTransformMacro */
- def do_asAsyncReset(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): AsyncReset
+ def asAsyncReset(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): AsyncReset
}
object Reset {
@@ -1102,16 +898,13 @@ final class ResetType(private[chisel3] val width: Width = Width(1)) extends Elem
this := that
}
- /** @group SourceInfoTransformMacro */
- def do_asAsyncReset(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): AsyncReset =
+ def asAsyncReset(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): AsyncReset =
pushOp(DefPrim(sourceInfo, AsyncReset(), AsAsyncResetOp, ref))
- /** @group SourceInfoTransformMacro */
- def do_asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
pushOp(DefPrim(sourceInfo, Bool(), AsUIntOp, ref))
- /** @group SourceInfoTransformMacro */
- def do_toBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = do_asBool
+ def toBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = asBool
}
object AsyncReset {
@@ -1137,7 +930,7 @@ sealed class AsyncReset(private[chisel3] val width: Width = Width(1)) extends El
/** Not really supported */
def toPrintable: Printable = PString("AsyncReset")
- override def do_asUInt(implicit sourceInfo: SourceInfo, connectCompileOptions: CompileOptions): UInt = pushOp(
+ override def asUInt(implicit sourceInfo: SourceInfo, connectCompileOptions: CompileOptions): UInt = pushOp(
DefPrim(sourceInfo, UInt(this.width), AsUIntOp, ref)
)
@@ -1151,15 +944,12 @@ sealed class AsyncReset(private[chisel3] val width: Width = Width(1)) extends El
this := that.asBool.asAsyncReset
}
- /** @group SourceInfoTransformMacro */
- def do_asAsyncReset(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): AsyncReset = this
+ def asAsyncReset(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): AsyncReset = this
- /** @group SourceInfoTransformMacro */
- def do_asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
pushOp(DefPrim(sourceInfo, Bool(), AsUIntOp, ref))
- /** @group SourceInfoTransformMacro */
- def do_toBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = do_asBool
+ def toBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = asBool
}
// REVIEW TODO: Why does this extend UInt and not Bits? Does defining airth
@@ -1201,7 +991,6 @@ sealed class Bool() extends UInt(1.W) with Reset {
* @return the bitwise and of this $coll and `that`
* @group Bitwise
*/
- final def &(that: Bool): Bool = macro SourceInfoTransform.thatArg
/** Bitwise or operator
*
@@ -1209,7 +998,6 @@ sealed class Bool() extends UInt(1.W) with Reset {
* @return the bitwise or of this $coll and `that`
* @group Bitwise
*/
- final def |(that: Bool): Bool = macro SourceInfoTransform.thatArg
/** Bitwise exclusive or (xor) operator
*
@@ -1217,22 +1005,17 @@ sealed class Bool() extends UInt(1.W) with Reset {
* @return the bitwise xor of this $coll and `that`
* @group Bitwise
*/
- final def ^(that: Bool): Bool = macro SourceInfoTransform.thatArg
- /** @group SourceInfoTransformMacro */
- def do_&(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def &(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
binop(sourceInfo, Bool(), BitAndOp, that)
- /** @group SourceInfoTransformMacro */
- def do_|(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def |(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
binop(sourceInfo, Bool(), BitOrOp, that)
- /** @group SourceInfoTransformMacro */
- def do_^(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def ^(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
binop(sourceInfo, Bool(), BitXorOp, that)
- /** @group SourceInfoTransformMacro */
- override def do_unary_~(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ override def unary_~(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
unop(sourceInfo, Bool(), BitNotOp)
/** Logical or operator
@@ -1242,10 +1025,8 @@ sealed class Bool() extends UInt(1.W) with Reset {
* @note this is equivalent to [[Bool!.|(that:chisel3\.Bool)* Bool.|)]]
* @group Logical
*/
- def ||(that: Bool): Bool = macro SourceInfoTransform.thatArg
- /** @group SourceInfoTransformMacro */
- def do_||(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = this | that
+ def ||(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = this | that
/** Logical and operator
*
@@ -1254,27 +1035,18 @@ sealed class Bool() extends UInt(1.W) with Reset {
* @note this is equivalent to [[Bool!.&(that:chisel3\.Bool)* Bool.&]]
* @group Logical
*/
- def &&(that: Bool): Bool = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_&&(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = this & that
+ def &&(that: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = this & that
/** Reinterprets this $coll as a clock */
- def asClock: Clock = macro SourceInfoTransform.noArg
-
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- def asClock(dummy: Int*): Clock = macro SourceInfoTransform.noArgDummy
-
- /** @group SourceInfoTransformMacro */
- def do_asClock(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Clock = pushOp(
+ def asClock(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Clock = pushOp(
DefPrim(sourceInfo, Clock(), AsClockOp, ref)
)
- /** @group SourceInfoTransformMacro */
- def do_asAsyncReset(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): AsyncReset =
+ def asAsyncReset(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): AsyncReset =
pushOp(DefPrim(sourceInfo, AsyncReset(), AsAsyncResetOp, ref))
}
diff --git a/core/src/main/scala/chisel3/Clock.scala b/core/src/main/scala/chisel3/Clock.scala
index 64e91c42..aee6bc5a 100644
--- a/core/src/main/scala/chisel3/Clock.scala
+++ b/core/src/main/scala/chisel3/Clock.scala
@@ -2,7 +2,6 @@
package chisel3
-import scala.language.experimental.macros
import chisel3.internal.Builder.pushOp
import chisel3.internal.firrtl._
import chisel3.internal.sourceinfo._
@@ -33,17 +32,13 @@ sealed class Clock(private[chisel3] val width: Width = Width(1)) extends Element
def toPrintable: Printable = PString("CLOCK")
/** Returns the contents of the clock wire as a [[Bool]]. */
- final def asBool: Bool = macro SourceInfoTransform.noArg
-
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def asBool(dummy: Int*): Bool = macro SourceInfoTransform.noArgDummy
-
- def do_asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = this.asUInt.asBool
+ def asBool(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = this.asUInt.asBool
- override def do_asUInt(implicit sourceInfo: SourceInfo, connectCompileOptions: CompileOptions): UInt = pushOp(
+ override def asUInt(implicit sourceInfo: SourceInfo, connectCompileOptions: CompileOptions): UInt = pushOp(
DefPrim(sourceInfo, UInt(this.width), AsUIntOp, ref)
)
private[chisel3] override def connectFromBits(
diff --git a/core/src/main/scala/chisel3/CompileOptions.scala b/core/src/main/scala/chisel3/CompileOptions.scala
index aca00d1f..f74d8fff 100644
--- a/core/src/main/scala/chisel3/CompileOptions.scala
+++ b/core/src/main/scala/chisel3/CompileOptions.scala
@@ -2,9 +2,6 @@
package chisel3
-import scala.language.experimental.macros
-import scala.reflect.macros.blackbox.Context
-
trait CompileOptions {
/** Should Record connections require a strict match of fields.
@@ -40,14 +37,7 @@ trait CompileOptions {
}
object CompileOptions {
- // Provides a low priority Strict default. Can be overridden by importing the NotStrict option.
- // Implemented as a macro to prevent this from being used inside chisel core.
- implicit def materialize: CompileOptions = macro materialize_impl
- def materialize_impl(c: Context): c.Tree = {
- import c.universe._
- q"_root_.chisel3.ExplicitCompileOptions.Strict"
- }
}
object ExplicitCompileOptions {
diff --git a/core/src/main/scala/chisel3/Data.scala b/core/src/main/scala/chisel3/Data.scala
index ec5a6321..a80392f6 100644
--- a/core/src/main/scala/chisel3/Data.scala
+++ b/core/src/main/scala/chisel3/Data.scala
@@ -2,7 +2,6 @@
package chisel3
-import scala.language.experimental.macros
import chisel3.experimental.{Analog, BaseModule, DataMirror}
import chisel3.internal.Builder.pushCommand
import chisel3.internal._
@@ -442,7 +441,7 @@ object Flipped {
* @groupdesc Connect Utilities for connecting hardware components
* @define coll data
*/
-abstract class Data extends HasId with NamedComponent with SourceInfoDoc {
+abstract class Data extends HasId with NamedComponent {
// This is a bad API that punches through object boundaries.
@deprecated("pending removal once all instances replaced", "chisel3")
private[chisel3] def flatten: IndexedSeq[Element] = {
@@ -496,7 +495,7 @@ abstract class Data extends HasId with NamedComponent with SourceInfoDoc {
private def _binding: Option[Binding] = Option(_bindingVar)
// Only valid after node is bound (synthesizable), crashes otherwise
protected[chisel3] def binding: Option[Binding] = _binding
- protected def binding_=(target: Binding) {
+ protected def binding_=(target: Binding) = {
if (_binding.isDefined) {
throw RebindingException(s"Attempted reassignment of binding to $this, from: ${target}")
}
@@ -536,7 +535,7 @@ abstract class Data extends HasId with NamedComponent with SourceInfoDoc {
private def _direction: Option[ActualDirection] = Option(_directionVar)
private[chisel3] def direction: ActualDirection = _direction.get
- private[chisel3] def direction_=(actualDirection: ActualDirection) {
+ private[chisel3] def direction_=(actualDirection: ActualDirection) = {
if (_direction.isDefined) {
throw RebindingException(s"Attempted reassignment of resolved direction to $this")
}
@@ -828,10 +827,7 @@ abstract class Data extends HasId with NamedComponent with SourceInfoDoc {
* @note bit widths are NOT checked, may pad or drop bits from input
* @note that should have known widths
*/
- def asTypeOf[T <: Data](that: T): T = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_asTypeOf[T <: Data](that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = {
+ def asTypeOf[T <: Data](that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = {
val thatCloned = Wire(that.cloneTypeFull)
thatCloned.connectFromBits(this.asUInt)
thatCloned
@@ -853,16 +849,11 @@ abstract class Data extends HasId with NamedComponent with SourceInfoDoc {
* @note Aggregates are recursively packed with the first element appearing
* in the least-significant bits of the result.
*/
- final def asUInt: UInt = macro SourceInfoTransform.noArg
-
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def asUInt(dummy: Int*): UInt = macro SourceInfoTransform.noArgDummy
-
- /** @group SourceInfoTransformMacro */
- def do_asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt
+ def asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt
/** Default pretty printing */
def toPrintable: Printable
diff --git a/core/src/main/scala/chisel3/Mem.scala b/core/src/main/scala/chisel3/Mem.scala
index 91872979..9180cb63 100644
--- a/core/src/main/scala/chisel3/Mem.scala
+++ b/core/src/main/scala/chisel3/Mem.scala
@@ -2,8 +2,6 @@
package chisel3
-import scala.language.experimental.macros
-
import firrtl.{ir => fir}
import chisel3.internal._
@@ -18,17 +16,13 @@ object Mem {
* @param size number of elements in the memory
* @param t data type of memory element
*/
- def apply[T <: Data](size: BigInt, t: T): Mem[T] = macro MemTransform.apply[T]
-
/** Creates a combinational/asynchronous-read, sequential/synchronous-write [[Mem]].
*
* @param size number of elements in the memory
* @param t data type of memory element
*/
- def apply[T <: Data](size: Int, t: T): Mem[T] = macro MemTransform.apply[T]
- /** @group SourceInfoTransformMacro */
- def do_apply[T <: Data](
+ def apply[T <: Data](
size: BigInt,
t: T
)(
@@ -45,9 +39,8 @@ object Mem {
mem
}
- /** @group SourceInfoTransformMacro */
- def do_apply[T <: Data](size: Int, t: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Mem[T] =
- do_apply(BigInt(size), t)(sourceInfo, compileOptions)
+ def apply[T <: Data](size: Int, t: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Mem[T] =
+ apply(BigInt(size), t)(sourceInfo, compileOptions)
}
sealed abstract class MemBase[T <: Data](val t: T, val length: BigInt)
@@ -77,10 +70,7 @@ sealed abstract class MemBase[T <: Data](val t: T, val length: BigInt)
/** Creates a read accessor into the memory with static addressing. See the
* class documentation of the memory for more detailed information.
*/
- def apply(x: BigInt): T = macro SourceInfoTransform.xArg
-
- /** @group SourceInfoTransformMacro */
- def do_apply(idx: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = {
+ def apply(idx: BigInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = {
require(idx >= 0 && idx < length)
apply(idx.asUInt, Builder.forcedClock)
}
@@ -88,45 +78,31 @@ sealed abstract class MemBase[T <: Data](val t: T, val length: BigInt)
/** Creates a read accessor into the memory with static addressing. See the
* class documentation of the memory for more detailed information.
*/
- def apply(x: Int): T = macro SourceInfoTransform.xArg
-
- /** @group SourceInfoTransformMacro */
- def do_apply(idx: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
- do_apply(BigInt(idx))(sourceInfo, compileOptions)
+ def apply(idx: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ apply(BigInt(idx))(sourceInfo, compileOptions)
/** Creates a read/write accessor into the memory with dynamic addressing.
* See the class documentation of the memory for more detailed information.
*/
- def apply(x: UInt): T = macro SourceInfoTransform.xArg
-
- /** @group SourceInfoTransformMacro */
- def do_apply(idx: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
- do_apply_impl(idx, Builder.forcedClock, MemPortDirection.INFER, true)
+ def apply(idx: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ apply_impl(idx, Builder.forcedClock, MemPortDirection.INFER, true)
- def apply(x: UInt, y: Clock): T = macro SourceInfoTransform.xyArg
-
- def do_apply(idx: UInt, clock: Clock)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
- do_apply_impl(idx, clock, MemPortDirection.INFER, false)
+ def apply(idx: UInt, clock: Clock)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ apply_impl(idx, clock, MemPortDirection.INFER, false)
/** Creates a read accessor into the memory with dynamic addressing. See the
* class documentation of the memory for more detailed information.
*/
- def read(x: UInt): T = macro SourceInfoTransform.xArg
-
- /** @group SourceInfoTransformMacro */
- def do_read(idx: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
- do_apply_impl(idx, Builder.forcedClock, MemPortDirection.READ, true)
+ def read(idx: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ apply_impl(idx, Builder.forcedClock, MemPortDirection.READ, true)
/** Creates a read accessor into the memory with dynamic addressing.
* Takes a clock parameter to bind a clock that may be different
* from the implicit clock. See the class documentation of the memory
* for more detailed information.
*/
- def read(x: UInt, y: Clock): T = macro SourceInfoTransform.xyArg
-
- /** @group SourceInfoTransformMacro */
- def do_read(idx: UInt, clock: Clock)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
- do_apply_impl(idx, clock, MemPortDirection.READ, false)
+ def read(idx: UInt, clock: Clock)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ apply_impl(idx, clock, MemPortDirection.READ, false)
protected def do_apply_impl(
idx: UInt,
@@ -297,19 +273,13 @@ object SyncReadMem {
* @param size number of elements in the memory
* @param t data type of memory element
*/
- def apply[T <: Data](size: BigInt, t: T): SyncReadMem[T] = macro MemTransform.apply[T]
- def apply[T <: Data](size: BigInt, t: T, ruw: ReadUnderWrite): SyncReadMem[T] = macro MemTransform.apply_ruw[T]
-
/** Creates a sequential/synchronous-read, sequential/synchronous-write [[SyncReadMem]].
*
* @param size number of elements in the memory
* @param t data type of memory element
*/
- def apply[T <: Data](size: Int, t: T): SyncReadMem[T] = macro MemTransform.apply[T]
- def apply[T <: Data](size: Int, t: T, ruw: ReadUnderWrite): SyncReadMem[T] = macro MemTransform.apply_ruw[T]
-
/** @group SourceInfoTransformMacro */
- def do_apply[T <: Data](
+ def apply[T <: Data](
size: BigInt,
t: T,
ruw: ReadUnderWrite = Undefined
@@ -327,20 +297,18 @@ object SyncReadMem {
mem
}
- /** @group SourceInfoTransformMacro */
// Alternate signatures can't use default parameter values
- def do_apply[T <: Data](
+ def apply[T <: Data](
size: Int,
t: T
)(
implicit sourceInfo: SourceInfo,
compileOptions: CompileOptions
): SyncReadMem[T] =
- do_apply(BigInt(size), t)(sourceInfo, compileOptions)
+ apply(BigInt(size), t)(sourceInfo, compileOptions)
- /** @group SourceInfoTransformMacro */
// Alternate signatures can't use default parameter values
- def do_apply[T <: Data](
+ def apply[T <: Data](
size: Int,
t: T,
ruw: ReadUnderWrite
@@ -348,7 +316,7 @@ object SyncReadMem {
implicit sourceInfo: SourceInfo,
compileOptions: CompileOptions
): SyncReadMem[T] =
- do_apply(BigInt(size), t, ruw)(sourceInfo, compileOptions)
+ apply(BigInt(size), t, ruw)(sourceInfo, compileOptions)
}
/** A sequential/synchronous-read, sequential/synchronous-write memory.
@@ -364,25 +332,15 @@ object SyncReadMem {
sealed class SyncReadMem[T <: Data] private[chisel3] (t: T, n: BigInt, val readUnderWrite: SyncReadMem.ReadUnderWrite)
extends MemBase[T](t, n) {
- override def read(x: UInt): T = macro SourceInfoTransform.xArg
+ override def read(idx: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ read(idx = idx, en = true.B)
- /** @group SourceInfoTransformMacro */
- override def do_read(idx: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
- do_read(idx = idx, en = true.B)
-
- def read(x: UInt, en: Bool): T = macro SourceInfoTransform.xEnArg
-
- /** @group SourceInfoTransformMacro */
- def do_read(idx: UInt, en: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ def read(idx: UInt, en: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
_read_impl(idx, en, Builder.forcedClock, true)
- def read(idx: UInt, en: Bool, clock: Clock): T = macro SourceInfoTransform.xyzArg
-
- /** @group SourceInfoTransformMacro */
- def do_read(idx: UInt, en: Bool, clock: Clock)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ def read(idx: UInt, en: Bool, clock: Clock)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
_read_impl(idx, en, clock, false)
- /** @group SourceInfoTransformMacro */
private def _read_impl(
addr: UInt,
enable: Bool,
@@ -392,7 +350,7 @@ sealed class SyncReadMem[T <: Data] private[chisel3] (t: T, n: BigInt, val readU
implicit sourceInfo: SourceInfo,
compileOptions: CompileOptions
): T = {
- val a = Wire(UInt())
+ val a = Wire(UInt(4.W))
a := DontCare
var port: Option[T] = None
when(enable) {
diff --git a/core/src/main/scala/chisel3/Module.scala b/core/src/main/scala/chisel3/Module.scala
index 794d1bf4..58e585ce 100644
--- a/core/src/main/scala/chisel3/Module.scala
+++ b/core/src/main/scala/chisel3/Module.scala
@@ -4,17 +4,16 @@ package chisel3
import scala.collection.immutable.ListMap
import scala.collection.mutable.{ArrayBuffer, HashMap}
-import scala.language.experimental.macros
import chisel3.internal._
import chisel3.internal.Builder._
import chisel3.internal.firrtl._
-import chisel3.internal.sourceinfo.{InstTransform, SourceInfo, UnlocatableSourceInfo}
+import chisel3.internal.sourceinfo.{SourceInfo, UnlocatableSourceInfo}
import chisel3.experimental.BaseModule
import _root_.firrtl.annotations.{IsModule, ModuleName, ModuleTarget}
import _root_.firrtl.AnnotationSeq
-object Module extends SourceInfoDoc {
+object Module {
/** A wrapper method that all Module instantiations must be wrapped in
* (necessary to help Chisel track internal state).
@@ -23,10 +22,7 @@ object Module extends SourceInfoDoc {
*
* @return the input module `m` with Chisel metadata properly set
*/
- def apply[T <: BaseModule](bc: => T): T = macro InstTransform.apply[T]
-
- /** @group SourceInfoTransformMacro */
- def do_apply[T <: BaseModule](bc: => T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = {
+ def apply[T <: BaseModule](bc: => T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T = {
if (Builder.readyForModuleConstr) {
throwException(
"Error: Called Module() twice without instantiating a Module." +
@@ -250,7 +246,7 @@ package experimental {
// Fresh Namespace because in Firrtl, Modules namespaces are disjoint with the global namespace
private[chisel3] val _namespace = Namespace.empty
private val _ids = ArrayBuffer[HasId]()
- private[chisel3] def addId(d: HasId) {
+ private[chisel3] def addId(d: HasId) = {
require(!_closed, "Can't write to module after module close")
_ids += d
}
@@ -358,7 +354,7 @@ package experimental {
protected def nameIds(rootClass: Class[_]): HashMap[HasId, String] = {
val names = new HashMap[HasId, String]()
- def name(node: HasId, name: String) {
+ def name(node: HasId, name: String) = {
// First name takes priority, like suggestName
// TODO: DRYify with suggestName
if (!names.contains(node)) {
@@ -397,7 +393,7 @@ package experimental {
*
* TODO: remove this, perhaps by removing Bindings checks in compatibility mode.
*/
- def _compatAutoWrapPorts() {}
+ def _compatAutoWrapPorts() = {}
/** Chisel2 code didn't require the IO(...) wrapper and would assign a Chisel type directly to
* io, then do operations on it. This binds a Chisel type in-place (mutably) as an IO.
diff --git a/core/src/main/scala/chisel3/MultiClock.scala b/core/src/main/scala/chisel3/MultiClock.scala
index e96946f5..4809cf29 100644
--- a/core/src/main/scala/chisel3/MultiClock.scala
+++ b/core/src/main/scala/chisel3/MultiClock.scala
@@ -4,8 +4,6 @@ package chisel3
import chisel3.internal._
-import scala.language.experimental.macros
-
object withClockAndReset {
/** Creates a new Clock and Reset scope
diff --git a/core/src/main/scala/chisel3/Mux.scala b/core/src/main/scala/chisel3/Mux.scala
index df56182e..48006bd1 100644
--- a/core/src/main/scala/chisel3/Mux.scala
+++ b/core/src/main/scala/chisel3/Mux.scala
@@ -2,15 +2,13 @@
package chisel3
-import scala.language.experimental.macros
-
import chisel3.internal._
import chisel3.internal.Builder.pushOp
import chisel3.internal.sourceinfo.{MuxTransform, SourceInfo}
import chisel3.internal.firrtl._
import chisel3.internal.firrtl.PrimOp._
-object Mux extends SourceInfoDoc {
+object Mux {
/** Creates a mux, whose output is one of the inputs depending on the
* value of the condition.
@@ -23,10 +21,7 @@ object Mux extends SourceInfoDoc {
* val muxOut = Mux(data_in === 3.U, 3.U(4.W), 0.U(4.W))
* }}}
*/
- def apply[T <: Data](cond: Bool, con: T, alt: T): T = macro MuxTransform.apply[T]
-
- /** @group SourceInfoTransformMacro */
- def do_apply[T <: Data](
+ def apply[T <: Data](
cond: Bool,
con: T,
alt: T
diff --git a/core/src/main/scala/chisel3/Num.scala b/core/src/main/scala/chisel3/Num.scala
index 4a984b5a..59f6db76 100644
--- a/core/src/main/scala/chisel3/Num.scala
+++ b/core/src/main/scala/chisel3/Num.scala
@@ -4,8 +4,7 @@ package chisel3
import chisel3.internal.firrtl.{BinaryPoint, KnownBinaryPoint}
-import scala.language.experimental.macros
-import chisel3.internal.sourceinfo.{SourceInfo, SourceInfoTransform}
+import chisel3.internal.sourceinfo.SourceInfo
// REVIEW TODO: Further discussion needed on what Num actually is.
@@ -41,10 +40,7 @@ trait Num[T <: Data] {
* $maxWidth
* @group Arithmetic
*/
- final def +(that: T): T = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_+(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
+ def +(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
/** Multiplication operator
*
@@ -54,10 +50,7 @@ trait Num[T <: Data] {
* $singleCycleMul
* @group Arithmetic
*/
- final def *(that: T): T = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_*(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
+ def *(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
/** Division operator
*
@@ -67,10 +60,7 @@ trait Num[T <: Data] {
* @todo full rules
* @group Arithmetic
*/
- final def /(that: T): T = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_/(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
+ def /(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
/** Modulo operator
*
@@ -79,10 +69,7 @@ trait Num[T <: Data] {
* $singleCycleDiv
* @group Arithmetic
*/
- final def %(that: T): T = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_%(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
+ def %(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
/** Subtraction operator
*
@@ -91,10 +78,7 @@ trait Num[T <: Data] {
* $maxWidthPlusOne
* @group Arithmetic
*/
- final def -(that: T): T = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_-(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
+ def -(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
/** Less than operator
*
@@ -102,10 +86,7 @@ trait Num[T <: Data] {
* @return a hardware [[Bool]] asserted if this $coll is less than `that`
* @group Comparison
*/
- final def <(that: T): Bool = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_<(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
+ def <(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
/** Less than or equal to operator
*
@@ -113,10 +94,7 @@ trait Num[T <: Data] {
* @return a hardware [[Bool]] asserted if this $coll is less than or equal to `that`
* @group Comparison
*/
- final def <=(that: T): Bool = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_<=(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
+ def <=(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
/** Greater than operator
*
@@ -124,10 +102,7 @@ trait Num[T <: Data] {
* @return a hardware [[Bool]] asserted if this $coll is greater than `that`
* @group Comparison
*/
- final def >(that: T): Bool = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_>(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
+ def >(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
/** Greater than or equal to operator
*
@@ -135,10 +110,7 @@ trait Num[T <: Data] {
* @return a hardware [[Bool]] asserted if this $coll is greather than or equal to `that`
* @group Comparison
*/
- final def >=(that: T): Bool = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_>=(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
+ def >=(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool
/** Absolute value operator
*
@@ -146,16 +118,11 @@ trait Num[T <: Data] {
* $unchangedWidth
* @group Arithmetic
*/
- final def abs: T = macro SourceInfoTransform.noArg
-
@deprecated(
"Calling this function with an empty argument list is invalid in Scala 3. Use the form without parentheses instead",
"Chisel 3.5"
)
- final def abs(dummy: Int*): T = macro SourceInfoTransform.noArgDummy
-
- /** @group SourceInfoTransformMacro */
- def do_abs(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
+ def abs(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T
/** Minimum operator
*
@@ -164,10 +131,7 @@ trait Num[T <: Data] {
* $maxWidth
* @group Arithmetic
*/
- final def min(that: T): T = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_min(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ def min(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
Mux(this < that, this.asInstanceOf[T], that)
/** Maximum operator
@@ -177,10 +141,7 @@ trait Num[T <: Data] {
* $maxWidth
* @group Arithmetic
*/
- final def max(that: T): T = macro SourceInfoTransform.thatArg
-
- /** @group SourceInfoTransformMacro */
- def do_max(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
+ def max(that: T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): T =
Mux(this < that, that, this.asInstanceOf[T])
}
diff --git a/core/src/main/scala/chisel3/Printf.scala b/core/src/main/scala/chisel3/Printf.scala
index a7338072..e7f942f4 100644
--- a/core/src/main/scala/chisel3/Printf.scala
+++ b/core/src/main/scala/chisel3/Printf.scala
@@ -5,8 +5,6 @@ package chisel3
import chisel3.internal._
import chisel3.internal.Builder.pushCommand
import chisel3.internal.sourceinfo.SourceInfo
-import scala.language.experimental.macros
-import scala.reflect.macros.blackbox
/** Prints a message in simulation
*
@@ -37,7 +35,7 @@ object printf {
}
/** Named class for [[printf]]s. */
- final class Printf private[chisel3] (val pable: Printable) extends VerificationStatement
+ final class Printf private[chisel3] (val pable: Printable) // extends VerificationStatement
/** Prints a message in simulation
*
@@ -76,30 +74,6 @@ object printf {
* @param fmt printf format string
* @param data format string varargs containing data to print
*/
- def apply(fmt: String, data: Bits*)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Printf =
- macro _applyMacroWithInterpolatorCheck
-
- def _applyMacroWithInterpolatorCheck(
- c: blackbox.Context
- )(fmt: c.Tree,
- data: c.Tree*
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- fmt match {
- case q"scala.StringContext.apply(..$_).s(..$_)" =>
- c.warning(
- c.enclosingPosition,
- "The s-interpolator prints the Scala .toString of Data objects rather than the value " +
- "of the hardware wire during simulation. Use the cf-interpolator instead. If you want " +
- "an elaboration time print, use println."
- )
- case _ =>
- }
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("printfWithReset"))
- q"$apply_impl_do(_root_.chisel3.Printable.pack($fmt, ..$data))($sourceInfo, $compileOptions)"
- }
// Private internal methods that serve to maintain binary
// compatibility after interpolator check updates
diff --git a/core/src/main/scala/chisel3/RawModule.scala b/core/src/main/scala/chisel3/RawModule.scala
index 19b719e0..71bbcd00 100644
--- a/core/src/main/scala/chisel3/RawModule.scala
+++ b/core/src/main/scala/chisel3/RawModule.scala
@@ -3,7 +3,6 @@
package chisel3
import scala.util.Try
-import scala.language.experimental.macros
import scala.annotation.nowarn
import chisel3.experimental.BaseModule
import chisel3.internal._
@@ -25,7 +24,7 @@ abstract class RawModule(implicit moduleCompileOptions: CompileOptions) extends
// Perhaps this should be an ArrayBuffer (or ArrayBuilder), but DefModule is public and has Seq[Command]
// so our best option is to share a single Seq datastructure with that
private val _commands = new VectorBuilder[Command]()
- private[chisel3] def addCommand(c: Command) {
+ private[chisel3] def addCommand(c: Command) = {
require(!_closed, "Can't write to module after module close")
_commands += c
}
@@ -48,7 +47,7 @@ abstract class RawModule(implicit moduleCompileOptions: CompileOptions) extends
case b: BaseModule => true
case m: MemBase[_] => true
// These names don't affect hardware
- case _: VerificationStatement => false
+ // case _: VerificationStatement => false
// While the above should be comprehensive, since this is used in warning we want to be careful
// to never accidentally have a match error
case _ => false
@@ -86,10 +85,10 @@ abstract class RawModule(implicit moduleCompileOptions: CompileOptions) extends
id match {
case id: BaseModule => id.forceName(default = id.desiredName, _namespace)
case id: MemBase[_] => id.forceName(default = "MEM", _namespace)
- case id: stop.Stop => id.forceName(default = "stop", _namespace)
- case id: assert.Assert => id.forceName(default = "assert", _namespace)
- case id: assume.Assume => id.forceName(default = "assume", _namespace)
- case id: cover.Cover => id.forceName(default = "cover", _namespace)
+ // removed till macros are fixed
+ // case id: assert.Assert => id.forceName(default = "assert", _namespace)
+ // case id: assume.Assume => id.forceName(default = "assume", _namespace)
+ // case id: cover.Cover => id.forceName(default = "cover", _namespace)
case id: printf.Printf => id.forceName(default = "printf", _namespace)
case id: Data =>
if (id.isSynthesizable) {
diff --git a/core/src/main/scala/chisel3/Reg.scala b/core/src/main/scala/chisel3/Reg.scala
index 204beb79..bca679fa 100644
--- a/core/src/main/scala/chisel3/Reg.scala
+++ b/core/src/main/scala/chisel3/Reg.scala
@@ -2,8 +2,6 @@
package chisel3
-import scala.language.experimental.macros
-
import chisel3.internal._
import chisel3.internal.Builder.pushCommand
import chisel3.internal.firrtl._
diff --git a/core/src/main/scala/chisel3/SeqUtils.scala b/core/src/main/scala/chisel3/SeqUtils.scala
index 6cc7b6cf..0c2342cd 100644
--- a/core/src/main/scala/chisel3/SeqUtils.scala
+++ b/core/src/main/scala/chisel3/SeqUtils.scala
@@ -4,7 +4,6 @@ package chisel3
import chisel3.internal.{prefix, throwException}
-import scala.language.experimental.macros
import chisel3.internal.sourceinfo._
import chisel3.internal.plugin.autoNameRecursively
@@ -17,10 +16,7 @@ private[chisel3] object SeqUtils {
* Equivalent to r(n-1) ## ... ## r(1) ## r(0).
* @note This returns a `0.U` if applied to a zero-element `Vec`.
*/
- def asUInt[T <: Bits](in: Seq[T]): UInt = macro SourceInfoTransform.inArg
-
- /** @group SourceInfoTransformMacros */
- def do_asUInt[T <: Bits](in: Seq[T])(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
+ def asUInt[T <: Bits](in: Seq[T])(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = {
if (in.isEmpty) {
0.U
} else if (in.tail.isEmpty) {
@@ -38,10 +34,7 @@ private[chisel3] object SeqUtils {
/** Outputs the number of elements that === true.B.
*/
- def count(in: Seq[Bool]): UInt = macro SourceInfoTransform.inArg
-
- /** @group SourceInfoTransformMacros */
- def do_count(in: Seq[Bool])(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = in.size match {
+ def count(in: Seq[Bool])(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt = in.size match {
case 0 => 0.U
case 1 => in.head
case n =>
@@ -51,10 +44,7 @@ private[chisel3] object SeqUtils {
/** Returns the data value corresponding to the first true predicate.
*/
- def priorityMux[T <: Data](in: Seq[(Bool, T)]): T = macro SourceInfoTransform.inArg
-
- /** @group SourceInfoTransformMacros */
- def do_priorityMux[T <: Data](
+ def priorityMux[T <: Data](
in: Seq[(Bool, T)]
)(
implicit sourceInfo: SourceInfo,
@@ -73,10 +63,7 @@ private[chisel3] object SeqUtils {
/** Returns the data value corresponding to the lone true predicate.
* This is elaborated to firrtl using a structure that should be optimized into and and/or tree.
*/
- def oneHotMux[T <: Data](in: Iterable[(Bool, T)]): T = macro SourceInfoTransform.inArg
-
- /** @group SourceInfoTransformMacros */
- def do_oneHotMux[T <: Data](
+ def oneHotMux[T <: Data](
in: Iterable[(Bool, T)]
)(
implicit sourceInfo: SourceInfo,
diff --git a/core/src/main/scala/chisel3/VerificationStatement.scala b/core/src/main/scala/chisel3/VerificationStatement.scala
index a0040d78..bb7c76c5 100644
--- a/core/src/main/scala/chisel3/VerificationStatement.scala
+++ b/core/src/main/scala/chisel3/VerificationStatement.scala
@@ -1,540 +1,540 @@
-// SPDX-License-Identifier: Apache-2.0
-
-package chisel3
-
-import scala.reflect.macros.blackbox.Context
-import scala.language.experimental.macros
-import chisel3.internal._
-import chisel3.internal.Builder.pushCommand
-import chisel3.internal.firrtl._
-import chisel3.internal.sourceinfo.SourceInfo
-
-import scala.reflect.macros.blackbox
-
-/** Scaladoc information for internal verification statement macros
- * that are used in objects assert, assume and cover.
- *
- * @groupdesc VerifPrintMacros
- *
- * <p>
- * '''These internal methods are not part of the public-facing API!'''
- * </p>
- * <br>
- *
- * @groupprio VerifPrintMacros 1001
- */
-trait VerifPrintMacrosDoc
-
-object assert extends VerifPrintMacrosDoc {
-
- /** Checks for a condition to be valid in the circuit at rising clock edge
- * when not in reset. If the condition evaluates to false, the circuit
- * simulation stops with an error.
- *
- * @param cond condition, assertion fires (simulation fails) when false
- * @param message optional format string to print when the assertion fires
- * @param data optional bits to print in the message formatting
- *
- * @note See [[printf.apply(fmt:String* printf]] for format string documentation
- * @note currently cannot be used in core Chisel / libraries because macro
- * defs need to be compiled first and the SBT project is not set up to do
- * that
- */
- // Macros currently can't take default arguments, so we need two functions to emulate defaults.
- def apply(
- cond: Bool,
- message: String,
- data: Bits*
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Assert = macro _applyMacroWithInterpolatorCheck
-
- /** Checks for a condition to be valid in the circuit at all times. If the
- * condition evaluates to false, the circuit simulation stops with an error.
- *
- * Does not fire when in reset (defined as the current implicit reset, e.g. as set by
- * the enclosing `withReset` or Module.reset.
- *
- * May be called outside of a Module (like defined in a function), so
- * functions using assert make the standard Module assumptions (single clock
- * and single reset).
- *
- * @param cond condition, assertion fires (simulation fails) on a rising clock edge when false and reset is not asserted
- * @param message optional chisel Printable type message
- *
- * @note See [[printf.apply(fmt:Printable)]] for documentation on printf using Printables
- * @note currently cannot be used in core Chisel / libraries because macro
- * defs need to be compiled first and the SBT project is not set up to do
- * that
- */
- def apply(
- cond: Bool,
- message: Printable
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Assert = macro _applyMacroWithPrintableMessage
-
- def apply(cond: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Assert =
- macro _applyMacroWithNoMessage
-
- import VerificationStatement._
-
- /** @group VerifPrintMacros */
- def _applyMacroWithInterpolatorCheck(
- c: blackbox.Context
- )(cond: c.Tree,
- message: c.Tree,
- data: c.Tree*
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- message match {
- case q"scala.StringContext.apply(..$_).s(..$_)" =>
- c.warning(
- c.enclosingPosition,
- "The s-interpolator prints the Scala .toString of Data objects rather than the value " +
- "of the hardware wire during simulation. Use the cf-interpolator instead. If you want " +
- "an elaboration time check, call assert with a Boolean condition."
- )
- case _ =>
- }
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some(_root_.chisel3.Printable.pack($message, ..$data)))($sourceInfo, $compileOptions)"
- }
-
- /** An elaboration-time assertion. Calls the built-in Scala assert function. */
- def apply(cond: Boolean, message: => String): Unit = Predef.assert(cond, message)
-
- /** An elaboration-time assertion. Calls the built-in Scala assert function. */
- def apply(cond: Boolean): Unit = Predef.assert(cond, "")
-
- /** Named class for assertions. */
- final class Assert private[chisel3] () extends VerificationStatement
-
- /** @group VerifPrintMacros */
- @deprecated(
- "This method has been deprecated in favor of _applyMacroWithStringMessage. Please use the same.",
- "Chisel 3.5"
- )
- def _applyMacroWithMessage(
- c: blackbox.Context
- )(cond: c.Tree,
- message: c.Tree,
- data: c.Tree*
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)},_root_.scala.Some(_root_.chisel3.Printable.pack($message,..$data)))($sourceInfo, $compileOptions)"
- }
-
- /** @group VerifPrintMacros */
- def _applyMacroWithStringMessage(
- c: blackbox.Context
- )(cond: c.Tree,
- message: c.Tree,
- data: c.Tree*
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)},_root_.scala.Some(_root_.chisel3.Printable.pack($message,..$data)))($sourceInfo, $compileOptions)"
- }
-
- /** @group VerifPrintMacros */
- def _applyMacroWithPrintableMessage(
- c: blackbox.Context
- )(cond: c.Tree,
- message: c.Tree
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some($message))($sourceInfo, $compileOptions)"
- }
-
- /** @group VerifPrintMacros */
- def _applyMacroWithNoMessage(
- c: blackbox.Context
- )(cond: c.Tree
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.None)($sourceInfo, $compileOptions)"
- }
-
- /** This will be removed in Chisel 3.6 in favor of the Printable version
- *
- * @group VerifPrintMacros
- */
- def _applyWithSourceLine(
- cond: Bool,
- line: SourceLineInfo,
- message: Option[String],
- data: Bits*
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Assert = {
- val id = new Assert()
- when(!Module.reset.asBool()) {
- failureMessage("Assertion", line, cond, message.map(Printable.pack(_, data: _*)))
- Builder.pushCommand(Verification(id, Formal.Assert, sourceInfo, Module.clock.ref, cond.ref, ""))
- }
- id
- }
-
- /** @group VerifPrintMacros */
- def _applyWithSourceLinePrintable(
- cond: Bool,
- line: SourceLineInfo,
- message: Option[Printable]
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Assert = {
- val id = new Assert()
- message.foreach(Printable.checkScope(_))
- when(!Module.reset.asBool()) {
- failureMessage("Assertion", line, cond, message)
- Builder.pushCommand(Verification(id, Formal.Assert, sourceInfo, Module.clock.ref, cond.ref, ""))
- }
- id
- }
-}
-
-object assume extends VerifPrintMacrosDoc {
-
- /** Assumes a condition to be valid in the circuit at all times.
- * Acts like an assertion in simulation and imposes a declarative
- * assumption on the state explored by formal tools.
- *
- * Does not fire when in reset (defined as the encapsulating Module's
- * reset). If your definition of reset is not the encapsulating Module's
- * reset, you will need to gate this externally.
- *
- * May be called outside of a Module (like defined in a function), so
- * functions using assert make the standard Module assumptions (single clock
- * and single reset).
- *
- * @param cond condition, assertion fires (simulation fails) when false
- * @param message optional format string to print when the assertion fires
- * @param data optional bits to print in the message formatting
- *
- * @note See [[printf.apply(fmt:String* printf]] for format string documentation
- */
- // Macros currently can't take default arguments, so we need two functions to emulate defaults.
- def apply(
- cond: Bool,
- message: String,
- data: Bits*
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Assume = macro _applyMacroWithInterpolatorCheck
-
- /** Assumes a condition to be valid in the circuit at all times.
- * Acts like an assertion in simulation and imposes a declarative
- * assumption on the state explored by formal tools.
- *
- * Does not fire when in reset (defined as the encapsulating Module's
- * reset). If your definition of reset is not the encapsulating Module's
- * reset, you will need to gate this externally.
- *
- * May be called outside of a Module (like defined in a function), so
- * functions using assert make the standard Module assumptions (single clock
- * and single reset).
- *
- * @param cond condition, assertion fires (simulation fails) when false
- * @param message optional Printable type message when the assertion fires
- *
- * @note See [[printf.apply(fmt:Printable]] for documentation on printf using Printables
- */
- def apply(
- cond: Bool,
- message: Printable
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Assume = macro _applyMacroWithPrintableMessage
-
- def apply(cond: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Assume =
- macro _applyMacroWithNoMessage
-
- /** An elaboration-time assumption. Calls the built-in Scala assume function. */
- def apply(cond: Boolean, message: => String): Unit = Predef.assume(cond, message)
-
- /** An elaboration-time assumption. Calls the built-in Scala assume function. */
- def apply(cond: Boolean): Unit = Predef.assume(cond, "")
-
- /** Named class for assumptions. */
- final class Assume private[chisel3] () extends VerificationStatement
-
- import VerificationStatement._
-
- /** @group VerifPrintMacros */
- def _applyMacroWithInterpolatorCheck(
- c: blackbox.Context
- )(cond: c.Tree,
- message: c.Tree,
- data: c.Tree*
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- message match {
- case q"scala.StringContext.apply(..$_).s(..$_)" =>
- c.warning(
- c.enclosingPosition,
- "The s-interpolator prints the Scala .toString of Data objects rather than the value " +
- "of the hardware wire during simulation. Use the cf-interpolator instead. If you want " +
- "an elaboration time check, call assert with a Boolean condition."
- )
- case _ =>
- }
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some(_root_.chisel3.Printable.pack($message, ..$data)))($sourceInfo, $compileOptions)"
- }
-
- /** @group VerifPrintMacros */
- @deprecated(
- "This method has been deprecated in favor of _applyMacroWithStringMessage. Please use the same.",
- "Chisel 3.5"
- )
- def _applyMacroWithMessage(
- c: blackbox.Context
- )(cond: c.Tree,
- message: c.Tree,
- data: c.Tree*
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some(_root_.chisel3.Printable.pack($message, ..$data)))($sourceInfo, $compileOptions)"
- }
-
- /** @group VerifPrintMacros */
- def _applyMacroWithStringMessage(
- c: blackbox.Context
- )(cond: c.Tree,
- message: c.Tree,
- data: c.Tree*
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some(_root_.chisel3.Printable.pack($message, ..$data)))($sourceInfo, $compileOptions)"
- }
-
- /** @group VerifPrintMacros */
- def _applyMacroWithPrintableMessage(
- c: blackbox.Context
- )(cond: c.Tree,
- message: c.Tree
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some($message))($sourceInfo, $compileOptions)"
- }
-
- /** @group VerifPrintMacros */
- def _applyMacroWithNoMessage(
- c: blackbox.Context
- )(cond: c.Tree
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.None)($sourceInfo, $compileOptions)"
- }
-
- /** This will be removed in Chisel 3.6 in favor of the Printable version
- *
- * @group VerifPrintMacros
- */
- def _applyWithSourceLine(
- cond: Bool,
- line: SourceLineInfo,
- message: Option[String],
- data: Bits*
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Assume = {
- val id = new Assume()
- when(!Module.reset.asBool()) {
- failureMessage("Assumption", line, cond, message.map(Printable.pack(_, data: _*)))
- Builder.pushCommand(Verification(id, Formal.Assume, sourceInfo, Module.clock.ref, cond.ref, ""))
- }
- id
- }
-
- /** @group VerifPrintMacros */
- def _applyWithSourceLinePrintable(
- cond: Bool,
- line: SourceLineInfo,
- message: Option[Printable]
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Assume = {
- val id = new Assume()
- message.foreach(Printable.checkScope(_))
- when(!Module.reset.asBool()) {
- failureMessage("Assumption", line, cond, message)
- Builder.pushCommand(Verification(id, Formal.Assume, sourceInfo, Module.clock.ref, cond.ref, ""))
- }
- id
- }
-}
-
-object cover extends VerifPrintMacrosDoc {
-
- /** Declares a condition to be covered.
- * At ever clock event, a counter is incremented iff the condition is active
- * and reset is inactive.
- *
- * Does not fire when in reset (defined as the encapsulating Module's
- * reset). If your definition of reset is not the encapsulating Module's
- * reset, you will need to gate this externally.
- *
- * May be called outside of a Module (like defined in a function), so
- * functions using assert make the standard Module assumptions (single clock
- * and single reset).
- *
- * @param cond condition that will be sampled on every clock tick
- * @param message a string describing the cover event
- */
- // Macros currently can't take default arguments, so we need two functions to emulate defaults.
- def apply(cond: Bool, message: String)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Cover =
- macro _applyMacroWithMessage
- def apply(cond: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Cover =
- macro _applyMacroWithNoMessage
-
- /** Named class for cover statements. */
- final class Cover private[chisel3] () extends VerificationStatement
-
- import VerificationStatement._
-
- /** @group VerifPrintMacros */
- def _applyMacroWithNoMessage(
- c: blackbox.Context
- )(cond: c.Tree
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLine"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.None)($sourceInfo, $compileOptions)"
- }
-
- /** @group VerifPrintMacros */
- def _applyMacroWithMessage(
- c: blackbox.Context
- )(cond: c.Tree,
- message: c.Tree
- )(sourceInfo: c.Tree,
- compileOptions: c.Tree
- ): c.Tree = {
- import c.universe._
- val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLine"))
- q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some($message))($sourceInfo, $compileOptions)"
- }
-
- /** @group VerifPrintMacros */
- def _applyWithSourceLine(
- cond: Bool,
- line: SourceLineInfo,
- message: Option[String]
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Cover = {
- val id = new Cover()
- when(!Module.reset.asBool()) {
- Builder.pushCommand(Verification(id, Formal.Cover, sourceInfo, Module.clock.ref, cond.ref, ""))
- }
- id
- }
-}
-
-object stop {
-
- /** Terminate execution, indicating success.
- *
- * @param message a string describing why the simulation was stopped
- */
- def apply(message: String = "")(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Stop = {
- val stp = new Stop()
- when(!Module.reset.asBool) {
- pushCommand(Stop(stp, sourceInfo, Builder.forcedClock.ref, 0))
- }
- stp
- }
-
- /** Terminate execution with a failure code. */
- @deprecated(
- "Non-zero return codes are not well supported. Please use assert(false.B) if you want to indicate a failure.",
- "Chisel 3.5"
- )
- def apply(code: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Stop = {
- val stp = new Stop()
- when(!Module.reset.asBool) {
- pushCommand(Stop(stp, sourceInfo, Builder.forcedClock.ref, code))
- }
- stp
- }
-
- /** Named class for [[stop]]s. */
- final class Stop private[chisel3] () extends VerificationStatement
-}
-
-/** Base class for all verification statements: Assert, Assume, Cover, Stop and Printf. */
-abstract class VerificationStatement extends NamedComponent {
- _parent.foreach(_.addId(this))
-}
-
-/** Helper functions for common functionality required by stop, assert, assume or cover */
-private object VerificationStatement {
-
- type SourceLineInfo = (String, Int, String)
-
- def getLine(c: blackbox.Context): SourceLineInfo = {
- val p = c.enclosingPosition
- (p.source.file.name, p.line, p.lineContent.trim)
- }
-
- def failureMessage(
- kind: String,
- lineInfo: SourceLineInfo,
- cond: Bool,
- message: Option[Printable]
- )(
- implicit sourceInfo: SourceInfo,
- compileOptions: CompileOptions
- ): Unit = {
- val (filename, line, content) = lineInfo
- val lineMsg = s"$filename:$line $content".replaceAll("%", "%%")
- val fmt = message match {
- case Some(msg) =>
- p"$kind failed: $msg\n at $lineMsg\n"
- case None => p"$kind failed\n at $lineMsg\n"
- }
- when(!cond) {
- printf.printfWithoutReset(fmt)
- }
- }
-}
+// // SPDX-License-Identifier: Apache-2.0
+
+// package chisel3
+
+// import scala.reflect.macros.blackbox.Context
+// import scala.language.experimental.macros
+// import chisel3.internal._
+// import chisel3.internal.Builder.pushCommand
+// import chisel3.internal.firrtl._
+// import chisel3.internal.sourceinfo.SourceInfo
+
+// import scala.reflect.macros.blackbox
+
+// /** Scaladoc information for internal verification statement macros
+// * that are used in objects assert, assume and cover.
+// *
+// * @groupdesc VerifPrintMacros
+// *
+// * <p>
+// * '''These internal methods are not part of the public-facing API!'''
+// * </p>
+// * <br>
+// *
+// * @groupprio VerifPrintMacros 1001
+// */
+// trait VerifPrintMacrosDoc
+
+// object assert extends VerifPrintMacrosDoc {
+
+// /** Checks for a condition to be valid in the circuit at rising clock edge
+// * when not in reset. If the condition evaluates to false, the circuit
+// * simulation stops with an error.
+// *
+// * @param cond condition, assertion fires (simulation fails) when false
+// * @param message optional format string to print when the assertion fires
+// * @param data optional bits to print in the message formatting
+// *
+// * @note See [[printf.apply(fmt:String* printf]] for format string documentation
+// * @note currently cannot be used in core Chisel / libraries because macro
+// * defs need to be compiled first and the SBT project is not set up to do
+// * that
+// */
+// // Macros currently can't take default arguments, so we need two functions to emulate defaults.
+// def apply(
+// cond: Bool,
+// message: String,
+// data: Bits*
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Assert = macro _applyMacroWithInterpolatorCheck
+
+// /** Checks for a condition to be valid in the circuit at all times. If the
+// * condition evaluates to false, the circuit simulation stops with an error.
+// *
+// * Does not fire when in reset (defined as the current implicit reset, e.g. as set by
+// * the enclosing `withReset` or Module.reset.
+// *
+// * May be called outside of a Module (like defined in a function), so
+// * functions using assert make the standard Module assumptions (single clock
+// * and single reset).
+// *
+// * @param cond condition, assertion fires (simulation fails) on a rising clock edge when false and reset is not asserted
+// * @param message optional chisel Printable type message
+// *
+// * @note See [[printf.apply(fmt:Printable)]] for documentation on printf using Printables
+// * @note currently cannot be used in core Chisel / libraries because macro
+// * defs need to be compiled first and the SBT project is not set up to do
+// * that
+// */
+// def apply(
+// cond: Bool,
+// message: Printable
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Assert = macro _applyMacroWithPrintableMessage
+
+// def apply(cond: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Assert =
+// macro _applyMacroWithNoMessage
+
+// import VerificationStatement._
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithInterpolatorCheck(
+// c: blackbox.Context
+// )(cond: c.Tree,
+// message: c.Tree,
+// data: c.Tree*
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// message match {
+// case q"scala.StringContext.apply(..$_).s(..$_)" =>
+// c.warning(
+// c.enclosingPosition,
+// "The s-interpolator prints the Scala .toString of Data objects rather than the value " +
+// "of the hardware wire during simulation. Use the cf-interpolator instead. If you want " +
+// "an elaboration time check, call assert with a Boolean condition."
+// )
+// case _ =>
+// }
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some(_root_.chisel3.Printable.pack($message, ..$data)))($sourceInfo, $compileOptions)"
+// }
+
+// /** An elaboration-time assertion. Calls the built-in Scala assert function. */
+// def apply(cond: Boolean, message: => String): Unit = Predef.assert(cond, message)
+
+// /** An elaboration-time assertion. Calls the built-in Scala assert function. */
+// def apply(cond: Boolean): Unit = Predef.assert(cond, "")
+
+// /** Named class for assertions. */
+// final class Assert private[chisel3] () extends VerificationStatement
+
+// /** @group VerifPrintMacros */
+// @deprecated(
+// "This method has been deprecated in favor of _applyMacroWithStringMessage. Please use the same.",
+// "Chisel 3.5"
+// )
+// def _applyMacroWithMessage(
+// c: blackbox.Context
+// )(cond: c.Tree,
+// message: c.Tree,
+// data: c.Tree*
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)},_root_.scala.Some(_root_.chisel3.Printable.pack($message,..$data)))($sourceInfo, $compileOptions)"
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithStringMessage(
+// c: blackbox.Context
+// )(cond: c.Tree,
+// message: c.Tree,
+// data: c.Tree*
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)},_root_.scala.Some(_root_.chisel3.Printable.pack($message,..$data)))($sourceInfo, $compileOptions)"
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithPrintableMessage(
+// c: blackbox.Context
+// )(cond: c.Tree,
+// message: c.Tree
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some($message))($sourceInfo, $compileOptions)"
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithNoMessage(
+// c: blackbox.Context
+// )(cond: c.Tree
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.None)($sourceInfo, $compileOptions)"
+// }
+
+// /** This will be removed in Chisel 3.6 in favor of the Printable version
+// *
+// * @group VerifPrintMacros
+// */
+// def _applyWithSourceLine(
+// cond: Bool,
+// line: SourceLineInfo,
+// message: Option[String],
+// data: Bits*
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Assert = {
+// val id = new Assert()
+// when(!Module.reset.asBool()) {
+// failureMessage("Assertion", line, cond, message.map(Printable.pack(_, data: _*)))
+// Builder.pushCommand(Verification(id, Formal.Assert, sourceInfo, Module.clock.ref, cond.ref, ""))
+// }
+// id
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyWithSourceLinePrintable(
+// cond: Bool,
+// line: SourceLineInfo,
+// message: Option[Printable]
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Assert = {
+// val id = new Assert()
+// message.foreach(Printable.checkScope(_))
+// when(!Module.reset.asBool()) {
+// failureMessage("Assertion", line, cond, message)
+// Builder.pushCommand(Verification(id, Formal.Assert, sourceInfo, Module.clock.ref, cond.ref, ""))
+// }
+// id
+// }
+// }
+
+// object assume extends VerifPrintMacrosDoc {
+
+// /** Assumes a condition to be valid in the circuit at all times.
+// * Acts like an assertion in simulation and imposes a declarative
+// * assumption on the state explored by formal tools.
+// *
+// * Does not fire when in reset (defined as the encapsulating Module's
+// * reset). If your definition of reset is not the encapsulating Module's
+// * reset, you will need to gate this externally.
+// *
+// * May be called outside of a Module (like defined in a function), so
+// * functions using assert make the standard Module assumptions (single clock
+// * and single reset).
+// *
+// * @param cond condition, assertion fires (simulation fails) when false
+// * @param message optional format string to print when the assertion fires
+// * @param data optional bits to print in the message formatting
+// *
+// * @note See [[printf.apply(fmt:String* printf]] for format string documentation
+// */
+// // Macros currently can't take default arguments, so we need two functions to emulate defaults.
+// def apply(
+// cond: Bool,
+// message: String,
+// data: Bits*
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Assume = macro _applyMacroWithInterpolatorCheck
+
+// /** Assumes a condition to be valid in the circuit at all times.
+// * Acts like an assertion in simulation and imposes a declarative
+// * assumption on the state explored by formal tools.
+// *
+// * Does not fire when in reset (defined as the encapsulating Module's
+// * reset). If your definition of reset is not the encapsulating Module's
+// * reset, you will need to gate this externally.
+// *
+// * May be called outside of a Module (like defined in a function), so
+// * functions using assert make the standard Module assumptions (single clock
+// * and single reset).
+// *
+// * @param cond condition, assertion fires (simulation fails) when false
+// * @param message optional Printable type message when the assertion fires
+// *
+// * @note See [[printf.apply(fmt:Printable]] for documentation on printf using Printables
+// */
+// def apply(
+// cond: Bool,
+// message: Printable
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Assume = macro _applyMacroWithPrintableMessage
+
+// def apply(cond: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Assume =
+// macro _applyMacroWithNoMessage
+
+// /** An elaboration-time assumption. Calls the built-in Scala assume function. */
+// def apply(cond: Boolean, message: => String): Unit = Predef.assume(cond, message)
+
+// /** An elaboration-time assumption. Calls the built-in Scala assume function. */
+// def apply(cond: Boolean): Unit = Predef.assume(cond, "")
+
+// /** Named class for assumptions. */
+// final class Assume private[chisel3] () extends VerificationStatement
+
+// import VerificationStatement._
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithInterpolatorCheck(
+// c: blackbox.Context
+// )(cond: c.Tree,
+// message: c.Tree,
+// data: c.Tree*
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// message match {
+// case q"scala.StringContext.apply(..$_).s(..$_)" =>
+// c.warning(
+// c.enclosingPosition,
+// "The s-interpolator prints the Scala .toString of Data objects rather than the value " +
+// "of the hardware wire during simulation. Use the cf-interpolator instead. If you want " +
+// "an elaboration time check, call assert with a Boolean condition."
+// )
+// case _ =>
+// }
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some(_root_.chisel3.Printable.pack($message, ..$data)))($sourceInfo, $compileOptions)"
+// }
+
+// /** @group VerifPrintMacros */
+// @deprecated(
+// "This method has been deprecated in favor of _applyMacroWithStringMessage. Please use the same.",
+// "Chisel 3.5"
+// )
+// def _applyMacroWithMessage(
+// c: blackbox.Context
+// )(cond: c.Tree,
+// message: c.Tree,
+// data: c.Tree*
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some(_root_.chisel3.Printable.pack($message, ..$data)))($sourceInfo, $compileOptions)"
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithStringMessage(
+// c: blackbox.Context
+// )(cond: c.Tree,
+// message: c.Tree,
+// data: c.Tree*
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some(_root_.chisel3.Printable.pack($message, ..$data)))($sourceInfo, $compileOptions)"
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithPrintableMessage(
+// c: blackbox.Context
+// )(cond: c.Tree,
+// message: c.Tree
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some($message))($sourceInfo, $compileOptions)"
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithNoMessage(
+// c: blackbox.Context
+// )(cond: c.Tree
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLinePrintable"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.None)($sourceInfo, $compileOptions)"
+// }
+
+// /** This will be removed in Chisel 3.6 in favor of the Printable version
+// *
+// * @group VerifPrintMacros
+// */
+// def _applyWithSourceLine(
+// cond: Bool,
+// line: SourceLineInfo,
+// message: Option[String],
+// data: Bits*
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Assume = {
+// val id = new Assume()
+// when(!Module.reset.asBool()) {
+// failureMessage("Assumption", line, cond, message.map(Printable.pack(_, data: _*)))
+// Builder.pushCommand(Verification(id, Formal.Assume, sourceInfo, Module.clock.ref, cond.ref, ""))
+// }
+// id
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyWithSourceLinePrintable(
+// cond: Bool,
+// line: SourceLineInfo,
+// message: Option[Printable]
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Assume = {
+// val id = new Assume()
+// message.foreach(Printable.checkScope(_))
+// when(!Module.reset.asBool()) {
+// failureMessage("Assumption", line, cond, message)
+// Builder.pushCommand(Verification(id, Formal.Assume, sourceInfo, Module.clock.ref, cond.ref, ""))
+// }
+// id
+// }
+// }
+
+// object cover extends VerifPrintMacrosDoc {
+
+// /** Declares a condition to be covered.
+// * At ever clock event, a counter is incremented iff the condition is active
+// * and reset is inactive.
+// *
+// * Does not fire when in reset (defined as the encapsulating Module's
+// * reset). If your definition of reset is not the encapsulating Module's
+// * reset, you will need to gate this externally.
+// *
+// * May be called outside of a Module (like defined in a function), so
+// * functions using assert make the standard Module assumptions (single clock
+// * and single reset).
+// *
+// * @param cond condition that will be sampled on every clock tick
+// * @param message a string describing the cover event
+// */
+// // Macros currently can't take default arguments, so we need two functions to emulate defaults.
+// def apply(cond: Bool, message: String)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Cover =
+// macro _applyMacroWithMessage
+// def apply(cond: Bool)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Cover =
+// macro _applyMacroWithNoMessage
+
+// /** Named class for cover statements. */
+// final class Cover private[chisel3] () extends VerificationStatement
+
+// import VerificationStatement._
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithNoMessage(
+// c: blackbox.Context
+// )(cond: c.Tree
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLine"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.None)($sourceInfo, $compileOptions)"
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyMacroWithMessage(
+// c: blackbox.Context
+// )(cond: c.Tree,
+// message: c.Tree
+// )(sourceInfo: c.Tree,
+// compileOptions: c.Tree
+// ): c.Tree = {
+// import c.universe._
+// val apply_impl_do = symbolOf[this.type].asClass.module.info.member(TermName("_applyWithSourceLine"))
+// q"$apply_impl_do($cond, ${getLine(c)}, _root_.scala.Some($message))($sourceInfo, $compileOptions)"
+// }
+
+// /** @group VerifPrintMacros */
+// def _applyWithSourceLine(
+// cond: Bool,
+// line: SourceLineInfo,
+// message: Option[String]
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Cover = {
+// val id = new Cover()
+// when(!Module.reset.asBool()) {
+// Builder.pushCommand(Verification(id, Formal.Cover, sourceInfo, Module.clock.ref, cond.ref, ""))
+// }
+// id
+// }
+// }
+
+// object stop {
+
+// /** Terminate execution, indicating success.
+// *
+// * @param message a string describing why the simulation was stopped
+// */
+// def apply(message: String = "")(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Stop = {
+// val stp = new Stop()
+// when(!Module.reset.asBool) {
+// pushCommand(Stop(stp, sourceInfo, Builder.forcedClock.ref, 0))
+// }
+// stp
+// }
+
+// /** Terminate execution with a failure code. */
+// @deprecated(
+// "Non-zero return codes are not well supported. Please use assert(false.B) if you want to indicate a failure.",
+// "Chisel 3.5"
+// )
+// def apply(code: Int)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Stop = {
+// val stp = new Stop()
+// when(!Module.reset.asBool) {
+// pushCommand(Stop(stp, sourceInfo, Builder.forcedClock.ref, code))
+// }
+// stp
+// }
+
+// /** Named class for [[stop]]s. */
+// final class Stop private[chisel3] () extends VerificationStatement
+// }
+
+// /** Base class for all verification statements: Assert, Assume, Cover, Stop and Printf. */
+// abstract class VerificationStatement extends NamedComponent {
+// _parent.foreach(_.addId(this))
+// }
+
+// /** Helper functions for common functionality required by stop, assert, assume or cover */
+// private object VerificationStatement {
+
+// type SourceLineInfo = (String, Int, String)
+
+// def getLine(c: blackbox.Context): SourceLineInfo = {
+// val p = c.enclosingPosition
+// (p.source.file.name, p.line, p.lineContent.trim)
+// }
+
+// def failureMessage(
+// kind: String,
+// lineInfo: SourceLineInfo,
+// cond: Bool,
+// message: Option[Printable]
+// )(
+// implicit sourceInfo: SourceInfo,
+// compileOptions: CompileOptions
+// ): Unit = {
+// val (filename, line, content) = lineInfo
+// val lineMsg = s"$filename:$line $content".replaceAll("%", "%%")
+// val fmt = message match {
+// case Some(msg) =>
+// p"$kind failed: $msg\n at $lineMsg\n"
+// case None => p"$kind failed\n at $lineMsg\n"
+// }
+// when(!cond) {
+// printf.printfWithoutReset(fmt)
+// }
+// }
+// }
diff --git a/core/src/main/scala/chisel3/When.scala b/core/src/main/scala/chisel3/When.scala
index 727d8d0c..a4e5b195 100644
--- a/core/src/main/scala/chisel3/When.scala
+++ b/core/src/main/scala/chisel3/When.scala
@@ -2,7 +2,6 @@
package chisel3
-import scala.language.experimental.macros
import chisel3.internal._
import chisel3.internal.Builder.pushCommand
import chisel3.internal.firrtl._
diff --git a/core/src/main/scala/chisel3/experimental/ChiselEnum.scala b/core/src/main/scala/chisel3/experimental/ChiselEnum.scala
index 37c6fb58..27b07199 100644
--- a/core/src/main/scala/chisel3/experimental/ChiselEnum.scala
+++ b/core/src/main/scala/chisel3/experimental/ChiselEnum.scala
@@ -2,8 +2,6 @@
package chisel3.experimental
-import scala.language.experimental.macros
-import scala.reflect.macros.blackbox.Context
import scala.collection.mutable
import chisel3._
import chisel3.internal.Builder.pushOp
@@ -116,27 +114,20 @@ abstract class EnumType(private[chisel3] val factory: ChiselEnum, selfAnnotating
this := factory.apply(that.asUInt)
}
- final def ===(that: EnumType): Bool = macro SourceInfoTransform.thatArg
- final def =/=(that: EnumType): Bool = macro SourceInfoTransform.thatArg
- final def <(that: EnumType): Bool = macro SourceInfoTransform.thatArg
- final def <=(that: EnumType): Bool = macro SourceInfoTransform.thatArg
- final def >(that: EnumType): Bool = macro SourceInfoTransform.thatArg
- final def >=(that: EnumType): Bool = macro SourceInfoTransform.thatArg
-
- def do_===(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def ===(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, EqualOp, that)
- def do_=/=(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def =/=(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, NotEqualOp, that)
- def do_<(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def <(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, LessOp, that)
- def do_>(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def >(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, GreaterOp, that)
- def do_<=(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def <=(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, LessEqOp, that)
- def do_>=(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
+ def >=(that: EnumType)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool =
compop(sourceInfo, GreaterEqOp, that)
- override def do_asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
+ override def asUInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): UInt =
pushOp(DefPrim(sourceInfo, UInt(width), AsUIntOp, ref))
protected[chisel3] override def width: Width = factory.width
@@ -317,10 +308,7 @@ abstract class EnumFactory {
enumRecords.find(_.inst.litValue == id).map(_.name)
}
- protected def Value: Type = macro EnumMacros.ValImpl
- protected def Value(id: UInt): Type = macro EnumMacros.ValCustomImpl
-
- protected def do_Value(name: String): Type = {
+ protected def Value(name: String): Type = {
val result = new Type
// We have to use UnknownWidth here, because we don't actually know what the final width will be
@@ -334,7 +322,7 @@ abstract class EnumFactory {
result
}
- protected def do_Value(name: String, id: UInt): Type = {
+ protected def Value(name: String, id: UInt): Type = {
// TODO: These throw ExceptionInInitializerError which can be confusing to the user. Get rid of the error, and just
// throw an exception
if (id.litOption.isEmpty) {
@@ -401,36 +389,6 @@ abstract class EnumFactory {
}
}
-private[chisel3] object EnumMacros {
- def ValImpl(c: Context): c.Tree = {
- import c.universe._
-
- // Much thanks to michael_s for this solution:
- // stackoverflow.com/questions/18450203/retrieve-the-name-of-the-value-a-scala-macro-invocation-will-be-assigned-to
- val term = c.internal.enclosingOwner
- val name = term.name.decodedName.toString.trim
-
- if (name.contains(" ")) {
- c.abort(c.enclosingPosition, "Value cannot be called without assigning to an enum")
- }
-
- q"""this.do_Value($name)"""
- }
-
- def ValCustomImpl(c: Context)(id: c.Expr[UInt]): c.universe.Tree = {
- import c.universe._
-
- val term = c.internal.enclosingOwner
- val name = term.name.decodedName.toString.trim
-
- if (name.contains(" ")) {
- c.abort(c.enclosingPosition, "Value cannot be called without assigning to an enum")
- }
-
- q"""this.do_Value($name, $id)"""
- }
-}
-
// This is an enum type that can be connected directly to UInts. It is used as a "glue" to cast non-literal UInts
// to enums.
private[chisel3] class UnsafeEnum(override val width: Width) extends EnumType(UnsafeEnum, selfAnnotating = false) {
diff --git a/core/src/main/scala/chisel3/experimental/package.scala b/core/src/main/scala/chisel3/experimental/package.scala
index a69c5b6e..e803c775 100644
--- a/core/src/main/scala/chisel3/experimental/package.scala
+++ b/core/src/main/scala/chisel3/experimental/package.scala
@@ -26,71 +26,71 @@ package object experimental {
val Direction = ActualDirection
- class dump extends chisel3.internal.naming.dump
- class treedump extends chisel3.internal.naming.treedump
+ // class dump extends chisel3.internal.naming.dump
+ // class treedump extends chisel3.internal.naming.treedump
- /** Experimental macro for naming Chisel hardware values
- *
- * By default, Chisel uses reflection for naming which only works for public fields of `Bundle`
- * and `Module` classes. Applying this macro annotation to a `class` or `object` enables Chisel
- * to name any hardware values within the annotated `class` or `object.
- *
- * @example {{{
- * import chisel3._
- * import chisel3.experimental.chiselName
- *
- * @chiselName
- * class MyModule extends Module {
- * val io = IO(new Bundle {
- * val in = Input(UInt(8.W))
- * val out = Output(UInt(8.W))
- * })
- * def createReg(): Unit = {
- * // @chiselName allows Chisel to name this Reg
- * val myReg = RegInit(io.in)
- * io.out := myReg
- * }
- * createReg()
- * }
- * }}}
- */
- class chiselName extends chisel3.internal.naming.chiselName
+ // /** Experimental macro for naming Chisel hardware values
+ // *
+ // * By default, Chisel uses reflection for naming which only works for public fields of `Bundle`
+ // * and `Module` classes. Applying this macro annotation to a `class` or `object` enables Chisel
+ // * to name any hardware values within the annotated `class` or `object.
+ // *
+ // * @example {{{
+ // * import chisel3._
+ // * import chisel3.experimental.chiselName
+ // *
+ // * @chiselName
+ // * class MyModule extends Module {
+ // * val io = IO(new Bundle {
+ // * val in = Input(UInt(8.W))
+ // * val out = Output(UInt(8.W))
+ // * })
+ // * def createReg(): Unit = {
+ // * // @chiselName allows Chisel to name this Reg
+ // * val myReg = RegInit(io.in)
+ // * io.out := myReg
+ // * }
+ // * createReg()
+ // * }
+ // * }}}
+ // */
+ // class chiselName extends chisel3.internal.naming.chiselName
- /** Do not name instances of this type in [[chiselName]]
- *
- * By default, `chiselName` will include `val` names of instances of annotated classes as a
- * prefix in final naming. Mixing in this trait to a `class`, `object`, or anonymous `class`
- * instances will exclude the `val` name from `chiselName` naming.
- *
- * @example {{{
- * import chisel3._
- * import chisel3.experimental.{chiselName, NoChiselNamePrefix}
- *
- * // Note that this is not a Module
- * @chiselName
- * class Counter(w: Int) {
- * val myReg = RegInit(0.U(w.W))
- * myReg := myReg + 1.U
- * }
- *
- * @chiselName
- * class MyModule extends Module {
- * val io = IO(new Bundle {
- * val out = Output(UInt(8.W))
- * })
- * // Name of myReg will be "counter0_myReg"
- * val counter0 = new Counter(8)
- * // Name of myReg will be "myReg"
- * val counter1 = new Counter(8) with NoChiselNamePrefix
- * io.out := counter0.myReg + counter1.myReg
- * }
- * }}}
- */
- @deprecated(
- "@chiselName and NoChiselNamePrefix have been replaced by the compiler plugin and AffectsChiselPrefix. Use these instead",
- "Chisel 3.5"
- )
- trait NoChiselNamePrefix
+ // /** Do not name instances of this type in [[chiselName]]
+ // *
+ // * By default, `chiselName` will include `val` names of instances of annotated classes as a
+ // * prefix in final naming. Mixing in this trait to a `class`, `object`, or anonymous `class`
+ // * instances will exclude the `val` name from `chiselName` naming.
+ // *
+ // * @example {{{
+ // * import chisel3._
+ // * import chisel3.experimental.{chiselName, NoChiselNamePrefix}
+ // *
+ // * // Note that this is not a Module
+ // * @chiselName
+ // * class Counter(w: Int) {
+ // * val myReg = RegInit(0.U(w.W))
+ // * myReg := myReg + 1.U
+ // * }
+ // *
+ // * @chiselName
+ // * class MyModule extends Module {
+ // * val io = IO(new Bundle {
+ // * val out = Output(UInt(8.W))
+ // * })
+ // * // Name of myReg will be "counter0_myReg"
+ // * val counter0 = new Counter(8)
+ // * // Name of myReg will be "myReg"
+ // * val counter1 = new Counter(8) with NoChiselNamePrefix
+ // * io.out := counter0.myReg + counter1.myReg
+ // * }
+ // * }}}
+ // */
+ // @deprecated(
+ // "@chiselName and NoChiselNamePrefix have been replaced by the compiler plugin and AffectsChiselPrefix. Use these instead",
+ // "Chisel 3.5"
+ // )
+ // trait NoChiselNamePrefix
/** Generate prefixes from values of this type in the Chisel compiler plugin
*
diff --git a/core/src/main/scala/chisel3/internal/MonoConnect.scala b/core/src/main/scala/chisel3/internal/MonoConnect.scala
index 257c543f..1389d508 100644
--- a/core/src/main/scala/chisel3/internal/MonoConnect.scala
+++ b/core/src/main/scala/chisel3/internal/MonoConnect.scala
@@ -7,7 +7,6 @@ import chisel3.experimental.{Analog, BaseModule, UnsafeEnum}
import chisel3.internal.Builder.pushCommand
import chisel3.internal.firrtl.{Connect, Converter, DefInvalid}
-import scala.language.experimental.macros
import chisel3.internal.sourceinfo.SourceInfo
import _root_.firrtl.passes.CheckTypes
import scala.annotation.tailrec
diff --git a/core/src/main/scala/chisel3/internal/Namer.scala b/core/src/main/scala/chisel3/internal/Namer.scala
index c36aafef..23b5b7ba 100644
--- a/core/src/main/scala/chisel3/internal/Namer.scala
+++ b/core/src/main/scala/chisel3/internal/Namer.scala
@@ -54,7 +54,7 @@ sealed trait NamingContextInterface {
* so that actual naming calls (HasId.suggestName) can happen.
* Recursively names descendants, for those whose return value have an associated name.
*/
- def namePrefix(prefix: String)
+ def namePrefix(prefix: String): String
}
/** Dummy implementation to allow for naming annotations in a non-Builder context.
@@ -77,7 +77,7 @@ class NamingContext extends NamingContextInterface {
* prefixed with the name given to the reference object, if the reference object is named in the
* scope of this context.
*/
- def addDescendant(ref: Any, descendant: NamingContext) {
+ def addDescendant(ref: Any, descendant: NamingContext) = {
ref match {
case ref: AnyRef =>
// getOrElseUpdate
diff --git a/core/src/main/scala/chisel3/internal/SourceInfo.scala b/core/src/main/scala/chisel3/internal/SourceInfo.scala
index dc7f7fab..b4697e88 100644
--- a/core/src/main/scala/chisel3/internal/SourceInfo.scala
+++ b/core/src/main/scala/chisel3/internal/SourceInfo.scala
@@ -14,9 +14,6 @@
package chisel3.internal.sourceinfo
-import scala.language.experimental.macros
-import scala.reflect.macros.blackbox.Context
-
/** Abstract base class for generalized source information.
*/
sealed trait SourceInfo {
@@ -46,17 +43,3 @@ case object DeprecatedSourceInfo extends NoSourceInfo
case class SourceLine(filename: String, line: Int, col: Int) extends SourceInfo {
def makeMessage(f: String => String): String = f(s"@[$filename $line:$col]")
}
-
-/** Provides a macro that returns the source information at the invocation point.
- */
-object SourceInfoMacro {
- def generate_source_info(c: Context): c.Tree = {
- import c.universe._
- val p = c.enclosingPosition
- q"_root_.chisel3.internal.sourceinfo.SourceLine(${p.source.file.name}, ${p.line}, ${p.column})"
- }
-}
-
-object SourceInfo {
- implicit def materialize: SourceInfo = macro SourceInfoMacro.generate_source_info
-}
diff --git a/project/build.properties b/project/build.properties
index baf5ff3e..081fdbbc 100644
--- a/project/build.properties
+++ b/project/build.properties
@@ -1 +1 @@
-sbt.version=1.5.7
+sbt.version=1.10.0