Adding support for Scala 2.13
Mostly import changes Some formatting changes Runs +test
This commit is contained in:
@@ -7,7 +7,8 @@ assumeStandardLibraryStripMargin = true
|
|||||||
docstrings = ScalaDoc
|
docstrings = ScalaDoc
|
||||||
lineEndings = preserve
|
lineEndings = preserve
|
||||||
includeCurlyBraceInSelectChains = false
|
includeCurlyBraceInSelectChains = false
|
||||||
danglingParentheses = true
|
danglingParentheses.defnSite = true
|
||||||
|
danglingParentheses.callSite = true
|
||||||
|
|
||||||
align.tokens.add = [
|
align.tokens.add = [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ val defaultVersions = Map(
|
|||||||
lazy val commonSettings = Seq(
|
lazy val commonSettings = Seq(
|
||||||
organization := "edu.berkeley.cs",
|
organization := "edu.berkeley.cs",
|
||||||
version := "0.4-SNAPSHOT",
|
version := "0.4-SNAPSHOT",
|
||||||
scalaVersion := "2.12.10",
|
scalaVersion := "2.12.13",
|
||||||
scalacOptions := Seq("-deprecation", "-feature", "-language:reflectiveCalls", "-Xsource:2.11"),
|
crossScalaVersions := Seq("2.12.13", "2.13.6"),
|
||||||
|
scalacOptions := Seq("-deprecation", "-feature", "-language:reflectiveCalls"),
|
||||||
libraryDependencies ++= Seq("chisel3","chisel-iotesters").map {
|
libraryDependencies ++= Seq("chisel3","chisel-iotesters").map {
|
||||||
dep: String => "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep))
|
dep: String => "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep))
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,2 +1,3 @@
|
|||||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
|
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
|
||||||
|
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
|
||||||
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")
|
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.9.2")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import firrtl.ir._
|
|||||||
import firrtl.stage.{FirrtlSourceAnnotation, FirrtlStage, Forms, OutputFileAnnotation, RunFirrtlTransformAnnotation}
|
import firrtl.stage.{FirrtlSourceAnnotation, FirrtlStage, Forms, OutputFileAnnotation, RunFirrtlTransformAnnotation}
|
||||||
import firrtl.transforms.NoDCEAnnotation
|
import firrtl.transforms.NoDCEAnnotation
|
||||||
import firrtl.{PrimOps, _}
|
import firrtl.{PrimOps, _}
|
||||||
import mdf.macrolib._
|
import mdf.macrolib.{PolarizedPort, PortPolarity, SRAMCompiler, SRAMGroup, SRAMMacro}
|
||||||
|
|
||||||
import java.io.{File, FileWriter}
|
import java.io.{File, FileWriter}
|
||||||
import scala.collection.mutable.{ArrayBuffer, HashMap}
|
import scala.collection.mutable.{ArrayBuffer, HashMap}
|
||||||
@@ -109,15 +109,16 @@ object MacroCompilerAnnotation {
|
|||||||
* @param forceSynflops Set of memories to force compiling as flops regardless of the mode
|
* @param forceSynflops Set of memories to force compiling as flops regardless of the mode
|
||||||
*/
|
*/
|
||||||
case class Params(
|
case class Params(
|
||||||
mem: String,
|
mem: String,
|
||||||
memFormat: Option[String],
|
memFormat: Option[String],
|
||||||
lib: Option[String],
|
lib: Option[String],
|
||||||
hammerIR: Option[String],
|
hammerIR: Option[String],
|
||||||
costMetric: CostMetric,
|
costMetric: CostMetric,
|
||||||
mode: CompilerMode,
|
mode: CompilerMode,
|
||||||
useCompiler: Boolean,
|
useCompiler: Boolean,
|
||||||
forceCompile: Set[String],
|
forceCompile: Set[String],
|
||||||
forceSynflops: Set[String])
|
forceSynflops: Set[String]
|
||||||
|
) extends Serializable
|
||||||
|
|
||||||
/** Create a MacroCompilerAnnotation.
|
/** Create a MacroCompilerAnnotation.
|
||||||
* @param c Top-level circuit name (see class description)
|
* @param c Top-level circuit name (see class description)
|
||||||
@@ -721,16 +722,16 @@ class MacroCompilerTransform extends Transform with DependencyAPIMigration {
|
|||||||
|
|
||||||
// Read, eliminate None, get only SRAM, make firrtl macro
|
// Read, eliminate None, get only SRAM, make firrtl macro
|
||||||
val mems: Option[Seq[Macro]] = (memFileFormat match {
|
val mems: Option[Seq[Macro]] = (memFileFormat match {
|
||||||
case Some("conf") => Utils.readConfFromPath(Some(memFile))
|
case Some("conf") => readConfFromPath(Some(memFile))
|
||||||
case _ => mdf.macrolib.Utils.readMDFFromPath(Some(memFile))
|
case _ => mdf.macrolib.Utils.readMDFFromPath(Some(memFile))
|
||||||
}) match {
|
}) match {
|
||||||
case Some(x: Seq[mdf.macrolib.Macro]) =>
|
case Some(x: Seq[mdf.macrolib.Macro]) =>
|
||||||
Some(Utils.filterForSRAM(Some(x)).getOrElse(List()).map { new Macro(_) })
|
Some(filterForSRAM(Some(x)).getOrElse(List()).map { new Macro(_) })
|
||||||
case _ => None
|
case _ => None
|
||||||
}
|
}
|
||||||
val libs: Option[Seq[Macro]] = mdf.macrolib.Utils.readMDFFromPath(libFile) match {
|
val libs: Option[Seq[Macro]] = mdf.macrolib.Utils.readMDFFromPath(libFile) match {
|
||||||
case Some(x: Seq[mdf.macrolib.Macro]) =>
|
case Some(x: Seq[mdf.macrolib.Macro]) =>
|
||||||
Some(Utils.filterForSRAM(Some(x)).getOrElse(List()).map { new Macro(_) })
|
Some(filterForSRAM(Some(x)).getOrElse(List()).map { new Macro(_) })
|
||||||
case _ => None
|
case _ => None
|
||||||
}
|
}
|
||||||
val compilers: Option[mdf.macrolib.SRAMCompiler] = mdf.macrolib.Utils.readMDFFromPath(libFile) match {
|
val compilers: Option[mdf.macrolib.SRAMCompiler] = mdf.macrolib.Utils.readMDFFromPath(libFile) match {
|
||||||
@@ -866,10 +867,9 @@ object MacroCompiler extends App {
|
|||||||
try {
|
try {
|
||||||
val macros = params.get(MacrosFormat) match {
|
val macros = params.get(MacrosFormat) match {
|
||||||
case Some("conf") =>
|
case Some("conf") =>
|
||||||
Utils.filterForSRAM(Utils.readConfFromPath(params.get(Macros))).get.map(x => (new Macro(x)).blackbox)
|
filterForSRAM(readConfFromPath(params.get(Macros))).get.map(x => (new Macro(x)).blackbox)
|
||||||
case _ =>
|
case _ =>
|
||||||
Utils
|
filterForSRAM(mdf.macrolib.Utils.readMDFFromPath(params.get(Macros)))
|
||||||
.filterForSRAM(mdf.macrolib.Utils.readMDFFromPath(params.get(Macros)))
|
|
||||||
.get
|
.get
|
||||||
.map(x => (new Macro(x)).blackbox)
|
.map(x => (new Macro(x)).blackbox)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,13 +54,13 @@ object FlipChipMacro {
|
|||||||
|
|
||||||
val bumpDimensions: (Int, Int) = json.get("bump_dimensions") match {
|
val bumpDimensions: (Int, Int) = json.get("bump_dimensions") match {
|
||||||
case Some(JsArray(x)) if x.size == 2 =>
|
case Some(JsArray(x)) if x.size == 2 =>
|
||||||
val z = x.map(_.as[JsNumber].value.intValue())
|
val z = x.map(_.as[JsNumber].value.intValue)
|
||||||
(z(0), z(1))
|
(z(0), z(1))
|
||||||
case None => return None
|
case None => return None
|
||||||
}
|
}
|
||||||
val bumpLocations: Seq[Seq[String]] = json.get("bump_locations") match {
|
val bumpLocations: Seq[Seq[String]] = json.get("bump_locations") match {
|
||||||
case Some(JsArray(array)) =>
|
case Some(JsArray(array)) =>
|
||||||
array.collect { case JsArray(a2) => a2.map(_.toString) }
|
array.collect { case JsArray(a2) => a2.map(_.toString).toSeq }.toSeq
|
||||||
case _ => return None
|
case _ => return None
|
||||||
}
|
}
|
||||||
// Can't have dimensions and locations which don't match
|
// Can't have dimensions and locations which don't match
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package barstools.macros
|
package barstools.macros
|
||||||
|
|
||||||
import mdf.macrolib._
|
import mdf.macrolib.SRAMMacro
|
||||||
|
|
||||||
|
|
||||||
/** Tests to check that the cost function mechanism is working properly. */
|
/** Tests to check that the cost function mechanism is working properly. */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user