Skip to content

Commit

Permalink
Use new lazy serialization in FIRRTL (#2741) (#2744)
Browse files Browse the repository at this point in the history
This enables emission of modules that serialize to >2 GiB of .fir text.

(cherry picked from commit 2cbc852)

Co-authored-by: Jack Koenig <koenig@sifive.com>
  • Loading branch information
mergify[bot] and jackkoenig authored Sep 20, 2022
1 parent fc3feda commit 45909f0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/scala/chisel3/internal/firrtl/Emitter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ private[chisel3] object Emitter {
Serializer.serialize(fcircuit)
}

def emitLazily(circuit: Circuit): Iterable[String] = {
val result = LazyList(s"circuit ${circuit.name} :\n")
val modules = circuit.components.view.map(Converter.convert)
val moduleStrings = modules.flatMap { m =>
Array(Serializer.serialize(m, 1), "\n\n")
def emitLazily(circuit: Circuit): Iterable[String] = new Iterable[String] {
def iterator = {
val prelude = Iterator(s"circuit ${circuit.name} :\n")
val modules = circuit.components.iterator.map(Converter.convert)
val moduleStrings = modules.flatMap { m =>
Serializer.lazily(m, 1) ++ Seq("\n\n")
}
prelude ++ moduleStrings
}
result ++ moduleStrings
}
}

0 comments on commit 45909f0

Please sign in to comment.