Skip to content

Commit

Permalink
Change annotation logging (#1461)
Browse files Browse the repository at this point in the history
* Change from log-level debug to trace
* Serialize as JSON rather than .serialize on each annotation

Co-Authored-By: Chick Markley <chick@qrhino.com>
  • Loading branch information
jackkoenig and chick authored Mar 23, 2020
1 parent 2d39db7 commit 6b97e33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/main/scala/firrtl/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,8 @@ trait Transform extends TransformLike[CircuitState] with DependencyAPI[Transform
val remappedAnnotations = propagateAnnotations(state.annotations, result.annotations, result.renames)

logger.info(s"Form: ${result.form}")
logger.debug(s"Annotations:")
remappedAnnotations.foreach { a =>
logger.debug(a.serialize)
}
logger.trace(s"Annotations:")
logger.trace(JsonProtocol.serialize(remappedAnnotations))
logger.trace(s"Circuit:\n${result.circuit.serialize}")
logger.info(s"======== Finished Transform $name ========\n")
CircuitState(result.circuit, result.form, remappedAnnotations, None)
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/firrtl/annotations/Annotation.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ trait Annotation extends Product {
/** Update the target based on how signals are renamed */
def update(renames: RenameMap): Seq[Annotation]

/** Pretty Print
/** Optional pretty print
*
* @note In [[logger.LogLevel.Debug]] this is called on every Annotation after every Transform
* @note rarely used
*/
def serialize: String = this.toString

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package firrtl.stage.transforms

import firrtl.{AnnotationSeq, CircuitState, RenameMap, Transform, Utils}
import firrtl.annotations.{Annotation, DeletedAnnotation}
import firrtl.annotations.{Annotation, DeletedAnnotation, JsonProtocol}
import firrtl.options.Translator

import scala.collection.mutable
Expand All @@ -21,9 +21,8 @@ class UpdateAnnotations(val underlying: Transform) extends Transform with Wrappe
val remappedAnnotations = propagateAnnotations(state.annotations, result.annotations, result.renames)

logger.info(s"Form: ${result.form}")

logger.debug(s"Annotations:")
remappedAnnotations.foreach( a => logger.debug(a.serialize) )
logger.trace(s"Annotations:")
logger.trace(JsonProtocol.serialize(remappedAnnotations))

logger.trace(s"Circuit:\n${result.circuit.serialize}")
logger.info(s"======== Finished Transform $name ========\n")
Expand Down

0 comments on commit 6b97e33

Please sign in to comment.