Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

"Scope" test resource (top.cpp). #398

Merged
merged 5 commits into from
Apr 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/test/scala/firrtlTests/FirrtlSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import firrtl.annotations
import firrtl.util.BackendCompilationUtilities

trait FirrtlRunners extends BackendCompilationUtilities {
lazy val cppHarness = new File(s"/top.cpp")

val cppHarnessResourceName: String = "/firrtl/testTop.cpp"

/** Compiles input Firrtl to Verilog */
def compileToVerilog(input: String, annotations: AnnotationMap = AnnotationMap(Seq.empty)): String = {
val circuit = Parser.parse(input.split("\n").toIterator)
Expand Down Expand Up @@ -64,7 +66,7 @@ trait FirrtlRunners extends BackendCompilationUtilities {
annotations: AnnotationMap = new AnnotationMap(Seq.empty)) = {
val testDir = compileFirrtlTest(prefix, srcDir, customTransforms, annotations)
val harness = new File(testDir, s"top.cpp")
copyResourceToFile(cppHarness.toString, harness)
copyResourceToFile(cppHarnessResourceName, harness)

// Note file copying side effect
val verilogFiles = verilogPrefixes map { vprefix =>
Expand Down
4 changes: 2 additions & 2 deletions src/test/scala/firrtlTests/IntegrationSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class GCDSplitEmissionExecutionTest extends FirrtlFlatSpec {
topFile should exist

// Copy harness over
val harness = new File(testDir, s"top.cpp")
copyResourceToFile(cppHarness.toString, harness)
val harness = new File(testDir, s"testTop.cpp")
copyResourceToFile(cppHarnessResourceName, harness)

// topFile will be compiled by Verilator command by default but we need to also include dutFile
verilogToCpp(top, testDir, Seq(dutFile), harness).!
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/firrtlTests/StringSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PrintfSpec extends FirrtlPropSpec {
val prefix = "Printf"
val testDir = compileFirrtlTest(prefix, "/features")
val harness = new File(testDir, s"top.cpp")
copyResourceToFile(cppHarness.toString, harness)
copyResourceToFile(cppHarnessResourceName, harness)

verilogToCpp(prefix, testDir, Seq(), harness).!
cppToExe(prefix, testDir).!
Expand Down