aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/firrtlTests/DriverSpec.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/scala/firrtlTests/DriverSpec.scala')
-rw-r--r--src/test/scala/firrtlTests/DriverSpec.scala125
1 files changed, 0 insertions, 125 deletions
diff --git a/src/test/scala/firrtlTests/DriverSpec.scala b/src/test/scala/firrtlTests/DriverSpec.scala
index 92381e8c..400bf314 100644
--- a/src/test/scala/firrtlTests/DriverSpec.scala
+++ b/src/test/scala/firrtlTests/DriverSpec.scala
@@ -209,131 +209,6 @@ class DriverSpec extends AnyFreeSpec with Matchers with BackendCompilationUtilit
}
}
- // Deprecated
- "Annotations can be read implicitly from the name of the circuit" - {
- val input = """|circuit foo :
- | module foo :
- | input x : UInt<8>
- | output y : UInt<8>
- | y <= x""".stripMargin
- val top = "foo"
- val optionsManager = new ExecutionOptionsManager("test") with HasFirrtlOptions {
- commonOptions = commonOptions.copy(topName = top)
- firrtlOptions = firrtlOptions.copy(firrtlSource = Some(input))
- }
- val annoFile = new File(optionsManager.commonOptions.targetDirName, top + ".anno")
- val vFile = new File(optionsManager.commonOptions.targetDirName, top + ".v")
- "Using Driver.getAnnotations" in {
- copyResourceToFile("/annotations/SampleAnnotations.anno", annoFile)
- optionsManager.firrtlOptions.annotations.length should be(0)
- val annos = Driver.getAnnotations(optionsManager)
- annos.length should be(12) // 9 from circuit plus 3 general purpose
- annos.count(_.isInstanceOf[InlineAnnotation]) should be(9)
- annoFile.delete()
- vFile.delete()
- }
- "Using Driver.execute" in {
- copyResourceToFile("/annotations/SampleAnnotations.anno", annoFile)
- Driver.execute(optionsManager) match {
- case r: FirrtlExecutionSuccess =>
- val annos = r.circuitState.annotations
- annos.count(_.isInstanceOf[InlineAnnotation]) should be(9)
- }
- annoFile.delete()
- vFile.delete()
- }
- }
-
- // Deprecated
- "Annotations can be read using annotationFileNameOverride" in {
- val optionsManager = new ExecutionOptionsManager("test") with HasFirrtlOptions {
- commonOptions = commonOptions.copy(topName = "a.fir")
- firrtlOptions = firrtlOptions.copy(
- annotationFileNameOverride = "SampleAnnotations"
- )
- }
- val annotationsTestFile = new File(optionsManager.commonOptions.targetDirName, optionsManager.firrtlOptions.annotationFileNameOverride + ".anno")
- copyResourceToFile("/annotations/SampleAnnotations.anno", annotationsTestFile)
- optionsManager.firrtlOptions.annotations.length should be(0)
- val annos = Driver.getAnnotations(optionsManager)
- annos.length should be(12) // 9 from circuit plus 3 general purpose
- annos.count(_.isInstanceOf[InlineAnnotation]) should be(9)
- annotationsTestFile.delete()
- }
-
- // Deprecated
- "Supported LegacyAnnotations will be converted automagically" in {
- val testDir = createTestDirectory("test")
- val annoFilename = "LegacyAnnotations.anno"
- val annotationsTestFile = new File(testDir, annoFilename)
- val optionsManager = new ExecutionOptionsManager("test") with HasFirrtlOptions {
- commonOptions = commonOptions.copy(topName = "test", targetDirName = testDir.toString)
- firrtlOptions = firrtlOptions.copy(
- annotationFileNames = List(annotationsTestFile.toString)
- )
- }
- copyResourceToFile(s"/annotations/$annoFilename", annotationsTestFile)
- val annos = Driver.getAnnotations(optionsManager)
-
- val cname = CircuitName("foo")
- val mname = ModuleName("bar", cname)
- val compname = ComponentName("x", mname)
- import firrtl.passes.clocklist._
- import firrtl.passes.memlib._
- import firrtl.passes.wiring._
- import firrtl.transforms._
- val expected = List(
- InlineAnnotation(cname),
- ClockListAnnotation(mname, "output"),
- InferReadWriteAnnotation,
- ReplSeqMemAnnotation("input", "output"),
- NoDedupMemAnnotation(compname),
- NoDedupAnnotation(mname),
- SourceAnnotation(compname, "pin"),
- SinkAnnotation(compname, "pin"),
- BlackBoxResourceAnno(mname, "resource"),
- BlackBoxInlineAnno(mname, "name", "text"),
- BlackBoxTargetDirAnno("targetdir"),
- NoDCEAnnotation,
- DontTouchAnnotation(compname),
- OptimizableExtModuleAnnotation(mname)
- )
- for (e <- expected) {
- annos should contain(e)
- }
- }
-
- // Deprecated
- "UNsupported LegacyAnnotations should throw errors" in {
- val testDir = createTestDirectory("test")
- val annoFilename = "InvalidLegacyAnnotations.anno"
- val annotationsTestFile = new File(testDir, annoFilename)
- copyResourceToFile(s"/annotations/$annoFilename", annotationsTestFile)
-
- import net.jcazevedo.moultingyaml._
- val text = FileUtils.getText(annotationsTestFile)
- val yamlAnnos = text.parseYaml match {
- case YamlArray(xs) => xs
- }
-
- // Since each one should error, emit each one to an anno file and try to read it
- for ((anno, i) <- yamlAnnos.zipWithIndex) {
- val annoFile = new File(testDir, s"anno_$i.anno")
- val fw = new FileWriter(annoFile)
- fw.write(YamlArray(anno).prettyPrint)
- fw.close()
- val optionsManager = new ExecutionOptionsManager("test") with HasFirrtlOptions {
- commonOptions = commonOptions.copy(topName = "test", targetDirName = testDir.toString)
- firrtlOptions = firrtlOptions.copy(
- annotationFileNames = List(annoFile.toString)
- )
- }
- (the[Exception] thrownBy {
- Driver.getAnnotations(optionsManager)
- }).getMessage should include("Old-style annotations")
- }
- }
-
"Annotations can be read from multiple files" in {
val filename = "SampleAnnotations.anno.json"
val optionsManager = new ExecutionOptionsManager("test") with HasFirrtlOptions {