summaryrefslogtreecommitdiff
path: root/core/src/main/scala/chisel3/internal
diff options
context:
space:
mode:
authorJiuyang Liu2021-02-27 05:01:10 +0800
committerGitHub2021-02-26 13:01:10 -0800
commit923ccbde1353e37f0948d3c5d94b49965dc6d950 (patch)
tree0565112847c8aef6cf8aaf2562a3e97ead026d24 /core/src/main/scala/chisel3/internal
parentc2ba4098d0a2f7ca056ea198d68b1d3bfaf40f3b (diff)
Expose AnnotationSeq to Module. (#1731)
Diffstat (limited to 'core/src/main/scala/chisel3/internal')
-rw-r--r--core/src/main/scala/chisel3/internal/Builder.scala11
1 files changed, 4 insertions, 7 deletions
diff --git a/core/src/main/scala/chisel3/internal/Builder.scala b/core/src/main/scala/chisel3/internal/Builder.scala
index 31d4666c..e95384cd 100644
--- a/core/src/main/scala/chisel3/internal/Builder.scala
+++ b/core/src/main/scala/chisel3/internal/Builder.scala
@@ -9,7 +9,8 @@ import chisel3.experimental._
import chisel3.internal.firrtl._
import chisel3.internal.naming._
import _root_.firrtl.annotations.{CircuitName, ComponentName, IsMember, ModuleName, Named, ReferenceTarget}
-import _root_.firrtl.annotations.AnnotationUtils.{validComponentName}
+import _root_.firrtl.annotations.AnnotationUtils.validComponentName
+import _root_.firrtl.AnnotationSeq
import chisel3.internal.Builder.Prefix
import logger.LazyLogging
@@ -305,7 +306,7 @@ private[chisel3] class ChiselContext() {
var prefixStack: Prefix = Nil
}
-private[chisel3] class DynamicContext() {
+private[chisel3] class DynamicContext(val annotationSeq: AnnotationSeq) {
val globalNamespace = Namespace.empty
val components = ArrayBuffer[Component]()
val annotations = ArrayBuffer[ChiselAnnotation]()
@@ -364,6 +365,7 @@ private[chisel3] object Builder extends LazyLogging {
def globalNamespace: Namespace = dynamicContext.globalNamespace
def components: ArrayBuffer[Component] = dynamicContext.components
def annotations: ArrayBuffer[ChiselAnnotation] = dynamicContext.annotations
+ def annotationSeq: AnnotationSeq = dynamicContext.annotationSeq
def namingStack: NamingStack = dynamicContext.namingStack
// Puts a prefix string onto the prefix stack
@@ -632,11 +634,6 @@ private[chisel3] object Builder extends LazyLogging {
}
}
-
- def build[T <: RawModule](f: => T): (Circuit, T) = {
- build(f, new DynamicContext())
- }
-
private [chisel3] def build[T <: RawModule](f: => T, dynamicContext: DynamicContext): (Circuit, T) = {
dynamicContextVar.withValue(Some(dynamicContext)) {
checkScalaVersion()