aboutsummaryrefslogtreecommitdiff
path: root/src/test/scala/firrtlTests/execution/VerilogExecution.scala
diff options
context:
space:
mode:
authorAlbert Magyar2019-10-21 12:10:51 -0700
committerGitHub2019-10-21 12:10:51 -0700
commitb43288d588d04775230456ca85fa231a8cf397fe (patch)
tree0933b15baca7520faf5aae0f9e1fc60bb36390d4 /src/test/scala/firrtlTests/execution/VerilogExecution.scala
parentfd981848c7d2a800a15f9acfbf33b57dd1c6225b (diff)
parent24f7d90b032f7058ae379ff3592c9d29c7f987e7 (diff)
Merge pull request #1202 from freechipsproject/fix-verilog-mem-delay-en
Fix handling of read enables for write-first (default) memories in VerilogMemDelays
Diffstat (limited to 'src/test/scala/firrtlTests/execution/VerilogExecution.scala')
-rw-r--r--src/test/scala/firrtlTests/execution/VerilogExecution.scala32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/execution/VerilogExecution.scala b/src/test/scala/firrtlTests/execution/VerilogExecution.scala
new file mode 100644
index 00000000..17eecc65
--- /dev/null
+++ b/src/test/scala/firrtlTests/execution/VerilogExecution.scala
@@ -0,0 +1,32 @@
+package firrtlTests.execution
+
+import java.io.File
+
+import firrtl._
+import firrtl.ir._
+import firrtlTests._
+
+import firrtl.stage.{FirrtlCircuitAnnotation, FirrtlStage}
+import firrtl.options.TargetDirAnnotation
+
+/**
+ * Mixing in this trait causes a SimpleExecutionTest to be run in Verilog simulation.
+ */
+trait VerilogExecution extends TestExecution {
+ this: SimpleExecutionTest =>
+ def runEmittedDUT(c: Circuit, testDir: File): Unit = {
+ // Run FIRRTL, emit Verilog file
+ val cAnno = FirrtlCircuitAnnotation(c)
+ val tdAnno = TargetDirAnnotation(testDir.getAbsolutePath)
+ (new FirrtlStage).run(AnnotationSeq(Seq(cAnno, tdAnno)))
+
+ // Copy harness resource to test directory
+ val harness = new File(testDir, s"top.cpp")
+ copyResourceToFile(cppHarnessResourceName, harness)
+
+ // Make and run Verilog simulation
+ verilogToCpp(c.main, testDir, Nil, harness).!
+ cppToExe(c.main, testDir).!
+ assert(executeExpectingSuccess(c.main, testDir))
+ }
+}