From 0a513e45794398fd97f102e720c8365882418e0d Mon Sep 17 00:00:00 2001 From: David Biancolin Date: Wed, 1 Dec 2021 21:08:13 +0000 Subject: [PATCH 01/14] Used published dependencies for Chisel & Friends --- build.sbt | 103 +++++++++++++++++++----------------------------------- 1 file changed, 35 insertions(+), 68 deletions(-) diff --git a/build.sbt b/build.sbt index b1f7e004..509c67d7 100644 --- a/build.sbt +++ b/build.sbt @@ -17,14 +17,7 @@ lazy val commonSettings = Seq( unmanagedBase := (chipyardRoot / unmanagedBase).value, allDependencies := { // drop specific maven dependencies in subprojects in favor of Chipyard's version - val dropDeps = Seq( - ("edu.berkeley.cs", "firrtl"), - ("edu.berkeley.cs", "chisel3"), - ("edu.berkeley.cs", "rocketchip"), - ("edu.berkeley.cs", "chisel-iotesters"), - ("edu.berkeley.cs", "treadle"), - ("edu.berkeley.cs", "firrtl-interpreter")) - + val dropDeps = Seq(("edu.berkeley.cs", "rocketchip")) allDependencies.value.filterNot { dep => dropDeps.contains((dep.organization, dep.name)) } @@ -67,34 +60,23 @@ def isolateAllTests(tests: Seq[TestDefinition]) = tests map { test => new Group(test.name, Seq(test), SubProcess(options)) } toSeq +val chiselVersion = "3.4.1" + +lazy val chiselSettings = Seq( + libraryDependencies ++= Seq("edu.berkeley.cs" %% "chisel3" % chiselVersion), + addCompilerPlugin("edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full)) + +val firrtlVersion = "1.4.1" + +lazy val firrtlSettings = Seq(libraryDependencies ++= Seq("edu.berkeley.cs" %% "firrtl" % firrtlVersion)) + // Subproject definitions begin // -- Rocket Chip -- -// This needs to stay in sync with the chisel3 and firrtl git submodules -val chiselVersion = "3.4.1" -lazy val chiselRef = ProjectRef(workspaceDirectory / "chisel3", "chisel") -lazy val chiselLib = "edu.berkeley.cs" %% "chisel3" % chiselVersion -lazy val chiselLibDeps = (chiselRef / Keys.libraryDependencies) -// While not built from source, *must* be in sync with the chisel3 git submodule -// Building from source requires extending sbt-sriracha or a similar plugin and -// keeping scalaVersion in sync with chisel3 to the minor version -lazy val chiselPluginLib = "edu.berkeley.cs" % "chisel3-plugin" % chiselVersion cross CrossVersion.full - -val firrtlVersion = "1.4.1" -lazy val firrtlRef = ProjectRef(workspaceDirectory / "firrtl", "firrtl") -lazy val firrtlLib = "edu.berkeley.cs" %% "firrtl" % firrtlVersion -val firrtlLibDeps = settingKey[Seq[sbt.librarymanagement.ModuleID]]("FIRRTL Library Dependencies sans antlr4") -Global / firrtlLibDeps := { - // drop antlr4 compile dep. but keep antlr4-runtime dep. (compile needs the plugin to be setup) - (firrtlRef / Keys.libraryDependencies).value.filterNot(_.name == "antlr4") -} - - // Rocket-chip dependencies (subsumes making RC a RootProject) +// Rocket-chip dependencies (subsumes making RC a RootProject) lazy val hardfloat = (project in rocketChipDir / "hardfloat") - .sourceDependency(chiselRef, chiselLib) - .settings(addCompilerPlugin(chiselPluginLib)) - .settings(libraryDependencies ++= chiselLibDeps.value) + .settings(chiselSettings) .dependsOn(midasTargetUtils) .settings(commonSettings) .settings( @@ -126,11 +108,8 @@ lazy val rocketConfig = (project in rocketChipDir / "api-config-chipsalliance/bu ) lazy val rocketchip = freshProject("rocketchip", rocketChipDir) - .sourceDependency(chiselRef, chiselLib) - .settings(addCompilerPlugin(chiselPluginLib)) - .settings(libraryDependencies ++= chiselLibDeps.value) .dependsOn(hardfloat, rocketMacros, rocketConfig) - .settings(commonSettings) + .settings(commonSettings, chiselSettings) .settings( libraryDependencies ++= Seq( "org.scala-lang" % "scala-reflect" % scalaVersion.value, @@ -145,29 +124,27 @@ lazy val rocketchip = freshProject("rocketchip", rocketChipDir) ) lazy val rocketLibDeps = (rocketchip / Keys.libraryDependencies) + // -- Chipyard-managed External Projects -- -lazy val firrtl_interpreter = (project in file("tools/firrtl-interpreter")) - .sourceDependency(firrtlRef, firrtlLib) - .settings(commonSettings) - .settings(libraryDependencies ++= (Global / firrtlLibDeps).value) -lazy val firrtlInterpreterLibDeps = (firrtl_interpreter / Keys.libraryDependencies) - -lazy val treadle = (project in file("tools/treadle")) - .sourceDependency(firrtlRef, firrtlLib) - .settings(commonSettings) - .settings(libraryDependencies ++= (Global / firrtlLibDeps).value) -lazy val treadleLibDeps = (treadle / Keys.libraryDependencies) +// Because we're not using a release version of iotesters to work around a +// scala test version problem, override it's libdeps to prevent using snapshots +lazy val chipyardMandatedVersions = Map( + "chisel-iotesters" -> "1.5.4", + "firrtl-interpreter" -> "1.4.4", + "treadle" -> "1.3.4", + "chisel3" -> chiselVersion, + "firrtl" -> firrtlVersion +) lazy val chisel_testers = (project in file("tools/chisel-testers")) - .sourceDependency(chiselRef, chiselLib) - .settings(addCompilerPlugin(chiselPluginLib)) - .settings(libraryDependencies ++= chiselLibDeps.value) - .dependsOn(firrtl_interpreter, treadle) - .settings(libraryDependencies ++= firrtlInterpreterLibDeps.value) - .settings(libraryDependencies ++= treadleLibDeps.value) - .settings(commonSettings) -lazy val chiselTestersLibDeps = (chisel_testers / Keys.libraryDependencies) + .settings(chiselSettings) + .settings( + allDependencies := allDependencies.value.map { + case dep if chipyardMandatedVersions.isDefinedAt(dep.name) => + dep.organization %% dep.name % chipyardMandatedVersions(dep.name) + case o => o + }) // -- Normal Projects -- @@ -231,14 +208,12 @@ lazy val sodor = (project in file("generators/riscv-sodor")) lazy val sha3 = (project in file("generators/sha3")) .dependsOn(rocketchip, chisel_testers, midasTargetUtils) .settings(libraryDependencies ++= rocketLibDeps.value) - .settings(libraryDependencies ++= chiselTestersLibDeps.value) .settings(commonSettings) lazy val gemmini = (project in file("generators/gemmini")) .sourceDependency(testchipip, testchipipLib) .dependsOn(rocketchip, chisel_testers) .settings(libraryDependencies ++= rocketLibDeps.value) - .settings(libraryDependencies ++= chiselTestersLibDeps.value) .settings(commonSettings) lazy val nvdla = (project in file("generators/nvdla")) @@ -247,39 +222,31 @@ lazy val nvdla = (project in file("generators/nvdla")) .settings(commonSettings) lazy val iocell = (project in file("./tools/barstools/iocell/")) - .sourceDependency(chiselRef, chiselLib) - .settings(addCompilerPlugin(chiselPluginLib)) - .settings(libraryDependencies ++= chiselLibDeps.value) + .settings(chiselSettings) .settings(commonSettings) lazy val tapeout = (project in file("./tools/barstools/tapeout/")) .dependsOn(chisel_testers, chipyard) // must depend on chipyard to get scala resources - .settings(libraryDependencies ++= chiselTestersLibDeps.value) .settings(commonSettings) lazy val mdf = (project in file("./tools/barstools/mdf/scalalib/")) .settings(commonSettings) lazy val barstoolsMacros = (project in file("./tools/barstools/macros/")) - .sourceDependency(chiselRef, chiselLib) - .settings(addCompilerPlugin(chiselPluginLib)) - .settings(libraryDependencies ++= chiselLibDeps.value) - .dependsOn(firrtl_interpreter, mdf, chisel_testers) - .settings(libraryDependencies ++= chiselTestersLibDeps.value) - .settings(libraryDependencies ++= firrtlInterpreterLibDeps.value) + .dependsOn(mdf) .enablePlugins(sbtassembly.AssemblyPlugin) + .settings(firrtlSettings) .settings(commonSettings) lazy val dsptools = freshProject("dsptools", file("./tools/dsptools")) .dependsOn(chisel_testers) - .settings(libraryDependencies ++= chiselTestersLibDeps.value) .settings( commonSettings, libraryDependencies ++= Seq( + "org.scalatest" %% "scalatest" % "3.2.+" % "test", "org.typelevel" %% "spire" % "0.16.2", "org.scalanlp" %% "breeze" % "1.1", "junit" % "junit" % "4.13" % "test", - "org.scalatest" %% "scalatest" % "3.0.+" % "test", "org.scalacheck" %% "scalacheck" % "1.14.3" % "test", )) From 5886a848852735ca5736cc3e17b0dd8d75405aea Mon Sep 17 00:00:00 2001 From: David Biancolin Date: Wed, 1 Dec 2021 21:29:05 +0000 Subject: [PATCH 02/14] Bump FireSim --- sims/firesim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/firesim b/sims/firesim index cd13db4f..7591ff12 160000 --- a/sims/firesim +++ b/sims/firesim @@ -1 +1 @@ -Subproject commit cd13db4f2006d47bf71c593b0255b32c6a0bbec5 +Subproject commit 7591ff12cf7e7afc8ae0f0d6369404ec18411621 From 804e3de41c6a5b845ef4713acf5c0dc9f8b13773 Mon Sep 17 00:00:00 2001 From: David Biancolin Date: Wed, 1 Dec 2021 23:16:03 +0000 Subject: [PATCH 03/14] Revert "Force FIRRTL 1.4.1" This reverts commit 7d244d635c5f02512e8e9a3d2c0a057fdd4b0bd1. --- variables.mk | 4 ---- 1 file changed, 4 deletions(-) diff --git a/variables.mk b/variables.mk index d5f5cb41..9ba9f4a3 100644 --- a/variables.mk +++ b/variables.mk @@ -169,10 +169,6 @@ SBT_OPTS_FILE := $(base_dir)/.sbtopts ifneq (,$(wildcard $(SBT_OPTS_FILE))) override SBT_OPTS += $(subst $$PWD,$(base_dir),$(shell cat $(SBT_OPTS_FILE))) endif -# Workaround: Specify a firrtl version in system properties so that Treadle uses a -# compatible version of FIRRTL and not 1.5-SNAPSHOT (which is the default -# specified in it's build.sbt, and is not overridden by Chipyard's build.sbt) -override SBT_OPTS += -DfirrtlVersion=1.4.1 SCALA_BUILDTOOL_DEPS = $(SBT_SOURCES) From a2d88c714094ddb5ff1c0cdfea57782a4effb52d Mon Sep 17 00:00:00 2001 From: David Biancolin Date: Sat, 4 Dec 2021 20:10:53 +0000 Subject: [PATCH 04/14] Update tutorial patches --- scripts/tutorial-patches/build.sbt.patch | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/tutorial-patches/build.sbt.patch b/scripts/tutorial-patches/build.sbt.patch index dd26bcc9..bdbb3a7e 100644 --- a/scripts/tutorial-patches/build.sbt.patch +++ b/scripts/tutorial-patches/build.sbt.patch @@ -1,8 +1,8 @@ diff --git a/build.sbt b/build.sbt -index b1f7e004..f39c3712 100644 +index c38f5180..551aa8c0 100644 --- a/build.sbt +++ b/build.sbt -@@ -184,7 +184,7 @@ lazy val testchipipLib = "edu.berkeley.cs" %% "testchipip" % "1.0-020719-SNAPSHO +@@ -169,7 +169,7 @@ lazy val testchipipLib = "edu.berkeley.cs" %% "testchipip" % "1.0-020719-SNAPSHO lazy val chipyard = (project in file("generators/chipyard")) .sourceDependency(testchipip, testchipipLib) .dependsOn(rocketchip, boom, hwacha, sifive_blocks, sifive_cache, iocell, @@ -11,19 +11,17 @@ index b1f7e004..f39c3712 100644 dsptools, `rocket-dsp-utils`, gemmini, icenet, tracegen, cva6, nvdla, sodor, ibex) .settings(libraryDependencies ++= rocketLibDeps.value) -@@ -228,11 +228,11 @@ lazy val sodor = (project in file("generators/riscv-sodor")) +@@ -213,10 +213,10 @@ lazy val sodor = (project in file("generators/riscv-sodor")) .settings(libraryDependencies ++= rocketLibDeps.value) .settings(commonSettings) -lazy val sha3 = (project in file("generators/sha3")) - .dependsOn(rocketchip, chisel_testers, midasTargetUtils) - .settings(libraryDependencies ++= rocketLibDeps.value) -- .settings(libraryDependencies ++= chiselTestersLibDeps.value) - .settings(commonSettings) +//lazy val sha3 = (project in file("generators/sha3")) +// .dependsOn(rocketchip, chisel_testers, midasTargetUtils) +// .settings(libraryDependencies ++= rocketLibDeps.value) -+// .settings(libraryDependencies ++= chiselTestersLibDeps.value) +// .settings(commonSettings) lazy val gemmini = (project in file("generators/gemmini")) From a5b412cfbcae3ed8237aab964bb03ef7ee9f4188 Mon Sep 17 00:00:00 2001 From: David Biancolin Date: Mon, 6 Dec 2021 23:36:13 +0000 Subject: [PATCH 05/14] Remove sriracha and generated .sbtopts --- .circleci/do-rtl-build.sh | 3 --- .circleci/run-firesim-scala-tests.sh | 3 --- .gitignore | 1 - build.sbt | 17 +++++------------ project/plugins.sbt | 1 - scripts/init-submodules-no-riscv-tools-nolog.sh | 2 -- variables.mk | 9 ++------- 7 files changed, 7 insertions(+), 29 deletions(-) diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index 95f3c903..3a537ea3 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -21,9 +21,6 @@ cd $LOCAL_CHIPYARD_DIR ./scripts/init-submodules-no-riscv-tools.sh ./scripts/init-fpga.sh -# replace the workspace dir with a local dir so you can copy around -sed -i -E 's/(workspace=).*(\/tools)/\1$PWD\2/g' .sbtopts - # set stricthostkeychecking to no (must happen before rsync) run "echo \"Ping $SERVER\"" diff --git a/.circleci/run-firesim-scala-tests.sh b/.circleci/run-firesim-scala-tests.sh index 0a74adb8..022894f2 100755 --- a/.circleci/run-firesim-scala-tests.sh +++ b/.circleci/run-firesim-scala-tests.sh @@ -29,9 +29,6 @@ mkdir -p $local_firesim_sysroot ./scripts/build-libdwarf.sh $local_firesim_sysroot cd $LOCAL_CHIPYARD_DIR -# replace the workspace dir with a local dir so you can copy around -sed -i -E 's/(workspace=).*(\/tools)/\1$PWD\2/g' .sbtopts - make -C $LOCAL_CHIPYARD_DIR/tools/dromajo/dromajo-src/src # set stricthostkeychecking to no (must happen before rsync) diff --git a/.gitignore b/.gitignore index 7c0f02bf..257d2c58 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,3 @@ tags env-riscv-tools.sh env-esp-tools.sh .bsp/ -.sbtopts diff --git a/build.sbt b/build.sbt index 509c67d7..d44a9243 100644 --- a/build.sbt +++ b/build.sbt @@ -156,11 +156,9 @@ lazy val testchipip = (project in file("generators/testchipip")) .dependsOn(rocketchip, sifive_blocks) .settings(libraryDependencies ++= rocketLibDeps.value) .settings(commonSettings) -lazy val testchipipLib = "edu.berkeley.cs" %% "testchipip" % "1.0-020719-SNAPSHOT" lazy val chipyard = (project in file("generators/chipyard")) - .sourceDependency(testchipip, testchipipLib) - .dependsOn(rocketchip, boom, hwacha, sifive_blocks, sifive_cache, iocell, + .dependsOn(testchipip, rocketchip, boom, hwacha, sifive_blocks, sifive_cache, iocell, sha3, // On separate line to allow for cleaner tutorial-setup patches dsptools, `rocket-dsp-utils`, gemmini, icenet, tracegen, cva6, nvdla, sodor, ibex) @@ -168,14 +166,12 @@ lazy val chipyard = (project in file("generators/chipyard")) .settings(commonSettings) lazy val tracegen = (project in file("generators/tracegen")) - .sourceDependency(testchipip, testchipipLib) - .dependsOn(rocketchip, sifive_cache, boom) + .dependsOn(testchipip, rocketchip, sifive_cache, boom) .settings(libraryDependencies ++= rocketLibDeps.value) .settings(commonSettings) lazy val icenet = (project in file("generators/icenet")) - .sourceDependency(testchipip, testchipipLib) - .dependsOn(rocketchip) + .dependsOn(testchipip, rocketchip) .settings(libraryDependencies ++= rocketLibDeps.value) .settings(commonSettings) @@ -185,8 +181,7 @@ lazy val hwacha = (project in file("generators/hwacha")) .settings(commonSettings) lazy val boom = (project in file("generators/boom")) - .sourceDependency(testchipip, testchipipLib) - .dependsOn(rocketchip) + .dependsOn(testchipip, rocketchip) .settings(libraryDependencies ++= rocketLibDeps.value) .settings(commonSettings) @@ -211,8 +206,7 @@ lazy val sha3 = (project in file("generators/sha3")) .settings(commonSettings) lazy val gemmini = (project in file("generators/gemmini")) - .sourceDependency(testchipip, testchipipLib) - .dependsOn(rocketchip, chisel_testers) + .dependsOn(testchipip, rocketchip, chisel_testers) .settings(libraryDependencies ++= rocketLibDeps.value) .settings(commonSettings) @@ -280,7 +274,6 @@ lazy val midas = ProjectRef(firesimDir, "midas") lazy val firesimLib = ProjectRef(firesimDir, "firesimLib") lazy val firechip = (project in file("generators/firechip")) - .sourceDependency(testchipip, testchipipLib) .dependsOn(chipyard, midasTargetUtils, midas, firesimLib % "test->test;compile->compile") .settings( commonSettings, diff --git a/project/plugins.sbt b/project/plugins.sbt index 7e6f3aa8..026b95e9 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -11,5 +11,4 @@ addSbtPlugin("com.simplytyped" % "sbt-antlr4" % "0.8.2") addSbtPlugin("com.github.gseitz" % "sbt-protobuf" % "0.6.3") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.21") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1") -addSbtPlugin("com.eed3si9n" % "sbt-sriracha" % "0.1.0") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.5" ) diff --git a/scripts/init-submodules-no-riscv-tools-nolog.sh b/scripts/init-submodules-no-riscv-tools-nolog.sh index 743ea198..967c4ba7 100755 --- a/scripts/init-submodules-no-riscv-tools-nolog.sh +++ b/scripts/init-submodules-no-riscv-tools-nolog.sh @@ -88,5 +88,3 @@ echo "# line auto-generated by init-submodules-no-riscv-tools.sh" >> env.sh echo '__DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]:-${(%):-%x}}")")"' >> env.sh echo "PATH=\$__DIR/bin:\$PATH" >> env.sh echo "PATH=\$__DIR/software/firemarshal:\$PATH" >> env.sh -echo "-Dsbt.sourcemode=true" > .sbtopts -echo "-Dsbt.workspace=$CHIPYARD_DIR/tools" >> .sbtopts diff --git a/variables.mk b/variables.mk index 9ba9f4a3..dd40f565 100644 --- a/variables.mk +++ b/variables.mk @@ -6,7 +6,8 @@ HELP_COMPILATION_VARIABLES = \ " JAVA_HEAP_SIZE = if overridden, set the default java heap size (default is 8G)" \ " JAVA_TOOL_OPTIONS = if overridden, set underlying java tool options (default sets misc. sizes and tmp dir)" \ -" SBT_OPTS = if overridden, set underlying sbt options (default uses options in .sbtopts)" \ +" SBT_OPTS = set additional sbt command line options (these take the form -Dsbt.