From 169b256a445b364e0ddd2ffab79fc1618884debf Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 13 May 2016 23:51:37 -0700 Subject: [PATCH 01/22] Set release versions. --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 13acdd53..57cc1214 100644 --- a/build.sbt +++ b/build.sbt @@ -1,11 +1,11 @@ organization := "edu.berkeley.cs" -version := "1.0" +version := "1.1-BETA" name := "Chisel.iotesters" scalaVersion := "2.11.7" -libraryDependencies ++= Seq("edu.berkeley.cs" %% "chisel3" % "3.0", - "edu.berkeley.cs" %% "firrtl" % "0.1-SNAPSHOT", +libraryDependencies ++= Seq("edu.berkeley.cs" %% "chisel3" % "3.0-BETA", + "edu.berkeley.cs" %% "firrtl" % "0.1-BETA", "org.scalatest" % "scalatest_2.11" % "2.2.4", "org.scalacheck" %% "scalacheck" % "1.12.4") From 5d68b87f5676c00dd6668616379f72e360544303 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Sat, 14 May 2016 00:19:28 -0700 Subject: [PATCH 02/22] Update chisel3 version --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 57cc1214..ded9bd74 100644 --- a/build.sbt +++ b/build.sbt @@ -4,7 +4,7 @@ name := "Chisel.iotesters" scalaVersion := "2.11.7" -libraryDependencies ++= Seq("edu.berkeley.cs" %% "chisel3" % "3.0-BETA", +libraryDependencies ++= Seq("edu.berkeley.cs" %% "chisel3" % "3.0-BETA-SNAPSHOT", "edu.berkeley.cs" %% "firrtl" % "0.1-BETA", "org.scalatest" % "scalatest_2.11" % "2.2.4", "org.scalacheck" %% "scalacheck" % "1.12.4") From bef8f23774e18c3bec44e4e634ec7bfe360cf983 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 13 May 2016 23:51:37 -0700 Subject: [PATCH 03/22] Set release versions. --- build.sbt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 13acdd53..096974a6 100644 --- a/build.sbt +++ b/build.sbt @@ -1,11 +1,11 @@ organization := "edu.berkeley.cs" -version := "1.0" +version := "1.1-BETA-SNAPSHOT" name := "Chisel.iotesters" scalaVersion := "2.11.7" -libraryDependencies ++= Seq("edu.berkeley.cs" %% "chisel3" % "3.0", - "edu.berkeley.cs" %% "firrtl" % "0.1-SNAPSHOT", +libraryDependencies ++= Seq("edu.berkeley.cs" %% "chisel3" % "3.0-BETA-SNAPSHOT", + "edu.berkeley.cs" %% "firrtl" % "0.2-BETA-SNAPSHOT", "org.scalatest" % "scalatest_2.11" % "2.2.4", "org.scalacheck" %% "scalacheck" % "1.12.4") From f7366007f14001c5d725dcfc7fa401d95f69fe4a Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Thu, 19 May 2016 16:33:02 -0700 Subject: [PATCH 04/22] Update to current sbt resolver idiom. --- build.sbt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 096974a6..0ce245c7 100644 --- a/build.sbt +++ b/build.sbt @@ -45,10 +45,9 @@ publishTo <<= version { v: String => } } - resolvers ++= Seq( - "Sonatype Snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", - "Sonatype Releases" at "http://oss.sonatype.org/content/repositories/releases" + Resolver.sonatypeRepo("snapshots"), + Resolver.sonatypeRepo("releases") ) scalacOptions in (Compile, doc) <++= (baseDirectory, version) map { (bd, v) => From e45c32bfae0ca61d52eec493768b25ab39c6526e Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Sat, 21 May 2016 20:06:12 -0700 Subject: [PATCH 05/22] Add newly required top module argument to Driver.verilogToCpp() --- src/main/scala/Chisel/iotesters/ClassicTester.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/Chisel/iotesters/ClassicTester.scala b/src/main/scala/Chisel/iotesters/ClassicTester.scala index f3f209af..7067b929 100644 --- a/src/main/scala/Chisel/iotesters/ClassicTester.scala +++ b/src/main/scala/Chisel/iotesters/ClassicTester.scala @@ -83,7 +83,7 @@ object chiselMain { } else { // Generate Verilator val harness = new File(s"${dir}/${dutName}-harness.cpp") - Driver.verilogToCpp(dutName, dir, Seq(), harness).! + Driver.verilogToCpp(dutName, dutName, dir, Seq(), harness).! // Compile Verilator Driver.cppToExe(dutName, dir).! } From bd1b11426a8a45a7588982313f5ad8bd4d32f9d0 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 7 Oct 2016 15:36:56 -0700 Subject: [PATCH 06/22] Bump versions. --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 67d766f7..7b9ffc06 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,5 @@ organization := "edu.berkeley.cs" -version := "1.1-BETA-SNAPSHOT" +version := "1.1-SNAPSHOT" name := "Chisel.iotesters" scalaVersion := "2.11.7" @@ -7,9 +7,9 @@ scalaVersion := "2.11.7" // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the default development versions, not the "release" versions. val defaultVersions = Map( - "chisel3" -> "3.0-BETA-SNAPSHOT", - "firrtl" -> "0.2-BETA-SNAPSHOT", - "firrtl-interpreter" -> "0.1-BETA-SNAPSHOT" + "chisel3" -> "3.0-SNAPSHOT", + "firrtl" -> "1.0-SNAPSHOT", + "firrtl-interpreter" -> "1.0-SNAPSHOT" ) libraryDependencies ++= (Seq("chisel3","firrtl","firrtl-interpreter").map { From f827e62514fa0cb11de1cd47eeac857b1f74ccd0 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Mon, 10 Oct 2016 10:09:21 -0700 Subject: [PATCH 07/22] Revert "Bump versions." This reverts commit bd1b11426a8a45a7588982313f5ad8bd4d32f9d0. --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 7b9ffc06..67d766f7 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,5 @@ organization := "edu.berkeley.cs" -version := "1.1-SNAPSHOT" +version := "1.1-BETA-SNAPSHOT" name := "Chisel.iotesters" scalaVersion := "2.11.7" @@ -7,9 +7,9 @@ scalaVersion := "2.11.7" // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the default development versions, not the "release" versions. val defaultVersions = Map( - "chisel3" -> "3.0-SNAPSHOT", - "firrtl" -> "1.0-SNAPSHOT", - "firrtl-interpreter" -> "1.0-SNAPSHOT" + "chisel3" -> "3.0-BETA-SNAPSHOT", + "firrtl" -> "0.2-BETA-SNAPSHOT", + "firrtl-interpreter" -> "0.1-BETA-SNAPSHOT" ) libraryDependencies ++= (Seq("chisel3","firrtl","firrtl-interpreter").map { From e8080e79295fac153dd7e9475b4a09d9b601105a Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Wed, 8 Feb 2017 08:54:51 -0800 Subject: [PATCH 08/22] Change expect error message to make it clear what was returned and what was expected (#79) (cherry picked from commit 1985bf33591ed564c03211dfc31449adb23d7de7) --test-command was broken (#95) * --test-command was broken fix --test-command so that it is used in verilator and vcs backends add test to DriverSpec to illustrate it's use. added two other tests to DriverSpec to illustrate overriding directories * fix vcs default command, was inadvertantly copied from verilator (cherry picked from commit cb3961e28f926fe7d24d1c5d685cc84e68e734d6) --- .../chisel3/iotesters/FirrtlTerpBackend.scala | 2 +- .../chisel3/iotesters/TesterOptions.scala | 8 +- .../scala/chisel3/iotesters/VCSBackend.scala | 8 +- .../chisel3/iotesters/VerilatorBackend.scala | 10 ++- .../scala/chisel3/iotesters/DriverSpec.scala | 73 ++++++++++++++++++- 5 files changed, 91 insertions(+), 10 deletions(-) diff --git a/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala b/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala index 782ac84a..e6f5d529 100644 --- a/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala +++ b/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala @@ -54,7 +54,7 @@ private[iotesters] class FirrtlTerpBackend( val got = interpretiveTester.peek(name) val good = got == expected if (verbose || !good) logger println - s"""EXPECT AT $stepNumber $msg $name -> ${bigIntToStr(got, base)} == ${bigIntToStr(expected, base)}""" + + s"""EXPECT AT $stepNumber $msg $name got ${bigIntToStr(got, base)} expected ${bigIntToStr(expected, base)}""" + s""" ${if (good) "PASS" else "FAIL"}""" if(good) interpretiveTester.expectationsMet += 1 good diff --git a/src/main/scala/chisel3/iotesters/TesterOptions.scala b/src/main/scala/chisel3/iotesters/TesterOptions.scala index 3aed6111..e37c6eef 100644 --- a/src/main/scala/chisel3/iotesters/TesterOptions.scala +++ b/src/main/scala/chisel3/iotesters/TesterOptions.scala @@ -19,7 +19,7 @@ case class TesterOptions( isVerbose: Boolean = false, displayBase: Int = 10, testerSeed: Long = System.currentTimeMillis, - testCmd: mutable.ArrayBuffer[String]= mutable.ArrayBuffer[String](), + testCmd: Seq[String] = Seq.empty, backendName: String = "firrtl", logFileName: String = "", waveform: Option[File] = None) extends ComposableOptions @@ -65,10 +65,10 @@ trait HasTesterOptions { .foreach { x => testerOptions = testerOptions.copy(displayBase = x) } .text(s"provides a seed for random number generator, default is ${testerOptions.displayBase}") - parser.opt[Seq[String]]("test-command") + parser.opt[String]("test-command") .abbr("ttc") - .foreach { x => testerOptions = testerOptions.copy(testCmd = testerOptions.testCmd ++ x) } - .text("run this as test command") + .foreach { x => testerOptions = testerOptions.copy(testCmd = x.split("""\s""")) } + .text("Change the command run as the backend. Quote this if it contains spaces") parser.opt[String]("log-file-name") .abbr("tlfn") diff --git a/src/main/scala/chisel3/iotesters/VCSBackend.scala b/src/main/scala/chisel3/iotesters/VCSBackend.scala index 9e38f1e5..95d6d8e5 100644 --- a/src/main/scala/chisel3/iotesters/VCSBackend.scala +++ b/src/main/scala/chisel3/iotesters/VCSBackend.scala @@ -143,7 +143,13 @@ private[iotesters] object setupVCSBackend { genVCSVerilogHarness(dut, new FileWriter(vcsHarnessFile), vpdFile.toString) assert(verilogToVCS(circuit.name, dir, new File(vcsHarnessFileName)).! == 0) - (dut, new VCSBackend(dut, Seq((new File(dir, circuit.name)).toString))) + val command = if(optionsManager.testerOptions.testCmd.nonEmpty) { + optionsManager.testerOptions.testCmd + } else { + Seq(new File(dir, circuit.name).toString) + } + + (dut, new VCSBackend(dut, command)) } } diff --git a/src/main/scala/chisel3/iotesters/VerilatorBackend.scala b/src/main/scala/chisel3/iotesters/VerilatorBackend.scala index 5c125f90..db9434cf 100644 --- a/src/main/scala/chisel3/iotesters/VerilatorBackend.scala +++ b/src/main/scala/chisel3/iotesters/VerilatorBackend.scala @@ -305,7 +305,13 @@ private[iotesters] object setupVerilatorBackend { assert(chisel3.Driver.verilogToCpp(circuit.name, circuit.name, dir, Seq(), new File(cppHarnessFileName)).! == 0) assert(chisel3.Driver.cppToExe(circuit.name, dir).! == 0) - (dut, new VerilatorBackend(dut, Seq((new File(dir, s"V${circuit.name}")).toString))) + val command = if(optionsManager.testerOptions.testCmd.nonEmpty) { + optionsManager.testerOptions.testCmd + } else { + Seq((new File(dir, s"V${circuit.name}")).toString) + } + + (dut, new VerilatorBackend(dut, command)) } } @@ -368,7 +374,7 @@ private[iotesters] class VerilatorBackend(dut: Chisel.Module, val got = simApiInterface.peek(path) getOrElse BigInt(rnd.nextInt) val good = got == expected if (verbose) logger println ( - s"""${msg} EXPECT ${path} -> ${bigIntToStr(got, base)} == """ + + s"""${msg} EXPECT ${path} got ${bigIntToStr(got, base)} expected""" + s"""${bigIntToStr(expected, base)} ${if (good) "PASS" else "FAIL"}""") good } diff --git a/src/test/scala/chisel3/iotesters/DriverSpec.scala b/src/test/scala/chisel3/iotesters/DriverSpec.scala index ad900934..478ac930 100644 --- a/src/test/scala/chisel3/iotesters/DriverSpec.scala +++ b/src/test/scala/chisel3/iotesters/DriverSpec.scala @@ -2,8 +2,9 @@ package chisel3.iotesters -import org.scalatest.{Matchers, FreeSpec} +import java.io.File +import org.scalatest.{FreeSpec, Matchers} import chisel3._ class DriverTest extends Module { @@ -20,9 +21,27 @@ class DriverTestTester(c: DriverTest) extends PeekPokeTester(c) { } class DriverSpec extends FreeSpec with Matchers { + /** + * recursively delete all directories in a relative path + * DO NOT DELETE absolute paths + * + * @param file: a directory hierarchy to delete + */ + def deleteDirectoryHierarchy(file: File): Unit = { + if(file.getAbsolutePath.split("/").last.isEmpty || file.getAbsolutePath == "/") { + // don't delete absolute path + } + else { + if(file.isDirectory) { + file.listFiles().foreach( f => deleteDirectoryHierarchy(f) ) + } + file.delete() + } + } + "tester driver should support a wide range of downstream toolchain options" - { - "default roptions should not fail" in { + "default options should not fail" in { chisel3.iotesters.Driver.execute( Array.empty[String], () => new DriverTest) { c => @@ -34,5 +53,55 @@ class DriverSpec extends FreeSpec with Matchers { Array("--i-am-a-bad-argument"), () => new DriverTest) { c => new DriverTestTester(c)} should be (false) } + + "this is the way to override the target directory" - { + "specifying targetDir alone will create a subdir" in { + val driverTestDir = "driver_spec_test_1" + chisel3.iotesters.Driver.execute( + Array("--target-dir", driverTestDir), + () => new DriverTest + ) { c => + new DriverTestTester(c) + } should be (true) + val dir = new File(driverTestDir) + dir.exists() should be (true) + // + dir.listFiles().exists { f => + f.getAbsolutePath.split("/").last.startsWith("chisel3.iotesters.DriverSpec") && + f.isDirectory + } should be (true) + deleteDirectoryHierarchy(new File(driverTestDir)) + } + + "specifying targetDir and topName will avoid the subdir" in { + val driverTestDir = "driver_spec_test_2" + chisel3.iotesters.Driver.execute( + Array("--target-dir", driverTestDir, "--top-name", "DriverTest"), + () => new DriverTest + ) { c => + new DriverTestTester(c) + } should be (true) + val dir = new File(driverTestDir) + dir.exists() should be (true) + // + dir.listFiles().exists { f => + f.getAbsolutePath.split("/").last == "DriverTest.v" + } should be (true) + deleteDirectoryHierarchy(new File(driverTestDir)) + } + } + + "example of setting test command" in { + val manager = new TesterOptionsManager { + testerOptions = testerOptions.copy(backendName = "verilator", testCmd = Seq("foo2/VDriverTest")) + commonOptions = commonOptions.copy(targetDirName = "foo2", topName = "DriverTest") + interpreterOptions = interpreterOptions.copy(setVerbose = false, writeVCD = true) + } + iotesters.Driver.execute(() => new DriverTest, manager) { c => + new DriverTestTester(c) + } should be (true) + + deleteDirectoryHierarchy(new File("foo2")) + } } } From d81179fe4304e248c0cf8b8b316d270671eba324 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 24 Feb 2017 16:28:36 -0800 Subject: [PATCH 09/22] more dead code elimination --- .../chisel3/iotesters/VerilatorBackend.scala | 66 ------------------- 1 file changed, 66 deletions(-) diff --git a/src/main/scala/chisel3/iotesters/VerilatorBackend.scala b/src/main/scala/chisel3/iotesters/VerilatorBackend.scala index 4aa8b0f8..b3e14a67 100644 --- a/src/main/scala/chisel3/iotesters/VerilatorBackend.scala +++ b/src/main/scala/chisel3/iotesters/VerilatorBackend.scala @@ -48,46 +48,6 @@ class GenVerilatorCppHarness( import firrtl._ import firrtl.ir._ import firrtl.Mappers._ - import firrtl.AnnotationMap - import firrtl.Utils.create_exps - import firrtl.passes.bitWidth - - private def findWidths(m: DefModule) = { - type WidthMap = collection.mutable.ArrayBuffer[(InstanceId, BigInt)] - val modNodes = nodes filter (_.parentModName == m.name) - val widthMap = new WidthMap - - /* Sadly, ports disappear in verilator ... - def loop_port(port: Port) = { - widthMap ++= (create_exps(port.name, port.tpe) flatMap (exp => - modNodes filter (_.instanceName == exp.serialize) map (_ -> bitWidth(exp.tpe))) - port - } - */ - - def loop(s: Statement): Statement = { - s match { - /* Sadly, wires disappear in verilator... - case s: DefWire if s.name.slice(0, 2) != "T_" && s.name.slice(0, 4) != "GEN_" => - widthMap ++= (create_exps(s.name, s.tpe) flatMap (exp => - modNodes filter (_.instanceName == exp.serialize) map (_ -> bitWidth(exp.tpe))) - */ - case s: DefRegister if s.name.slice(0, 2) != "T_" && s.name.slice(0, 4) != "GEN_" => - widthMap ++= (create_exps(s.name, s.tpe) flatMap (exp => - modNodes filter (_.instanceName == exp.serialize) map (_ -> bitWidth(exp.tpe)))) - case s: DefNode if s.name.slice(0, 2) != "T_" && s.name.slice(0, 4) != "GEN_" => - widthMap ++= (create_exps(s.name, s.value.tpe) flatMap (exp => - modNodes filter (_.instanceName == exp.serialize) map (_ -> bitWidth(exp.tpe)))) - case s: DefMemory if s.name.slice(0, 2) != "T_" && s.name.slice(0, 4) != "GEN_" => - widthMap ++= (modNodes filter (_.instanceName == s.name) map (_ -> bitWidth(s.dataType))) - case _ => - } - s map loop - } - - m map loop - widthMap.toSeq - } private def pushBack(writer: Writer, vector: String, pathName: String, width: BigInt) { if (width <= 8) { @@ -110,7 +70,6 @@ class GenVerilatorCppHarness( val dutName = dut.name val dutApiClassName = dutName + "_api_t" val dutVerilatorClassName = "V" + dutName - val widthMap = (circuit.modules flatMap findWidths).toMap writer.write("#include \"%s.h\"\n".format(dutVerilatorClassName)) writer.write("#include \"verilated.h\"\n") writer.write("#include \"veri_api.h\"\n") @@ -140,31 +99,6 @@ class GenVerilatorCppHarness( } pushBack(writer, "signals", "dut->reset", 1) writer.write(s""" sim_data.signal_map["%s"] = 0;\n""".format(dut.reset.pathName)) - (nodes foldLeft 1){ (id, node) => - val instanceName = s"%s.%s".format(node.parentPathName, validName(node.instanceName)) - val pathName = instanceName replace (".", "__DOT__") replace ("$", "__024") - try { - node match { - case mem: Chisel.MemBase[_] => - writer.write(s" for (size_t i = 0 ; i < ${mem.length} ; i++) {\n") - pushBack(writer, "signals", s"dut->${pathName}[i]", widthMap(node)) - writer.write(s" ostringstream oss;\n") - writer.write(s""" oss << "${instanceName}" << "[" << i << "]";\n""") - writer.write(s" sim_data.signal_map[oss.str()] = $id + i;\n") - writer.write(s" }\n") - id + mem.length - case _ => -// pushBack(writer, "signals", s"dut->$pathName", widthMap(node)) -// writer.write(s""" sim_data.signal_map["${instanceName}"] = $id;\n""") - id + 1 - } - } catch { - // For debugging - case e: java.util.NoSuchElementException => - println(s"error with $id: $instanceName") - throw e - } - } writer.write(" }\n") writer.write("#if VM_TRACE\n") writer.write(" void init_dump(VerilatedVcdC* _tfp) { tfp = _tfp; }\n") From 9fe995c1520bd0ea2dc38aab84312bd354dcb6c0 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 24 Feb 2017 16:29:39 -0800 Subject: [PATCH 10/22] fix verilator compile error in ChiselMain --- src/main/scala/chisel3/iotesters/ChiselMain.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/scala/chisel3/iotesters/ChiselMain.scala b/src/main/scala/chisel3/iotesters/ChiselMain.scala index 0f336a1d..0ad6cb73 100644 --- a/src/main/scala/chisel3/iotesters/ChiselMain.scala +++ b/src/main/scala/chisel3/iotesters/ChiselMain.scala @@ -72,7 +72,11 @@ object chiselMain { // Copy API files copyVerilatorHeaderFiles(context.targetDir.toString) // Generate Verilator - assert(chisel3.Driver.verilogToCpp(dutName, dir, Seq(), new File(s"$dutName-harness.cpp")).! == 0) + assert(chisel3.Driver.verilogToCpp( + dutName, + dir, + Seq(), + new File(dir, s"$dutName-harness.cpp")).! == 0) // Compile Verilator assert(chisel3.Driver.cppToExe(dutName, dir).! == 0) case "vcs" | "glsim" => From e7d9cbfb4c72b4afd8a3fd2b54f642d9d7062938 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 24 Feb 2017 16:45:20 -0800 Subject: [PATCH 11/22] Verilator (#114) * gitignore: add .cache-main and .cache-tests that appear when working w/Eclipse IDE * verilator: add a unit-test to build Verilator --- .gitignore | 4 ++++ src/test/scala/verilator/Verilator.scala | 19 ++++++++++++++++ src/test/scala/verilator/doohickey.scala | 11 ++++++++++ src/test/scala/verilator/thingamabob.scala | 25 ++++++++++++++++++++++ 4 files changed, 59 insertions(+) create mode 100644 src/test/scala/verilator/Verilator.scala create mode 100644 src/test/scala/verilator/doohickey.scala create mode 100644 src/test/scala/verilator/thingamabob.scala diff --git a/.gitignore b/.gitignore index e8a15072..86646108 100644 --- a/.gitignore +++ b/.gitignore @@ -424,3 +424,7 @@ project/plugins/project/ .worksheet /lib + +.cache-main +.cache-tests +test_run_dir/ diff --git a/src/test/scala/verilator/Verilator.scala b/src/test/scala/verilator/Verilator.scala new file mode 100644 index 00000000..1d750385 --- /dev/null +++ b/src/test/scala/verilator/Verilator.scala @@ -0,0 +1,19 @@ +package verilator + + +import chisel3._ +import chisel3.iotesters.chiselMain +import org.scalatest._ +import chisel3._ + +class VerilatorTest extends FlatSpec with Matchers { + "The Verilator backend" should "be able to compile the cpp code" in { + val args = Array[String]("--v", + "--backend", + "verilator", + "--compile", + "--genHarness", + "--minimumCompatibility", "3.0.0") + chiselMain(args, () => new doohickey()) + } +} diff --git a/src/test/scala/verilator/doohickey.scala b/src/test/scala/verilator/doohickey.scala new file mode 100644 index 00000000..fc5fbf76 --- /dev/null +++ b/src/test/scala/verilator/doohickey.scala @@ -0,0 +1,11 @@ +package verilator + +import chisel3._ + +class doohickey() extends Module { + val io = new Bundle { + } + val bobs = Vec.fill(16) { + Module(new thingamabob()).io + } +} diff --git a/src/test/scala/verilator/thingamabob.scala b/src/test/scala/verilator/thingamabob.scala new file mode 100644 index 00000000..61e7c5ae --- /dev/null +++ b/src/test/scala/verilator/thingamabob.scala @@ -0,0 +1,25 @@ +package verilator + +// NB! Yes: we *do* want to test the Chisel._ compatibility layer, so DO NOT change to +// chisel3._ here! +import Chisel._ + +class thingamabob() extends Module { + val io = new Bundle { + val address = Vec(32, UInt(INPUT, 16)).asInput + val thingy = UInt(INPUT, 4) + + // FIXME delete any of the unused things below and the Verilator compile problem goes away + val foo = UInt(INPUT, 1) + val foo2 = UInt(OUTPUT, 8) + val foo3 = Bool(OUTPUT) + val foo4 = UInt(OUTPUT, 16) + val foo5 = Bool(INPUT) + } + + val blah = Reg(UInt(0, 4.W)) + blah := ((Mem(1 << 4, UInt(4.W)))(io.thingy)) + + val bar = Cat(io.address(Cat(blah(3, 1), UInt(1, 1))), + io.address(Cat(blah(3, 1), UInt(0, 1)))) +} From 1dbed2b6f5ff73b969d2134f641dcdd69b72ecb4 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Wed, 3 May 2017 13:42:54 -0700 Subject: [PATCH 12/22] set release version --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 568a7ef0..5c3c514c 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,5 @@ organization := "edu.berkeley.cs" -version := "1.1-SNAPSHOT" +version := "1.1-SNAPSHOT_2017-05-03" name := "Chisel.iotesters" scalaVersion := "2.11.7" @@ -7,9 +7,9 @@ scalaVersion := "2.11.7" // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the default development versions, not the "release" versions. val defaultVersions = Map( - "chisel3" -> "3.0-SNAPSHOT", - "firrtl" -> "1.0-SNAPSHOT", - "firrtl-interpreter" -> "1.0-SNAPSHOT" + "chisel3" -> "3.0-SNAPSHOT_2017-05-03", + "firrtl" -> "1.0-SNAPSHOT_2017-05-03", + "firrtl-interpreter" -> "1.0-SNAPSHOT_2017-05-03" ) libraryDependencies ++= Seq("chisel3","firrtl","firrtl-interpreter").map { dep: String => From 6bcd4976ad68b800703084ce8caa3a83b1d31d5c Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Tue, 16 May 2017 11:18:42 -0700 Subject: [PATCH 13/22] bump release versions --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 5c3c514c..8f784a82 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,5 @@ organization := "edu.berkeley.cs" -version := "1.1-SNAPSHOT_2017-05-03" +version := "1.1-SNAPSHOT_2017-05-16" name := "Chisel.iotesters" scalaVersion := "2.11.7" @@ -7,9 +7,9 @@ scalaVersion := "2.11.7" // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the default development versions, not the "release" versions. val defaultVersions = Map( - "chisel3" -> "3.0-SNAPSHOT_2017-05-03", - "firrtl" -> "1.0-SNAPSHOT_2017-05-03", - "firrtl-interpreter" -> "1.0-SNAPSHOT_2017-05-03" + "chisel3" -> "3.0-SNAPSHOT_2017-05-16", + "firrtl" -> "1.0-SNAPSHOT_2017-05-16", + "firrtl-interpreter" -> "1.0-SNAPSHOT_2017-05-16" ) libraryDependencies ++= Seq("chisel3","firrtl","firrtl-interpreter").map { dep: String => From c7bd2137d480c3a3abfdc057f0ab2169f74b65e3 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Thu, 25 May 2017 10:22:21 -0700 Subject: [PATCH 14/22] bump chisel3 version dependency --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 8f784a82..7c8b9014 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,5 @@ organization := "edu.berkeley.cs" -version := "1.1-SNAPSHOT_2017-05-16" +version := "1.1-SNAPSHOT_2017-05-25" name := "Chisel.iotesters" scalaVersion := "2.11.7" @@ -7,7 +7,7 @@ scalaVersion := "2.11.7" // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the default development versions, not the "release" versions. val defaultVersions = Map( - "chisel3" -> "3.0-SNAPSHOT_2017-05-16", + "chisel3" -> "3.0-SNAPSHOT_2017-05-25", "firrtl" -> "1.0-SNAPSHOT_2017-05-16", "firrtl-interpreter" -> "1.0-SNAPSHOT_2017-05-16" ) From c873a8567b8a5d41ffdb1aaa6a7e5503fc62c2b2 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Tue, 30 May 2017 11:15:23 -0700 Subject: [PATCH 15/22] bump SNAPSHOT version --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 3886c8e5..d086aff7 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,5 @@ organization := "edu.berkeley.cs" -version := "1.1-SNAPSHOT_2017-05-25" +version := "1.1-SNAPSHOT_2017-05-30" name := "Chisel.iotesters" scalaVersion := "2.11.11" @@ -7,9 +7,9 @@ scalaVersion := "2.11.11" // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the default development versions, not the "release" versions. val defaultVersions = Map( - "chisel3" -> "3.0-SNAPSHOT_2017-05-25", - "firrtl" -> "1.0-SNAPSHOT_2017-05-16", - "firrtl-interpreter" -> "1.0-SNAPSHOT_2017-05-16" + "chisel3" -> "3.0-SNAPSHOT_2017-05-30", + "firrtl" -> "1.0-SNAPSHOT_2017-05-30", + "firrtl-interpreter" -> "1.0-SNAPSHOT_2017-05-30" ) libraryDependencies ++= Seq("chisel3","firrtl","firrtl-interpreter").map { dep: String => From 1acb65eec914977c78e585cad7303eafd222daa9 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Thu, 22 Jun 2017 09:49:02 -0700 Subject: [PATCH 16/22] bump version --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index d086aff7..94e70d0c 100644 --- a/build.sbt +++ b/build.sbt @@ -1,5 +1,5 @@ organization := "edu.berkeley.cs" -version := "1.1-SNAPSHOT_2017-05-30" +version := "1.1-SNAPSHOT_2017-06-22" name := "Chisel.iotesters" scalaVersion := "2.11.11" @@ -7,9 +7,9 @@ scalaVersion := "2.11.11" // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the default development versions, not the "release" versions. val defaultVersions = Map( - "chisel3" -> "3.0-SNAPSHOT_2017-05-30", - "firrtl" -> "1.0-SNAPSHOT_2017-05-30", - "firrtl-interpreter" -> "1.0-SNAPSHOT_2017-05-30" + "chisel3" -> "3.0-SNAPSHOT_2017-06-22", + "firrtl" -> "1.0-SNAPSHOT_2017-06-22", + "firrtl-interpreter" -> "1.0-SNAPSHOT_2017-06-22" ) libraryDependencies ++= Seq("chisel3","firrtl","firrtl-interpreter").map { dep: String => From 7693986c579085787e28b70de978ec99dd6d367d Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Fri, 15 Sep 2017 20:27:42 -0700 Subject: [PATCH 17/22] Enable testing coverage. --- project/plugins.sbt | 1 + 1 file changed, 1 insertion(+) diff --git a/project/plugins.sbt b/project/plugins.sbt index ff9638a8..b6971b4e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -2,3 +2,4 @@ logLevel := Level.Warn addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1") From d2f6edbf8a97feaa31e8fa7a8f9baf2e3db61bfd Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Thu, 9 Nov 2017 10:57:57 -0800 Subject: [PATCH 18/22] Bump version --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 2e569441..1ccc8040 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ def javacOptionsVersion(scalaVersion: String): Seq[String] = { } organization := "edu.berkeley.cs" -version := "1.1.0-RC1" +version := "1.1.0-RC2" name := "Chisel.iotesters" scalaVersion := "2.11.11" @@ -37,9 +37,9 @@ crossScalaVersions := Seq("2.11.11", "2.12.3") // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the release versions, not the default development versions. val defaultVersions = Map( - "chisel3" -> "3.0.0-RC1", - "firrtl" -> "1.0.0-RC1", - "firrtl-interpreter" -> "1.0.0-RC1" + "chisel3" -> "3.0.0-RC2", + "firrtl" -> "1.0.0-RC2", + "firrtl-interpreter" -> "1.0.0-RC2" ) libraryDependencies ++= Seq("chisel3","firrtl","firrtl-interpreter").map { dep: String => From 07107ce19401b8ff33b1caba944afd8ed520378d Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Wed, 22 Nov 2017 13:41:05 -0800 Subject: [PATCH 19/22] Bump version. --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 1ccc8040..232def37 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ def javacOptionsVersion(scalaVersion: String): Seq[String] = { } organization := "edu.berkeley.cs" -version := "1.1.0-RC2" +version := "1.1.0" name := "Chisel.iotesters" scalaVersion := "2.11.11" @@ -37,9 +37,9 @@ crossScalaVersions := Seq("2.11.11", "2.12.3") // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the release versions, not the default development versions. val defaultVersions = Map( - "chisel3" -> "3.0.0-RC2", - "firrtl" -> "1.0.0-RC2", - "firrtl-interpreter" -> "1.0.0-RC2" + "chisel3" -> "3.0.0", + "firrtl" -> "1.0.0", + "firrtl-interpreter" -> "1.0.0" ) libraryDependencies ++= Seq("chisel3","firrtl","firrtl-interpreter").map { dep: String => From e2bdcac7f9a643aa8fb1d6545d5ff1f00f4bbbbe Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Mon, 18 Dec 2017 11:55:58 -0800 Subject: [PATCH 20/22] Bump version, dependencies. --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 232def37..293822bd 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ def javacOptionsVersion(scalaVersion: String): Seq[String] = { } organization := "edu.berkeley.cs" -version := "1.1.0" +version := "1.1.1" name := "Chisel.iotesters" scalaVersion := "2.11.11" @@ -37,9 +37,9 @@ crossScalaVersions := Seq("2.11.11", "2.12.3") // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the release versions, not the default development versions. val defaultVersions = Map( - "chisel3" -> "3.0.0", - "firrtl" -> "1.0.0", - "firrtl-interpreter" -> "1.0.0" + "chisel3" -> "3.0.+", + "firrtl" -> "1.0.+", + "firrtl-interpreter" -> "1.0.+" ) libraryDependencies ++= Seq("chisel3","firrtl","firrtl-interpreter").map { dep: String => From e48ef1608cd3ef757b524c0d9ee6ec9201b2d5b8 Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Mon, 5 Feb 2018 10:50:39 -0800 Subject: [PATCH 21/22] Bump firrtl and dependent projects. --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index 293822bd..e1b0899c 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ def javacOptionsVersion(scalaVersion: String): Seq[String] = { } organization := "edu.berkeley.cs" -version := "1.1.1" +version := "1.1.2" name := "Chisel.iotesters" scalaVersion := "2.11.11" @@ -37,9 +37,9 @@ crossScalaVersions := Seq("2.11.11", "2.12.3") // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the release versions, not the default development versions. val defaultVersions = Map( - "chisel3" -> "3.0.+", - "firrtl" -> "1.0.+", - "firrtl-interpreter" -> "1.0.+" + "chisel3" -> "3.0.2", + "firrtl" -> "1.0.2", + "firrtl-interpreter" -> "1.0.2" ) libraryDependencies ++= Seq("chisel3","firrtl","firrtl-interpreter").map { dep: String => From b2a8acc9196753d3d4b370cce73af968f595470f Mon Sep 17 00:00:00 2001 From: Jim Lawson Date: Tue, 6 Feb 2018 15:09:10 -0800 Subject: [PATCH 22/22] Use Z.Y-RELEASE-SNAPSHOT version string for release snapshots. --- build.sbt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index cb72f7af..50eb7422 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,7 @@ def javacOptionsVersion(scalaVersion: String): Seq[String] = { } organization := "edu.berkeley.cs" -version := "1.1.x" +version := "1.1-RELEASE-SNAPSHOT" name := "Chisel.iotesters" scalaVersion := "2.11.11" @@ -37,9 +37,9 @@ crossScalaVersions := Seq("2.11.11", "2.12.3") // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. // The following are the release versions, not the default development versions. val defaultVersions = Map( - "chisel3" -> "3.0.+", - "firrtl" -> "1.0.+", - "firrtl-interpreter" -> "1.0.+" + "chisel3" -> "3.0-RELEASE-SNAPSHOT", + "firrtl" -> "1.0-RELEASE-SNAPSHOT", + "firrtl-interpreter" -> "1.0-RELEASE-SNAPSHOT" ) libraryDependencies ++= Seq("chisel3","firrtl","firrtl-interpreter").map { dep: String =>