From c7eb1570dfb1c7701ea32d1209982a053f3cec1d Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Tue, 27 Feb 2018 18:07:11 -0800 Subject: Refactor Annotations (#721) - Old Annotation renamed to deprecated LegacyAnnotation - Annotation is now a trait that can be extended - New JsonProtocol for Annotation [de]serialization - Replace AnnotationMap with AnnotationSeq - Deprecate Transform.getMyAnnotations - Update Transforms - Turn on deprecation warnings - Remove deprecated Driver.compile - Make AnnotationTests abstract with Legacy and Json subclasses - Add functionality to convert LegacyAnnotations of built-in annos This will give a noisy warning and is more of a best effort than a robust solution. Fixes #475 Closes #609--- .../annotations/InvalidLegacyAnnotations.anno | 26 +++++++++++ .../resources/annotations/LegacyAnnotations.anno | 50 ++++++++++++++++++++++ .../annotations/SampleAnnotations.anno.json | 39 +++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 src/test/resources/annotations/InvalidLegacyAnnotations.anno create mode 100644 src/test/resources/annotations/LegacyAnnotations.anno create mode 100644 src/test/resources/annotations/SampleAnnotations.anno.json (limited to 'src/test/resources/annotations') diff --git a/src/test/resources/annotations/InvalidLegacyAnnotations.anno b/src/test/resources/annotations/InvalidLegacyAnnotations.anno new file mode 100644 index 00000000..75bb3b96 --- /dev/null +++ b/src/test/resources/annotations/InvalidLegacyAnnotations.anno @@ -0,0 +1,26 @@ +- targetString: CircuitTop + transformClass: firrtl.VerilogEmitter + value: emitCircuit +- targetString: CircuitTop + transformClass: firrtl.VerilogEmitter + value: emitAllModules +- targetString: CircuitTop + transformClass: firrtl.Transform + value: emittedFirrtlCircuit:0 +- targetString: CircuitTop + transformClass: firrtl.Transform + value: emittedVerilogCircuit:0 +- targetString: CircuitTop + transformClass: firrtl.Transform + value: emittedFirrtlModule:0 +- targetString: CircuitTop + transformClass: firrtl.Transform + value: emittedVerilogModule:0 +- targetString: foo + transformClass: firrtl.Transform + value: | + DELETED by DeadCodeElimination + targetString: foo + transformClass: firrtl.passes.InlineInstances + value: '' + diff --git a/src/test/resources/annotations/LegacyAnnotations.anno b/src/test/resources/annotations/LegacyAnnotations.anno new file mode 100644 index 00000000..395fa56d --- /dev/null +++ b/src/test/resources/annotations/LegacyAnnotations.anno @@ -0,0 +1,50 @@ +- targetString: foo + transformClass: firrtl.passes.InlineInstances + value: '' +- targetString: foo.bar + transformClass: firrtl.passes.clocklist.ClockListTransform + value: output +- targetString: foo + transformClass: firrtl.passes.memlib.InferReadWrite + value: '' +- targetString: foo + transformClass: firrtl.passes.memlib.ReplSeqMem + value: input output +- targetString: foo.bar.x + transformClass: firrtl.passes.memlib.ResolveMemoryReference + value: nodedupmem! +- targetString: foo.bar + transformClass: firrtl.transforms.DedupModules + value: nodedup! +- targetString: foo.bar.x + transformClass: firrtl.passes.wiring.WiringTransform + value: source pin +- targetString: foo.bar.x + transformClass: firrtl.passes.wiring.WiringTransform + value: sink pin +- targetString: foo.bar + transformClass: firrtl.transforms.BlackBoxSourceHelper + value: |- + resource + resource +- targetString: foo.bar + transformClass: firrtl.transforms.BlackBoxSourceHelper + value: |- + inline + name + text +- targetString: foo.bar + transformClass: firrtl.transforms.BlackBoxSourceHelper + value: |- + targetDir + targetdir +- targetString: CircuitTop + transformClass: firrtl.transforms.DeadCodeElimination + value: noDCE! +- targetString: foo.bar.x + transformClass: firrtl.Transform + value: DONTtouch! +- targetString: foo.bar + transformClass: firrtl.Transform + value: optimizableExtModule! + diff --git a/src/test/resources/annotations/SampleAnnotations.anno.json b/src/test/resources/annotations/SampleAnnotations.anno.json new file mode 100644 index 00000000..e4d912a2 --- /dev/null +++ b/src/test/resources/annotations/SampleAnnotations.anno.json @@ -0,0 +1,39 @@ +[ + { + "class":"firrtl.passes.InlineAnnotation", + "target":"Top.Foo" + }, + { + "class":"firrtl.passes.InlineAnnotation", + "target":"Top.Bar" + }, + { + "class":"firrtl.passes.InlineAnnotation", + "target":"Top.Foo.x" + }, + { + "class":"firrtl.passes.InlineAnnotation", + "target":"Top.Foo.y" + }, + { + "class":"firrtl.passes.InlineAnnotation", + "target":"Top" + }, + { + "class":"firrtl.passes.InlineAnnotation", + "target":"OtherTop" + }, + { + "class":"firrtl.passes.InlineAnnotation", + "target":"OtherTop.Foo.x" + }, + { + "class":"firrtl.passes.InlineAnnotation", + "target":"OtherTop.Bar" + }, + { + "class":"firrtl.passes.InlineAnnotation", + "target":"OtherTop.Foo.y" + } +] + -- cgit v1.2.3