summaryrefslogtreecommitdiff
path: root/core/src/main/scala/chisel3/internal/firrtl
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/main/scala/chisel3/internal/firrtl')
-rw-r--r--core/src/main/scala/chisel3/internal/firrtl/IR.scala39
1 files changed, 36 insertions, 3 deletions
diff --git a/core/src/main/scala/chisel3/internal/firrtl/IR.scala b/core/src/main/scala/chisel3/internal/firrtl/IR.scala
index 1ee8842f..dc9ab027 100644
--- a/core/src/main/scala/chisel3/internal/firrtl/IR.scala
+++ b/core/src/main/scala/chisel3/internal/firrtl/IR.scala
@@ -94,7 +94,7 @@ object Arg {
case Some(arg) => arg.name
case None =>
id match {
- case data: Data => data._computeName(None, Some("?")).get
+ case data: Data => data._computeName(Some("?")).get
case _ => "?"
}
}
@@ -861,7 +861,40 @@ case class DefBlackBox(
params: Map[String, Param])
extends Component
-case class Circuit(name: String, components: Seq[Component], annotations: Seq[ChiselAnnotation], renames: RenameMap) {
- def firrtlAnnotations: Iterable[Annotation] = annotations.flatMap(_.toFirrtl.update(renames))
+case class Circuit(
+ name: String,
+ components: Seq[Component],
+ @deprecated("Do not use annotations val of Circuit directly - use firrtlAnnotations instead. Will be removed in a future release",
+ "Chisel 3.5")
+ annotations: Seq[ChiselAnnotation],
+ renames: RenameMap,
+ @deprecated("Do not use newAnnotations val of Circuit directly - use firrtlAnnotations instead. Will be removed in a future release",
+ "Chisel 3.5")
+ newAnnotations: Seq[ChiselMultiAnnotation]) {
+
+ def this(name: String, components: Seq[Component], annotations: Seq[ChiselAnnotation], renames: RenameMap) =
+ this(name, components, annotations, renames, Seq.empty)
+
+ def firrtlAnnotations: Iterable[Annotation] =
+ annotations.flatMap(_.toFirrtl.update(renames)) ++ newAnnotations.flatMap(
+ _.toFirrtl.flatMap(_.update(renames))
+ )
+
+ def copy(
+ name: String = name,
+ components: Seq[Component] = components,
+ annotations: Seq[ChiselAnnotation] = annotations,
+ renames: RenameMap = renames
+ ) = Circuit(name, components, annotations, renames, newAnnotations)
+
+}
+object Circuit
+ extends scala.runtime.AbstractFunction4[String, Seq[Component], Seq[ChiselAnnotation], RenameMap, Circuit] {
+ def unapply(c: Circuit): Option[(String, Seq[Component], Seq[ChiselAnnotation], RenameMap)] = {
+ Some((c.name, c.components, c.annotations, c.renames))
+ }
+
+ def apply(name: String, components: Seq[Component], annotations: Seq[ChiselAnnotation], renames: RenameMap): Circuit =
+ new Circuit(name, components, annotations, renames)
}