summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorJack Koenig2021-08-20 11:30:27 -0700
committerJack Koenig2021-08-23 17:13:42 -0700
commit73bd4ee6b9b510725b692c33e075362a19512d2c (patch)
treeeaeac662234be3bca5b7cbb77abd3caa7c35a420 /core/src
parentf50ce19406e45982390162777fb62c8563c962c7 (diff)
Remove chisel3's own firrtl Emitter, use firrtl Serializer
This will be slightly slower as it involves converting from Chisel modules to FIRRTL modules before turning them into Strings. This cost is somewhat mitigated by doing that conversion lazily such that we never materialize the entire firrtl Circuit in memory, only 1 module at a time.
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/scala/chisel3/internal/firrtl/Converter.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/core/src/main/scala/chisel3/internal/firrtl/Converter.scala b/core/src/main/scala/chisel3/internal/firrtl/Converter.scala
index 8efb2abc..f56c3b15 100644
--- a/core/src/main/scala/chisel3/internal/firrtl/Converter.scala
+++ b/core/src/main/scala/chisel3/internal/firrtl/Converter.scala
@@ -9,6 +9,7 @@ import chisel3.internal.{HasId, castToInt, throwException}
import scala.annotation.tailrec
import scala.collection.immutable.Queue
+import scala.collection.immutable.LazyList // Needed for 2.12 alias
private[chisel3] object Converter {
// TODO modeled on unpack method on Printable, refactor?
@@ -301,5 +302,11 @@ private[chisel3] object Converter {
def convert(circuit: Circuit): fir.Circuit =
fir.Circuit(fir.NoInfo, circuit.components.map(convert), circuit.name)
+
+ // TODO Unclear if this should just be the default
+ def convertLazily(circuit: Circuit): fir.Circuit = {
+ val lazyModules = LazyList() ++ circuit.components
+ fir.Circuit(fir.NoInfo, lazyModules.map(convert), circuit.name)
+ }
}