summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/chisel3/util')
-rw-r--r--src/main/scala/chisel3/util/BlackBoxUtils.scala17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/main/scala/chisel3/util/BlackBoxUtils.scala b/src/main/scala/chisel3/util/BlackBoxUtils.scala
index fbcf4a59..fa62184a 100644
--- a/src/main/scala/chisel3/util/BlackBoxUtils.scala
+++ b/src/main/scala/chisel3/util/BlackBoxUtils.scala
@@ -3,14 +3,18 @@
package chisel3.util
import chisel3._
-import chisel3.core.ChiselAnnotation
-import firrtl.transforms.{BlackBoxInline, BlackBoxResource, BlackBoxSourceHelper}
+import chisel3.experimental.{ChiselAnnotation, RunFirrtlTransform}
+import firrtl.transforms.{BlackBoxResourceAnno, BlackBoxInlineAnno, BlackBoxSourceHelper}
trait HasBlackBoxResource extends BlackBox {
self: BlackBox =>
def setResource(blackBoxResource: String): Unit = {
- annotate(ChiselAnnotation(self, classOf[BlackBoxSourceHelper], BlackBoxResource(blackBoxResource).serialize))
+ val anno = new ChiselAnnotation with RunFirrtlTransform {
+ def toFirrtl = BlackBoxResourceAnno(self.toNamed, blackBoxResource)
+ def transformClass = classOf[BlackBoxSourceHelper]
+ }
+ chisel3.experimental.annotate(anno)
}
}
@@ -18,7 +22,10 @@ trait HasBlackBoxInline extends BlackBox {
self: BlackBox =>
def setInline(blackBoxName: String, blackBoxInline: String): Unit = {
- annotate(ChiselAnnotation(
- self, classOf[BlackBoxSourceHelper], BlackBoxInline(blackBoxName, blackBoxInline).serialize))
+ val anno = new ChiselAnnotation with RunFirrtlTransform {
+ def toFirrtl = BlackBoxInlineAnno(self.toNamed, blackBoxName, blackBoxInline)
+ def transformClass = classOf[BlackBoxSourceHelper]
+ }
+ chisel3.experimental.annotate(anno)
}
}