Skip to content

Commit

Permalink
Remove Injecting Aspects (#4417)
Browse files Browse the repository at this point in the history
Fully remove injecting aspects.  These were deprecated in Chisel 6.6.0.

Signed-off-by: Schuyler Eldridge <[email protected]>
  • Loading branch information
seldridge authored Sep 27, 2024
1 parent d292a5e commit 9ee6842
Show file tree
Hide file tree
Showing 16 changed files with 12 additions and 484 deletions.
6 changes: 1 addition & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ lazy val warningSuppression = Seq(
"cat=deprecation&origin=firrtl\\.options\\.internal\\.WriteableCircuitAnnotation:s",
"cat=deprecation&origin=chisel3\\.util\\.experimental\\.BoringUtils.*:s",
"cat=deprecation&origin=chisel3\\.experimental\\.IntrinsicModule:s",
"cat=deprecation&origin=chisel3\\.ltl.*:s",
// This is deprecated and planned to be removed
"cat=deprecation&origin=chisel3\\.aop\\.injecting.*:s",
"cat=deprecation&origin=chisel3\\.stage\\.phases\\.MaybeInjectingPhase:s",
"cat=deprecation&origin=chisel3\\.ModuleAspect:s"
"cat=deprecation&origin=chisel3\\.ltl.*:s"
).mkString(",")
)

Expand Down
24 changes: 0 additions & 24 deletions core/src/main/scala/chisel3/ModuleAspect.scala

This file was deleted.

8 changes: 2 additions & 6 deletions core/src/main/scala/chisel3/ModuleImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -532,12 +532,8 @@ package experimental {
private[chisel3] val _ids = ArrayBuffer[HasId]()

private[chisel3] def addId(d: HasId): Unit = {
if (Builder.aspectModule(this).isDefined) {
aspectModule(this).get.addId(d)
} else {
require(!_closed, "Can't write to module after module close")
_ids += d
}
require(!_closed, "Can't write to module after module close")
_ids += d
}

// Returns the last id contained within a Module
Expand Down
10 changes: 1 addition & 9 deletions core/src/main/scala/chisel3/internal/Binding.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,7 @@ private[chisel3] object binding {
// Location will track where this Module is, and the bound object can be referenced in FIRRTL
sealed trait ConstrainedBinding extends TopBinding {
def enclosure: BaseModule
def location: Option[BaseModule] = {
// If an aspect is present, return the aspect module. Otherwise, return the enclosure module
// This allows aspect modules to pretend to be enclosed modules for connectivity checking,
// inside vs outside instance checking, etc.
Builder.aspectModule(enclosure) match {
case None => Some(enclosure)
case Some(aspect) => Some(aspect)
}
}
def location: Option[BaseModule] = Some(enclosure)
}

// A binding representing a data that cannot be (re)assigned to.
Expand Down
39 changes: 3 additions & 36 deletions core/src/main/scala/chisel3/internal/Builder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -540,11 +540,6 @@ private[chisel3] class DynamicContext(
val options = mutable.LinkedHashSet[choice.Case]()
var currentModule: Option[BaseModule] = None

/** Contains a mapping from a elaborated module to their aspect
* Set by [[ModuleAspect]]
*/
val aspectModule: mutable.HashMap[BaseModule, BaseModule] = mutable.HashMap.empty[BaseModule, BaseModule]

// Views that do not correspond to a single ReferenceTarget and thus require renaming
val unnamedViews: ArrayBuffer[Data] = ArrayBuffer.empty

Expand Down Expand Up @@ -721,10 +716,6 @@ private[chisel3] object Builder extends LazyLogging {
def currentModule_=(target: Option[BaseModule]): Unit = {
dynamicContext.currentModule = target
}
def aspectModule(module: BaseModule): Option[BaseModule] = dynamicContextVar.value match {
case Some(dynamicContext) => dynamicContext.aspectModule.get(module)
case _ => None
}

/** Retrieves the parent of a module based on the elaboration context
*
Expand All @@ -733,23 +724,7 @@ private[chisel3] object Builder extends LazyLogging {
* @return the parent of the module provided
*/
def retrieveParent(module: BaseModule, context: BaseModule): Option[BaseModule] = {
module._parent match {
case Some(parentModule) => { //if a parent exists investigate, otherwise return None
context match {
case aspect: ModuleAspect => { //if aspect context, do the translation
Builder.aspectModule(parentModule) match {
case Some(parentAspect) => Some(parentAspect) //we've found a translation
case _ => Some(parentModule) //no translation found
}
} //otherwise just return our parent
case _ => Some(parentModule)
}
}
case _ => None
}
}
def addAspect(module: BaseModule, aspect: BaseModule): Unit = {
dynamicContext.aspectModule += ((module, aspect))
module._parent
}
def forcedModule: BaseModule = currentModule match {
case Some(module) => module
Expand All @@ -761,11 +736,7 @@ private[chisel3] object Builder extends LazyLogging {
}
def referenceUserModule: RawModule = {
currentModule match {
case Some(module: RawModule) =>
aspectModule(module) match {
case Some(aspect: RawModule) => aspect
case other => module
}
case Some(module: RawModule) => module
case _ =>
throwException(
"Error: Not in a RawModule. Likely cause: Missed Module() wrap, bare chisel API call, or attempting to construct hardware inside a BlackBox."
Expand All @@ -775,11 +746,7 @@ private[chisel3] object Builder extends LazyLogging {
}
def referenceUserContainer: BaseModule = {
currentModule match {
case Some(module: RawModule) =>
aspectModule(module) match {
case Some(aspect: RawModule) => aspect
case other => module
}
case Some(module: RawModule) => module
case Some(cls: Class) => cls
case _ =>
throwException(
Expand Down
27 changes: 0 additions & 27 deletions src/main/scala/chisel3/aop/injecting/InjectStatement.scala

This file was deleted.

122 changes: 0 additions & 122 deletions src/main/scala/chisel3/aop/injecting/InjectingAspect.scala

This file was deleted.

50 changes: 0 additions & 50 deletions src/main/scala/chisel3/aop/injecting/InjectingPhase.scala

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/scala/chisel3/stage/phases/Convert.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Convert extends Phase {

override def prerequisites = Seq(Dependency[Elaborate])
override def optionalPrerequisites = Seq.empty
override def optionalPrerequisiteOf = Seq(Dependency[MaybeInjectingPhase])
override def optionalPrerequisiteOf = Seq.empty
override def invalidates(a: Phase) = false

@nowarn("msg=Do not use annotations val of Circuit directly")
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/chisel3/stage/phases/Emitter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class Emitter extends Phase {
Seq(
Dependency[Elaborate],
Dependency[AddImplicitOutputFile],
Dependency[AddImplicitOutputAnnotationFile],
Dependency[MaybeAspectPhase]
Dependency[AddImplicitOutputAnnotationFile]
)
override def optionalPrerequisites = Seq.empty
override def optionalPrerequisiteOf = Seq(Dependency[Convert])
Expand Down
20 changes: 0 additions & 20 deletions src/main/scala/chisel3/stage/phases/MaybeInjectingPhase.scala

This file was deleted.

Loading

0 comments on commit 9ee6842

Please sign in to comment.