From ad45291c041b5b5563ec28cddf316b13c4287751 Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Fri, 7 Aug 2020 20:41:26 -0700 Subject: [PATCH 1/4] Refactor build.sbt into a more normal style (#236) --- build.sbt | 203 +++++++++++++++++++++++++----------------------------- 1 file changed, 94 insertions(+), 109 deletions(-) diff --git a/build.sbt b/build.sbt index 03ff2224..f3fffbf3 100644 --- a/build.sbt +++ b/build.sbt @@ -40,122 +40,107 @@ def javacOptionsVersion(scalaVersion: String): Seq[String] = { } } -name := "treadle" - -organization := "edu.berkeley.cs" - -version := "1.3-SNAPSHOT" - -scalaVersion := "2.12.10" - -crossScalaVersions := Seq("2.12.10", "2.11.12") - -// enables using control-c in sbt CLI -cancelable in Global := true - -resolvers ++= Seq( - Resolver.sonatypeRepo("snapshots"), - Resolver.sonatypeRepo("releases"), - Resolver.sonatypeRepo("public") -) - -// Assembly - -assemblyJarName in assembly := "treadle.jar" - -mainClass in assembly := Some("treadle.TreadleRepl") - -test in assembly := {} // Should there be tests? - -assemblyOutputPath in assembly := file("./utils/bin/treadle.jar") - - // Provide a managed dependency on X if -DXVersion="" is supplied on the command line. val defaultVersions = Map("firrtl" -> "1.4-SNAPSHOT") -// Ignore dependencies on Berkeley artifacts. -// scala-steward:off -libraryDependencies ++= (Seq("firrtl").map { - dep: String => "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep)) }) -// scala-steward:on - -// sbt 1.2.6 fails with `Symbol 'term org.junit' is missing from the classpath` -// when compiling tests under 2.11.12 -// An explicit dependency on junit seems to alleviate this. -libraryDependencies ++= Seq( - "junit" % "junit" % "4.13" % "test", - "org.scalatest" %% "scalatest" % "3.1.2" % "test", - "org.scalacheck" %% "scalacheck" % "1.14.3" % "test", - "com.github.scopt" %% "scopt" % "3.7.1", - "org.scala-lang.modules" % "scala-jline" % "2.12.1", - "org.json4s" %% "json4s-native" % "3.6.8" +lazy val baseSettings = Seq( + name := "treadle", + organization := "edu.berkeley.cs", + version := "1.3-SNAPSHOT", + scalaVersion := "2.12.10", + crossScalaVersions := Seq("2.12.10", "2.11.12"), + // enables using control-c in sbt CLI + cancelable in Global := true, + resolvers ++= Seq( + Resolver.sonatypeRepo("snapshots"), + Resolver.sonatypeRepo("releases"), + Resolver.sonatypeRepo("public") + ), + // Ignore dependencies on Berkeley artifacts. + // scala-steward:off + libraryDependencies ++= (Seq("firrtl").map { + dep: String => "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep)) }), + // scala-steward:on + // sbt 1.2.6 fails with `Symbol 'term org.junit' is missing from the classpath` + // when compiling tests under 2.11.12 + // An explicit dependency on junit seems to alleviate this. + libraryDependencies ++= Seq( + "junit" % "junit" % "4.13" % "test", + "org.scalatest" %% "scalatest" % "3.1.2" % "test", + "org.scalacheck" %% "scalacheck" % "1.14.3" % "test", + "com.github.scopt" %% "scopt" % "3.7.1", + "org.scala-lang.modules" % "scala-jline" % "2.12.1", + "org.json4s" %% "json4s-native" % "3.6.8" + ), + scalacOptions in Compile ++= Seq( + "-deprecation", + "-unchecked", + "-language:reflectiveCalls", + "-language:existentials", + "-language:implicitConversions", + "-Ywarn-unused-import" // required by `RemoveUnused` rule + ), + javacOptions ++= javacOptionsVersion(scalaVersion.value) ) -//javaOptions in run ++= Seq( - //"-Xms2G", "-Xmx4G", "-XX:MaxPermSize=1024M", "-XX:+UseConcMarkSweepGC") -//) - -publishMavenStyle := true - -publishArtifact in Test := false -pomIncludeRepository := { x => false } - -pomExtra := (http://chisel.eecs.berkeley.edu/ - - - BSD-style - http://www.opensource.org/licenses/bsd-license.php - repo - - - - https://github.com/freechipsproject/treadle.git - scm:git:github.com/freechipsproject/treadle.git - - - - chick - Charles Markley - https://aspire.eecs.berkeley.edu/author/chick/ - -) +lazy val assemblySettings = Seq( + assemblyJarName in assembly := "treadle.jar", + mainClass in assembly := Some("treadle.TreadleRepl"), + test in assembly := {}, // Should there be tests? + assemblyOutputPath in assembly := file("./utils/bin/treadle.jar") +) -publishTo := { - val v = version.value - val nexus = "https://oss.sonatype.org/" - if (v.trim.endsWith("SNAPSHOT")) { - Some("snapshots" at nexus + "content/repositories/snapshots") - } - else { - Some("releases" at nexus + "service/local/staging/deploy/maven2") +lazy val publishSettings = Seq( + publishMavenStyle := true, + publishArtifact in Test := false, + pomIncludeRepository := { x => false }, + pomExtra := (http://chisel.eecs.berkeley.edu/ + + + BSD-style + http://www.opensource.org/licenses/bsd-license.php + repo + + + + https://github.com/freechipsproject/treadle.git + scm:git:github.com/freechipsproject/treadle.git + + + + chick + Charles Markley + https://aspire.eecs.berkeley.edu/author/chick/ + + ), + publishTo := { + val v = version.value + val nexus = "https://oss.sonatype.org/" + if (v.trim.endsWith("SNAPSHOT")) { + Some("snapshots" at nexus + "content/repositories/snapshots") + } + else { + Some("releases" at nexus + "service/local/staging/deploy/maven2") + } } -} - -// -// This is for regular compilation -// -scalacOptions in Compile ++= Seq( - "-deprecation", - "-unchecked", - "-language:reflectiveCalls", - "-language:existentials", - "-language:implicitConversions", - "-Ywarn-unused-import" // required by `RemoveUnused` rule ) -// -// This is for doc building -// -scalacOptions in Compile in doc ++= Seq( - "-deprecation", - "-Xfatal-warnings", - "-feature", - "-diagrams", - "-diagrams-max-classes", "25", - "-doc-version", version.value, - "-doc-source-url", "https://github.com/freechipsproject/treadle/tree/master/€{FILE_PATH}.scala", - "-sourcepath", baseDirectory.value.getAbsolutePath, - "-unchecked" -) ++ scalacOptionsVersion(scalaVersion.value) +lazy val docSettings = Seq( + scalacOptions in Compile in doc ++= Seq( + "-deprecation", + "-Xfatal-warnings", + "-feature", + "-diagrams", + "-diagrams-max-classes", "25", + "-doc-version", version.value, + "-doc-source-url", "https://github.com/freechipsproject/treadle/tree/master/€{FILE_PATH}.scala", + "-sourcepath", baseDirectory.value.getAbsolutePath, + "-unchecked" + ) ++ scalacOptionsVersion(scalaVersion.value), +) -javacOptions ++= javacOptionsVersion(scalaVersion.value) +lazy val treadle = (project in file(".")) + .settings(baseSettings) + .settings(assemblySettings) + .settings(publishSettings) + .settings(docSettings) From a188966d3ab33725414a0a0dbd0cc4f09f39e22d Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 12 Aug 2020 21:09:18 +0200 Subject: [PATCH 2/4] Update scalacheck-1-14_2.11, ... to 3.1.3.0 (#240) --- build.sc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sc b/build.sc index 694c6e17..f4c75b5a 100644 --- a/build.sc +++ b/build.sc @@ -103,7 +103,7 @@ class treadleCrossModule(crossVersionValue: String) extends CommonModule with Pu def ivyDeps = Agg( ivy"org.scalatest::scalatest:3.1.2", - ivy"org.scalatestplus::scalacheck-1-14:3.1.1.1", + ivy"org.scalatestplus::scalacheck-1-14:3.1.3.0", ) ++ ivyCrossDeps def testFrameworks = Seq("org.scalatest.tools.Framework") From 4b3e87fa3555f0496bbd723a26d66613148cd200 Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 12 Aug 2020 21:26:22 +0200 Subject: [PATCH 3/4] Update scalatest, scalatest_2.11, ... to 3.2.1 (#237) Co-authored-by: Chick Markley --- build.sbt | 2 +- build.sc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index f3fffbf3..399d2636 100644 --- a/build.sbt +++ b/build.sbt @@ -66,7 +66,7 @@ lazy val baseSettings = Seq( // An explicit dependency on junit seems to alleviate this. libraryDependencies ++= Seq( "junit" % "junit" % "4.13" % "test", - "org.scalatest" %% "scalatest" % "3.1.2" % "test", + "org.scalatest" %% "scalatest" % "3.2.1" % "test", "org.scalacheck" %% "scalacheck" % "1.14.3" % "test", "com.github.scopt" %% "scopt" % "3.7.1", "org.scala-lang.modules" % "scala-jline" % "2.12.1", diff --git a/build.sc b/build.sc index f4c75b5a..f3f9c9b5 100644 --- a/build.sc +++ b/build.sc @@ -102,7 +102,7 @@ class treadleCrossModule(crossVersionValue: String) extends CommonModule with Pu } def ivyDeps = Agg( - ivy"org.scalatest::scalatest:3.1.2", + ivy"org.scalatest::scalatest:3.2.1", ivy"org.scalatestplus::scalacheck-1-14:3.1.3.0", ) ++ ivyCrossDeps From 9e928c30a652e6d1d99231e19cfe77e30da6d690 Mon Sep 17 00:00:00 2001 From: Chick Markley Date: Fri, 14 Aug 2020 09:00:41 -0700 Subject: [PATCH 4/4] Fix problems caused by PadWidths creating Dshlw (#238) - Switch to using Forms.LowForm - Include other optimizations from - LowFormMinimumOptimized - LowFormOptimized - without those passes some treadle tests take 25X longer to run --- .../scala/treadle/stage/phases/PrepareAst.scala | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/scala/treadle/stage/phases/PrepareAst.scala b/src/main/scala/treadle/stage/phases/PrepareAst.scala index dc52456a..d7b3fdcc 100644 --- a/src/main/scala/treadle/stage/phases/PrepareAst.scala +++ b/src/main/scala/treadle/stage/phases/PrepareAst.scala @@ -19,7 +19,7 @@ package treadle.stage.phases import firrtl.options.{Dependency, Phase} import firrtl.stage.{FirrtlCircuitAnnotation, Forms} import firrtl.transforms.BlackBoxSourceHelper -import firrtl.{AnnotationSeq, CircuitState} +import firrtl.{AnnotationSeq, CircuitState, passes} import treadle.TreadleCircuitStateAnnotation import treadle.utils.{AugmentPrintf, FixupOps} @@ -31,7 +31,16 @@ class PrepareAst extends Phase { Dependency[BlackBoxSourceHelper], Dependency[FixupOps], Dependency[AugmentPrintf] - ) ++ Forms.LowFormOptimized + ) ++ Forms.LowForm ++ Seq( + Dependency(passes.RemoveValidIf), + Dependency(passes.memlib.VerilogMemDelays), + Dependency(passes.SplitExpressions), + Dependency[firrtl.transforms.LegalizeAndReductionsTransform], + Dependency[firrtl.transforms.ConstantPropagation], + Dependency[firrtl.transforms.CombineCats], + Dependency(passes.CommonSubexpressionElimination), + Dependency[firrtl.transforms.DeadCodeElimination] + ) private def compiler = new firrtl.stage.transforms.Compiler(targets, currentState = Nil) private val transforms = compiler.flattenedTransformOrder