diff options
| author | Schuyler Eldridge | 2018-09-28 12:33:16 -0400 |
|---|---|---|
| committer | GitHub | 2018-09-28 12:33:16 -0400 |
| commit | 215049716b691d5ab842297683ec6d08b6d8eba9 (patch) | |
| tree | e459212863c7f3a7d15e3707246fcc6629fd0b30 | |
| parent | c316a0a27e908cc2da1b9423d4fdf72e37c79d9b (diff) | |
| parent | 65fe4c331ff6bf7c2bad65d4e8ce08e0c397c739 (diff) | |
Merge pull request #880 from seldridge/f764.2
- Add dumpAnnotations method to Driver
| -rw-r--r-- | src/main/scala/chisel3/Driver.scala | 14 |
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 |
