diff --git a/.gitmodules b/.gitmodules index 5bbbedd0..26846989 100644 --- a/.gitmodules +++ b/.gitmodules @@ -46,3 +46,12 @@ [submodule "vlsi/hammer-cad-plugins"] path = vlsi/hammer-cad-plugins url = https://github.com/ucb-bar/hammer-cad-plugins.git +[submodule "tools/dsptools"] + path = tools/dsptools + url = https://github.com/ucb-bar/dsptools.git +[submodule "tools/chisel-testers"] + path = tools/chisel-testers + url = https://github.com/freechipsproject/chisel-testers.git +[submodule "tools/treadle"] + path = tools/treadle + url = https://github.com/freechipsproject/treadle.git diff --git a/build.sbt b/build.sbt index cb3a0b69..c5562c45 100644 --- a/build.sbt +++ b/build.sbt @@ -43,6 +43,22 @@ def conditionalDependsOn(prj: Project): Project = { } } +/** + * It has been a struggle for us to override settings in subprojects. + * An example would be adding a dependency to rocketchip on midas's targetutils library, + * or replacing dsptools's maven dependency on chisel with the local chisel project. + * + * This function works around this by specifying the project's root at src/ and overriding + * scalaSource and resourceDirectory. + */ +def freshProject(name: String, dir: File): Project = { + Project(id = name, base = dir / "src") + .settings( + scalaSource in Compile := baseDirectory.value / "main" / "scala", + resourceDirectory in Compile := baseDirectory.value / "main" / "resources" + ) +} + // Fork each scala test for now, to work around persistent mutable state // in Rocket-Chip based generators def isolateAllTests(tests: Seq[TestDefinition]) = tests map { test => @@ -55,6 +71,21 @@ def isolateAllTests(tests: Seq[TestDefinition]) = tests map { test => // NB: FIRRTL dependency is unmanaged (and dropped in sim/lib) lazy val chisel = (project in rocketChipDir / "chisel3") +lazy val treadle = freshProject("treadle", file("tools/treadle")) + .settings(commonSettings) + +lazy val `chisel-testers` = freshProject("chisel-testers", file("./tools/chisel-testers")) + .dependsOn(treadle, chisel) + .settings( + commonSettings, + libraryDependencies ++= Seq( + "junit" % "junit" % "4.12", + "org.scalatest" %% "scalatest" % "3.0.5", + "org.scalacheck" %% "scalacheck" % "1.14.0", + "com.github.scopt" %% "scopt" % "3.7.0" + ) + ) + // Contains annotations & firrtl passes you may wish to use in rocket-chip without // introducing a circular dependency between RC and MIDAS lazy val midasTargetUtils = ProjectRef(firesimDir, "targetutils") @@ -66,14 +97,8 @@ lazy val hardfloat = (project in rocketChipDir / "hardfloat") lazy val rocketMacros = (project in rocketChipDir / "macros") .settings(commonSettings) -// HACK: I'm strugging to override settings in rocket-chip's build.sbt (i want -// the subproject to register a new library dependendency on midas's targetutils library) -// So instead, avoid the existing build.sbt altogether and specify the project's root at src/ -lazy val rocketchip = (project in rocketChipDir / "src") - .settings( - commonSettings, - scalaSource in Compile := baseDirectory.value / "main" / "scala", - resourceDirectory in Compile := baseDirectory.value / "main" / "resources") +lazy val rocketchip = freshProject("rocketchip", rocketChipDir) + .settings(commonSettings) .dependsOn(chisel, hardfloat, rocketMacros) lazy val testchipip = (project in file("generators/testchipip")) @@ -110,6 +135,22 @@ lazy val barstoolsMacros = (project in file("./tools/barstools/macros/")) .enablePlugins(sbtassembly.AssemblyPlugin) .settings(commonSettings) +lazy val dsptools = freshProject("dsptools", file("./tools/dsptools")) + .dependsOn(chisel, `chisel-testers`) + .settings( + commonSettings, + libraryDependencies ++= Seq( + "org.typelevel" %% "spire" % "0.14.1", + "org.scalanlp" %% "breeze" % "0.13.2", + "junit" % "junit" % "4.12" % "test", + "org.scalatest" %% "scalatest" % "3.0.5" % "test", + "org.scalacheck" %% "scalacheck" % "1.14.0" % "test" + )) + +lazy val `rocket-dsptools` = (project in file("./tools/dsptools/rocket")) + .dependsOn(rocketchip, dsptools) + .settings(commonSettings) + lazy val sifive_blocks = (project in file("generators/sifive-blocks")) .dependsOn(rocketchip) .settings(commonSettings) diff --git a/tools/chisel-testers b/tools/chisel-testers new file mode 160000 index 00000000..41f4eef0 --- /dev/null +++ b/tools/chisel-testers @@ -0,0 +1 @@ +Subproject commit 41f4eef0d85b65fabd0d786efa8baa099513dcf0 diff --git a/tools/dsptools b/tools/dsptools new file mode 160000 index 00000000..15145ab6 --- /dev/null +++ b/tools/dsptools @@ -0,0 +1 @@ +Subproject commit 15145ab6230f869676de7eb730b4267fff7b11e8 diff --git a/tools/treadle b/tools/treadle new file mode 160000 index 00000000..a03b969a --- /dev/null +++ b/tools/treadle @@ -0,0 +1 @@ +Subproject commit a03b969af104770a7662ecdbac80cebf622e674b