-
Notifications
You must be signed in to change notification settings - Fork 604
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit .fir lazily, overcomes JVM 2 GiB String limit
- Loading branch information
1 parent
211161b
commit 62b8c1b
Showing
2 changed files
with
18 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package chisel3.internal.firrtl | ||
import firrtl.{ir => fir} | ||
|
||
import scala.collection.immutable.LazyList // Needed for 2.12 alias | ||
import firrtl.ir.Serializer | ||
|
||
private[chisel3] object Emitter { | ||
def emit(circuit: Circuit): String = { | ||
val fcircuit = Converter.convertLazily(circuit) | ||
fir.Serializer.serialize(fcircuit) | ||
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") | ||
} | ||
result ++ moduleStrings | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters