summaryrefslogtreecommitdiff
path: root/core/src/main/scala/chisel3/RawModule.scala
diff options
context:
space:
mode:
authorJack Koenig2020-08-12 22:17:21 -0700
committerGitHub2020-08-12 22:17:21 -0700
commita66d2d152897fa979aea07aa067c27ba455ca054 (patch)
tree1f52cf3418fe1b87e1c48c8b14b45c275c2b080f /core/src/main/scala/chisel3/RawModule.scala
parentdbf4d546767d6983aec24dedf994651417ae2e50 (diff)
Deprecate Module.io and BlackBox.io (#1550)
* Deprecate Module.io and BlackBox.io This is a step toward unification of Module with MultiIOModule. The future of BlackBox is a bit less clear, but its existing API can be maintained without the io virtual method. The trickier API to maintain is auto-IO wrapping for compatibility Modules and BlackBoxes. This will probably require reflection to support once the io virtual method is removed. * Improve deprecation warning for io
Diffstat (limited to 'core/src/main/scala/chisel3/RawModule.scala')
-rw-r--r--core/src/main/scala/chisel3/RawModule.scala16
1 files changed, 12 insertions, 4 deletions
diff --git a/core/src/main/scala/chisel3/RawModule.scala b/core/src/main/scala/chisel3/RawModule.scala
index a1006594..16a2394f 100644
--- a/core/src/main/scala/chisel3/RawModule.scala
+++ b/core/src/main/scala/chisel3/RawModule.scala
@@ -200,10 +200,18 @@ package internal {
// IO for this Module. At the Scala level (pre-FIRRTL transformations),
// connections in and out of a Module may only go through `io` elements.
+ @deprecated("Removed for causing issues in Scala 2.12+. You remain free to define io Bundles " +
+ "in your Modules, but you cannot rely on an io field in every Module. " +
+ "For more information, see: https://github.com/freechipsproject/chisel3/pull/1550.",
+ "Chisel 3.4"
+ )
def io: Record
+ // Private accessor to reduce number of deprecation warnings
+ private[chisel3] def _io: Record = io
+
// Allow access to bindings from the compatibility package
- protected def _compatIoPortBound() = portsContains(io)
+ protected def _compatIoPortBound() = portsContains(_io)
private[chisel3] override def namePorts(names: HashMap[HasId, String]): Unit = {
for (port <- getModulePorts) {
@@ -218,8 +226,8 @@ package internal {
_compatAutoWrapPorts() // pre-IO(...) compatibility hack
// Restrict IO to just io, clock, and reset
- require(io != null, "Module must have io")
- require(portsContains(io), "Module must have io wrapped in IO(...)")
+ require(_io != null, "Module must have io")
+ require(portsContains(_io), "Module must have io wrapped in IO(...)")
require((portsContains(clock)) && (portsContains(reset)), "Internal error, module did not have clock or reset as IO")
require(portsSize == 3, "Module must only have io, clock, and reset as IO")
@@ -232,7 +240,7 @@ package internal {
implicit val sourceInfo = UnlocatableSourceInfo
if (!parentCompileOptions.explicitInvalidate) {
- pushCommand(DefInvalid(sourceInfo, io.ref))
+ pushCommand(DefInvalid(sourceInfo, _io.ref))
}
clock := override_clock.getOrElse(Builder.forcedClock)