Skip to content

Commit

Permalink
Memoize the hashcode of the ChiselCircuitAnnotation (#1485)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkoenig authored Jun 19, 2020
1 parent 8eaf10e commit 9bda7a7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/scala/chisel3/stage/ChiselAnnotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ object ChiselGeneratorAnnotation extends HasShellOptions {
/** Stores a Chisel Circuit
* @param circuit a Chisel Circuit
*/
case class ChiselCircuitAnnotation(circuit: Circuit) extends NoTargetAnnotation with ChiselOption
case class ChiselCircuitAnnotation(circuit: Circuit) extends NoTargetAnnotation with ChiselOption {
/* Caching the hashCode for a large circuit is necessary due to repeated queries.
* Not caching the hashCode will cause severe performance degredations for large [[Circuit]]s.
*/
override lazy val hashCode: Int = circuit.hashCode
}

case class ChiselOutputFileAnnotation(file: String) extends NoTargetAnnotation with ChiselOption

Expand Down

0 comments on commit 9bda7a7

Please # to comment.