summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/scala/chisel3')
-rw-r--r--src/main/scala/chisel3/Driver.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/Driver.scala b/src/main/scala/chisel3/Driver.scala
index 9bc5cd0d..c0570662 100644
--- a/src/main/scala/chisel3/Driver.scala
+++ b/src/main/scala/chisel3/Driver.scala
@@ -127,6 +127,20 @@ object Driver extends BackendCompilationUtilities {
f
}
+ /**
+ * Emit the annotations of a circuit
+ *
+ * @param ir The circuit containing annotations to be emitted
+ * @param optName An optional filename (will use s"${ir.name}.json" otherwise)
+ */
+ def dumpAnnotations(ir: Circuit, optName: Option[File]): File = {
+ val f = optName.getOrElse(new File(ir.name + ".anno.json"))
+ val w = new FileWriter(f)
+ w.write(JsonProtocol.serialize(ir.annotations.map(_.toFirrtl)))
+ w.close()
+ f
+ }
+
/** Dumps the elaborated Circuit to ProtoBuf
*
* If no File is given as input, it will dump to a default filename based on the name of the