Skip to content

Commit

Permalink
add additionalAnnotations for SerializableModuleElaborator (#4477)
Browse files Browse the repository at this point in the history
This is used for provide annotation support at elaboration time, e.g.
PrintFullStackTraceAnnotation, ThrowOnFirstErrorAnnotation,
WarningsAsErrorsAnnotation, IncludeUtilMetadata
  • Loading branch information
sequencer authored Oct 18, 2024
1 parent 426d048 commit 2d2428d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
package chisel3.experimental.util

import geny.Readable

import chisel3.RawModule
import chisel3.experimental.{SerializableModule, SerializableModuleGenerator, SerializableModuleParameter}
import firrtl.annotations.Annotation

import scala.reflect.runtime.universe
import scala.reflect.runtime.universe.{runtimeMirror, typeOf}

/** Mixin this trait to produce elaborators for [[SerializableModule]]
*/
trait SerializableModuleElaborator {
def additionalAnnotations: Seq[Annotation] = Nil

/**
* Implementation of a config API to serialize the [[SerializableModuleParameter]]
Expand Down Expand Up @@ -61,7 +62,7 @@ trait SerializableModuleElaborator {
upickle.default.read[P](parameter)
).module().asInstanceOf[RawModule]
)
): firrtl.AnnotationSeq
) ++ additionalAnnotations
) { case (annos, stage) => stage.transform(annos) }
.flatMap {
case firrtl.stage.FirrtlCircuitAnnotation(circuit) =>
Expand Down

0 comments on commit 2d2428d

Please sign in to comment.