summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/aop/injecting/InjectStatement.scala
blob: dbe1fd7b69b2c8443256a3056649d5f872d40aba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// SPDX-License-Identifier: Apache-2.0

package chisel3.aop.injecting

import chisel3.stage.phases.AspectPhase
import firrtl.annotations.{Annotation, ModuleTarget, NoTargetAnnotation, SingleTargetAnnotation}

/** Contains all information needed to inject statements into a module
  *
  * Generated when a [[InjectingAspect]] is consumed by a [[AspectPhase]]
  * Consumed by [[InjectingTransform]]
  *
  * @param module Module to inject code into at the end of the module
  * @param s Statements to inject
  * @param modules Additional modules that may be instantiated by s
  * @param annotations Additional annotations that should be passed down compiler
  */
case class InjectStatement(
  module:      ModuleTarget,
  s:           firrtl.ir.Statement,
  modules:     Seq[firrtl.ir.DefModule],
  annotations: Seq[Annotation])
    extends SingleTargetAnnotation[ModuleTarget] {
  val target: ModuleTarget = module
  override def duplicate(n: ModuleTarget): Annotation = this.copy(module = n)
}