aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/firrtlTests/ReplSeqMemTests.scala
diff options
context:
space:
mode:
authorJack Koenig2017-03-06 14:51:20 -0600
committerGitHub2017-03-06 14:51:20 -0600
commit3d58123ae654a2101ba81304ca3863b3be12c4f3 (patch)
tree2e662485fef5327a2697dbd4a9b42a2cdc5bae5f /src/test/scala/firrtlTests/ReplSeqMemTests.scala
parentc89f74f19dd5162ee533a0a20825819bc52bc73e (diff)
Add ability to emit 1 file per module (#443)
Changes Emitters to also be Transforms and use Annotations for both telling an emitter to do emission as well as getting the emitted result. Helper functions ease the use of the new interface. Also adds a FirrtlExecutionOptions field as well as a command-line option. Use of Writers in Compilers and Emitters is now deprecated.
Diffstat (limited to 'src/test/scala/firrtlTests/ReplSeqMemTests.scala')
-rw-r--r--src/test/scala/firrtlTests/ReplSeqMemTests.scala36
1 files changed, 15 insertions, 21 deletions
diff --git a/src/test/scala/firrtlTests/ReplSeqMemTests.scala b/src/test/scala/firrtlTests/ReplSeqMemTests.scala
index 01a4501b..1a5b44e6 100644
--- a/src/test/scala/firrtlTests/ReplSeqMemTests.scala
+++ b/src/test/scala/firrtlTests/ReplSeqMemTests.scala
@@ -9,6 +9,7 @@ import firrtl.passes.memlib._
import annotations._
class ReplSeqMemSpec extends SimpleTransformSpec {
+ def emitter = new LowFirrtlEmitter
def transforms = Seq(
new ChirrtlToHighFirrtl(),
new IRToWorkingIR(),
@@ -62,10 +63,9 @@ circuit Top :
""".stripMargin
val confLoc = "ReplSeqMemTests.confTEMP"
val aMap = AnnotationMap(Seq(ReplSeqMemAnnotation("-c:Top:-o:"+confLoc)))
- val writer = new java.io.StringWriter
- compile(CircuitState(parse(input), ChirrtlForm, Some(aMap)), writer)
+ val res = compileAndEmit(CircuitState(parse(input), ChirrtlForm, Some(aMap)))
// Check correctness of firrtl
- parse(writer.toString)
+ parse(res.getEmittedCircuit.value)
(new java.io.File(confLoc)).delete()
}
@@ -85,10 +85,9 @@ circuit Top :
""".stripMargin
val confLoc = "ReplSeqMemTests.confTEMP"
val aMap = AnnotationMap(Seq(ReplSeqMemAnnotation("-c:Top:-o:"+confLoc)))
- val writer = new java.io.StringWriter
- compile(CircuitState(parse(input), ChirrtlForm, Some(aMap)), writer)
+ val res = compileAndEmit(CircuitState(parse(input), ChirrtlForm, Some(aMap)))
// Check correctness of firrtl
- parse(writer.toString)
+ parse(res.getEmittedCircuit.value)
(new java.io.File(confLoc)).delete()
}
@@ -111,10 +110,9 @@ circuit CustomMemory :
""".stripMargin
val confLoc = "ReplSeqMemTests.confTEMP"
val aMap = AnnotationMap(Seq(ReplSeqMemAnnotation("-c:CustomMemory:-o:"+confLoc)))
- val writer = new java.io.StringWriter
- compile(CircuitState(parse(input), ChirrtlForm, Some(aMap)), writer)
+ val res = compileAndEmit(CircuitState(parse(input), ChirrtlForm, Some(aMap)))
// Check correctness of firrtl
- parse(writer.toString)
+ parse(res.getEmittedCircuit.value)
(new java.io.File(confLoc)).delete()
}
@@ -137,10 +135,9 @@ circuit CustomMemory :
""".stripMargin
val confLoc = "ReplSeqMemTests.confTEMP"
val aMap = AnnotationMap(Seq(ReplSeqMemAnnotation("-c:CustomMemory:-o:"+confLoc)))
- val writer = new java.io.StringWriter
- compile(CircuitState(parse(input), ChirrtlForm, Some(aMap)), writer)
+ val res = compileAndEmit(CircuitState(parse(input), ChirrtlForm, Some(aMap)))
// Check correctness of firrtl
- parse(writer.toString)
+ parse(res.getEmittedCircuit.value)
(new java.io.File(confLoc)).delete()
}
@@ -213,10 +210,9 @@ circuit CustomMemory :
val aMap = AnnotationMap(Seq(
ReplSeqMemAnnotation("-c:CustomMemory:-o:"+confLoc),
NoDedupMemAnnotation(ComponentName("mem_0", ModuleName("CustomMemory",CircuitName("CustomMemory"))))))
- val writer = new java.io.StringWriter
- compile(CircuitState(parse(input), ChirrtlForm, Some(aMap)), writer)
+ val res = compileAndEmit(CircuitState(parse(input), ChirrtlForm, Some(aMap)))
// Check correctness of firrtl
- val circuit = parse(writer.toString)
+ val circuit = parse(res.getEmittedCircuit.value)
val numExtMods = circuit.modules.count {
case e: ExtModule => true
case _ => false
@@ -254,10 +250,9 @@ circuit CustomMemory :
val aMap = AnnotationMap(Seq(
ReplSeqMemAnnotation("-c:CustomMemory:-o:"+confLoc),
NoDedupMemAnnotation(ComponentName("mem_1", ModuleName("CustomMemory",CircuitName("CustomMemory"))))))
- val writer = new java.io.StringWriter
- compile(CircuitState(parse(input), ChirrtlForm, Some(aMap)), writer)
+ val res = compileAndEmit(CircuitState(parse(input), ChirrtlForm, Some(aMap)))
// Check correctness of firrtl
- val circuit = parse(writer.toString)
+ val circuit = parse(res.getEmittedCircuit.value)
val numExtMods = circuit.modules.count {
case e: ExtModule => true
case _ => false
@@ -289,10 +284,9 @@ circuit CustomMemory :
"""
val confLoc = "ReplSeqMemTests.confTEMP"
val aMap = AnnotationMap(Seq(ReplSeqMemAnnotation("-c:CustomMemory:-o:"+confLoc)))
- val writer = new java.io.StringWriter
- compile(CircuitState(parse(input), ChirrtlForm, Some(aMap)), writer)
+ val res = compileAndEmit(CircuitState(parse(input), ChirrtlForm, Some(aMap)))
// Check correctness of firrtl
- val circuit = parse(writer.toString)
+ val circuit = parse(res.getEmittedCircuit.value)
val numExtMods = circuit.modules.count {
case e: ExtModule => true
case _ => false