diff --git a/build.sbt b/build.sbt
index ac003562..63af1699 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.0-RC1"
-
-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.0-RC1")
-// 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.0-RC1",
+ 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.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",
+ "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)
diff --git a/build.sc b/build.sc
index d5129adb..56cfe7a7 100644
--- a/build.sc
+++ b/build.sc
@@ -102,8 +102,8 @@ 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.scalatest::scalatest:3.2.1",
+ ivy"org.scalatestplus::scalacheck-1-14:3.1.3.0",
) ++ ivyCrossDeps
def testFrameworks = Seq("org.scalatest.tools.Framework")
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