summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Koenig2021-01-21 11:41:20 -0800
committerJack Koenig2021-01-21 15:57:10 -0800
commit6c6ec7161e8f046fff1cfc68a468ce2f053fdb7f (patch)
treedebd31d50abb936b12213ec40d752e8cc18067ad
parent8a73362bb6fe87817a1867cc2482c1841f95c077 (diff)
Fold Chisel.CompatibilityModule into chisel3.internal.LegacyModule
-rw-r--r--core/src/main/scala/chisel3/RawModule.scala17
-rw-r--r--src/main/scala/chisel3/compatibility.scala24
2 files changed, 18 insertions, 23 deletions
diff --git a/core/src/main/scala/chisel3/RawModule.scala b/core/src/main/scala/chisel3/RawModule.scala
index ac6a2d1f..a686fd7e 100644
--- a/core/src/main/scala/chisel3/RawModule.scala
+++ b/core/src/main/scala/chisel3/RawModule.scala
@@ -197,10 +197,23 @@ package object internal {
/** Legacy Module class that restricts IOs to just io, clock, and reset, and provides a constructor
* for threading through explicit clock and reset.
*
- * This is only intended as a bridge from chisel3 to Chisel.Module, do not extend this in user
- * code, use [[Module]]
+ * '''Do not use this class in user code'''. Use whichever `Module` is imported by your wildcard
+ * import (preferably `import chisel3._`).
*/
abstract class LegacyModule(implicit moduleCompileOptions: CompileOptions) extends Module {
+ // Provide a non-deprecated constructor
+ def this(override_clock: Option[Clock]=None, override_reset: Option[Bool]=None)
+ (implicit moduleCompileOptions: CompileOptions) = {
+ this()
+ this.override_clock = override_clock
+ this.override_reset = override_reset
+ }
+ def this(_clock: Clock)(implicit moduleCompileOptions: CompileOptions) =
+ this(Option(_clock), None)(moduleCompileOptions)
+ def this(_reset: Bool)(implicit moduleCompileOptions: CompileOptions) =
+ this(None, Option(_reset))(moduleCompileOptions)
+ def this(_clock: Clock, _reset: Bool)(implicit moduleCompileOptions: CompileOptions) =
+ this(Option(_clock), Option(_reset))(moduleCompileOptions)
private lazy val _io: Record = reflectivelyFindValIO(this)
diff --git a/src/main/scala/chisel3/compatibility.scala b/src/main/scala/chisel3/compatibility.scala
index 7066384b..e62cba7d 100644
--- a/src/main/scala/chisel3/compatibility.scala
+++ b/src/main/scala/chisel3/compatibility.scala
@@ -293,29 +293,11 @@ package object Chisel {
}
import chisel3.CompileOptions
- abstract class CompatibilityModule(implicit moduleCompileOptions: CompileOptions)
- extends chisel3.internal.LegacyModule()(moduleCompileOptions) {
- // This class auto-wraps the Module IO with IO(...), allowing legacy code (where IO(...) wasn't
- // required) to build.
- // Also provides the clock / reset constructors, which were used before withClock happened.
-
- // Provide a non-deprecated constructor
- def this(override_clock: Option[Clock]=None, override_reset: Option[Bool]=None)
- (implicit moduleCompileOptions: CompileOptions) = {
- this()
- this.override_clock = override_clock
- this.override_reset = override_reset
- }
- def this(_clock: Clock)(implicit moduleCompileOptions: CompileOptions) =
- this(Option(_clock), None)(moduleCompileOptions)
- def this(_reset: Bool)(implicit moduleCompileOptions: CompileOptions) =
- this(None, Option(_reset))(moduleCompileOptions)
- def this(_clock: Clock, _reset: Bool)(implicit moduleCompileOptions: CompileOptions) =
- this(Option(_clock), Option(_reset))(moduleCompileOptions)
- }
+ @deprecated("Use Chisel.Module", "Chisel 3.5")
+ type CompatibilityModule = chisel3.internal.LegacyModule
val Module = chisel3.Module
- type Module = CompatibilityModule
+ type Module = chisel3.internal.LegacyModule
val printf = chisel3.printf