summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/aop/inspecting/InspectingAspect.scala
diff options
context:
space:
mode:
authorAdam Izraelevitz2020-03-02 10:51:51 -0800
committerGitHub2020-03-02 18:51:51 +0000
commit1a4e0dd65ba3e64268beca8f592bd58d98c434a4 (patch)
treea1ba3415731e88065c00dc6e874d65e113a337ef /src/main/scala/chisel3/aop/inspecting/InspectingAspect.scala
parent016939265e15936dc3ba9310d1a79ec1f60176f6 (diff)
Cleanup aspects (#1359)
* Clean up aspects * Refactored InjectingAspect with InjectorAspect * Made AspectLibrary work with objects * Cleaned up code * Apply suggestions from code review * Added tests, removed deprecated newInstance call * Backed out removal of newInstance as exceptions were different * Removed trailing commas
Diffstat (limited to 'src/main/scala/chisel3/aop/inspecting/InspectingAspect.scala')
-rw-r--r--src/main/scala/chisel3/aop/inspecting/InspectingAspect.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/aop/inspecting/InspectingAspect.scala b/src/main/scala/chisel3/aop/inspecting/InspectingAspect.scala
new file mode 100644
index 00000000..faff2817
--- /dev/null
+++ b/src/main/scala/chisel3/aop/inspecting/InspectingAspect.scala
@@ -0,0 +1,27 @@
+// See LICENSE for license details.
+
+package chisel3.aop.inspecting
+
+import chisel3.RawModule
+import chisel3.aop.Aspect
+import firrtl.AnnotationSeq
+
+/** Use for inspecting an elaborated design and printing out results
+ *
+ * @param inspect Given top-level design, print things and return nothing
+ * @tparam T Type of top-level module
+ */
+case class InspectingAspect[T <: RawModule](inspect: T => Unit) extends InspectorAspect[T](inspect)
+
+
+/** Extend to make custom inspections of an elaborated design and printing out results
+ *
+ * @param inspect Given top-level design, print things and return nothing
+ * @tparam T Type of top-level module
+ */
+abstract class InspectorAspect[T <: RawModule](inspect: T => Unit) extends Aspect[T] {
+ override def toAnnotation(top: T): AnnotationSeq = {
+ inspect(top)
+ Nil
+ }
+}