From 5d62c321f482d81ec3382e20047e7d091063b6b0 Mon Sep 17 00:00:00 2001 From: "Wesley W. Terpstra" Date: Tue, 10 Oct 2017 23:23:06 -0700 Subject: [PATCH] generator: create annotation file --- src/main/scala/groundtest/Generator.scala | 1 + src/main/scala/system/Generator.scala | 1 + src/main/scala/unittest/Generator.scala | 1 + src/main/scala/util/GeneratorUtils.scala | 9 +++++++++ 4 files changed, 12 insertions(+) diff --git a/src/main/scala/groundtest/Generator.scala b/src/main/scala/groundtest/Generator.scala index f92910bc..8f37020e 100644 --- a/src/main/scala/groundtest/Generator.scala +++ b/src/main/scala/groundtest/Generator.scala @@ -7,6 +7,7 @@ import freechips.rocketchip.util.GeneratorApp object Generator extends GeneratorApp { val longName = names.topModuleProject + "." + names.configs generateFirrtl + generateAnno generateTestSuiteMakefrags // TODO: Needed only for legacy make targets generateArtefacts } diff --git a/src/main/scala/system/Generator.scala b/src/main/scala/system/Generator.scala index d3d5f1f8..5232bb30 100644 --- a/src/main/scala/system/Generator.scala +++ b/src/main/scala/system/Generator.scala @@ -87,6 +87,7 @@ object Generator extends GeneratorApp { val longName = names.topModuleProject + "." + names.configs generateFirrtl + generateAnno generateTestSuiteMakefrags generateROMs generateArtefacts diff --git a/src/main/scala/unittest/Generator.scala b/src/main/scala/unittest/Generator.scala index e7ce4ddf..0c1f2112 100644 --- a/src/main/scala/unittest/Generator.scala +++ b/src/main/scala/unittest/Generator.scala @@ -5,6 +5,7 @@ package freechips.rocketchip.unittest object Generator extends freechips.rocketchip.util.GeneratorApp { val longName = names.topModuleProject + "." + names.configs generateFirrtl + generateAnno generateTestSuiteMakefrags // TODO: Needed only for legacy make targets generateArtefacts } diff --git a/src/main/scala/util/GeneratorUtils.scala b/src/main/scala/util/GeneratorUtils.scala index 5b0905a1..5d67ff32 100644 --- a/src/main/scala/util/GeneratorUtils.scala +++ b/src/main/scala/util/GeneratorUtils.scala @@ -10,6 +10,8 @@ import freechips.rocketchip.system.{TestGeneration, DefaultTestSuites} import freechips.rocketchip.config._ import freechips.rocketchip.diplomacy.LazyModule import java.io.{File, FileWriter} +import net.jcazevedo.moultingyaml._ +import firrtl.annotations.AnnotationYamlProtocol._ /** Representation of the information this Generator needs to collect from external sources. */ case class ParsedInputNames( @@ -106,6 +108,13 @@ trait GeneratorApp extends App with HasGeneratorUtilities { Driver.dumpFirrtl(circuit, Some(new File(td, s"$longName.fir"))) // FIRRTL } + def generateAnno { + val annotationFile = new File(td, s"$longName.anno") + val af = new FileWriter(annotationFile) + af.write(circuit.annotations.toArray.toYaml.prettyPrint) + af.close() + } + /** Output software test Makefrags, which provide targets for integration testing. */ def generateTestSuiteMakefrags { addTestSuites