diff --git a/build.sbt b/build.sbt index b536c008..e59ea1de 100644 --- a/build.sbt +++ b/build.sbt @@ -5,8 +5,8 @@ enablePlugins(SiteScaladocPlugin) enablePlugins(GhpagesPlugin) val defaultVersions = Map( - "chisel3" -> "3.6.0", - "chiseltest" -> "0.6.2" + "chisel" -> "5.1.0", + "chiseltest" -> "5.0.2" ) name := "dsptools" @@ -29,10 +29,10 @@ val commonSettings = Seq( case _ => Seq("org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4") } }, - libraryDependencies ++= Seq("chisel3").map { dep: String => - "edu.berkeley.cs" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep)) + libraryDependencies ++= Seq("chisel").map { dep: String => + "org.chipsalliance" %% dep % sys.props.getOrElse(dep + "Version", defaultVersions(dep)) }, - addCompilerPlugin(("edu.berkeley.cs" %% "chisel3-plugin" % defaultVersions("chisel3")).cross(CrossVersion.full)), + addCompilerPlugin(("org.chipsalliance" %% "chisel-plugin" % defaultVersions("chisel")).cross(CrossVersion.full)), ) val dsptoolsSettings = Seq( diff --git a/doc/Example.md b/doc/Example.md index 64cdf21b..bd8db8b4 100644 --- a/doc/Example.md +++ b/doc/Example.md @@ -6,7 +6,7 @@ A basic DSP Module + Tester might look like this: package SimpleDsp // Allows you to use Chisel Module, Bundle, etc. -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ // Allows you to use FixedPoint import fixedpoint._ // If you want to take advantage of type classes >> Data:RealBits (i.e. pass in FixedPoint or DspReal) diff --git a/fixedpoint b/fixedpoint index 36ce43c9..ef164009 160000 --- a/fixedpoint +++ b/fixedpoint @@ -1 +1 @@ -Subproject commit 36ce43c90ce9cfc63e7698fa1e27fd122c878e9e +Subproject commit ef164009e40ce5a5abe61ebcc11c12ff82e34014 diff --git a/rocket/src/main/scala/jtag2mm/TestMultiplexer.scala b/rocket/src/main/scala/jtag2mm/TestMultiplexer.scala index d2f19b4c..6ebc84f4 100644 --- a/rocket/src/main/scala/jtag2mm/TestMultiplexer.scala +++ b/rocket/src/main/scala/jtag2mm/TestMultiplexer.scala @@ -2,7 +2,7 @@ package freechips.rocketchip.jtag2mm -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import chisel3.util._ import chisel3.experimental.{FixedPoint => _, _} import fixedpoint._ diff --git a/src/main/scala/dsptools/misc/DspTesterUtilities.scala b/src/main/scala/dsptools/misc/DspTesterUtilities.scala index a729ab14..166f0cf6 100644 --- a/src/main/scala/dsptools/misc/DspTesterUtilities.scala +++ b/src/main/scala/dsptools/misc/DspTesterUtilities.scala @@ -2,7 +2,7 @@ package dsptools.misc -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import dsptools.DspException import dsptools.numbers.{DspComplex, DspReal} diff --git a/src/main/scala/dsptools/misc/PeekPokeDspExtensions.scala b/src/main/scala/dsptools/misc/PeekPokeDspExtensions.scala index e28eccf6..30736251 100644 --- a/src/main/scala/dsptools/misc/PeekPokeDspExtensions.scala +++ b/src/main/scala/dsptools/misc/PeekPokeDspExtensions.scala @@ -3,7 +3,7 @@ package dsptools.misc import breeze.math.Complex -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import chiseltest.iotesters.PeekPokeTester import dsptools.DspException diff --git a/src/main/scala/dsptools/numbers/chisel_concrete/DspComplex.scala b/src/main/scala/dsptools/numbers/chisel_concrete/DspComplex.scala index 65d7edbf..2d4c5646 100644 --- a/src/main/scala/dsptools/numbers/chisel_concrete/DspComplex.scala +++ b/src/main/scala/dsptools/numbers/chisel_concrete/DspComplex.scala @@ -2,7 +2,7 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import dsptools.DspException import breeze.math.Complex diff --git a/src/main/scala/dsptools/numbers/chisel_types/DspComplexTypeClass.scala b/src/main/scala/dsptools/numbers/chisel_types/DspComplexTypeClass.scala index 60d153ff..69ddea34 100644 --- a/src/main/scala/dsptools/numbers/chisel_types/DspComplexTypeClass.scala +++ b/src/main/scala/dsptools/numbers/chisel_types/DspComplexTypeClass.scala @@ -2,7 +2,7 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import dsptools.hasContext import implicits._ diff --git a/src/main/scala/dsptools/numbers/chisel_types/DspRealTypeClass.scala b/src/main/scala/dsptools/numbers/chisel_types/DspRealTypeClass.scala index 05485044..948ef9a2 100644 --- a/src/main/scala/dsptools/numbers/chisel_types/DspRealTypeClass.scala +++ b/src/main/scala/dsptools/numbers/chisel_types/DspRealTypeClass.scala @@ -3,7 +3,7 @@ package dsptools.numbers import chisel3.util.ShiftRegister -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import dsptools.{hasContext, DspContext, NoTrim} import fixedpoint._ diff --git a/src/main/scala/dsptools/numbers/chisel_types/FixedPointTypeClass.scala b/src/main/scala/dsptools/numbers/chisel_types/FixedPointTypeClass.scala index 128dc6d1..b71c9259 100644 --- a/src/main/scala/dsptools/numbers/chisel_types/FixedPointTypeClass.scala +++ b/src/main/scala/dsptools/numbers/chisel_types/FixedPointTypeClass.scala @@ -2,7 +2,7 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import chisel3.util.ShiftRegister import dsptools._ diff --git a/src/main/scala/dsptools/numbers/chisel_types/SIntTypeClass.scala b/src/main/scala/dsptools/numbers/chisel_types/SIntTypeClass.scala index 4d6c3edc..439dbb38 100644 --- a/src/main/scala/dsptools/numbers/chisel_types/SIntTypeClass.scala +++ b/src/main/scala/dsptools/numbers/chisel_types/SIntTypeClass.scala @@ -2,7 +2,7 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import chisel3.util.{Cat, ShiftRegister} import dsptools.{hasContext, DspContext, DspException, Grow, NoTrim, Saturate, Wrap} import fixedpoint._ diff --git a/src/main/scala/dsptools/numbers/chisel_types/UIntTypeClass.scala b/src/main/scala/dsptools/numbers/chisel_types/UIntTypeClass.scala index b8c0f99e..d71f7b24 100644 --- a/src/main/scala/dsptools/numbers/chisel_types/UIntTypeClass.scala +++ b/src/main/scala/dsptools/numbers/chisel_types/UIntTypeClass.scala @@ -2,7 +2,7 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import chisel3.util.{Cat, ShiftRegister} import dsptools.{hasContext, DspContext, DspException, Grow, Saturate, Wrap} import fixedpoint._ diff --git a/src/main/scala/dsptools/numbers/implicits/AllOps.scala b/src/main/scala/dsptools/numbers/implicits/AllOps.scala index 46e8f640..9a8072cf 100644 --- a/src/main/scala/dsptools/numbers/implicits/AllOps.scala +++ b/src/main/scala/dsptools/numbers/implicits/AllOps.scala @@ -2,7 +2,7 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import spire.macros.Ops import scala.language.experimental.macros diff --git a/src/test/scala/dsptools/ShiftRegisterDelaySpec.scala b/src/test/scala/dsptools/ShiftRegisterDelaySpec.scala index 13ce1dc2..6c66e9e3 100644 --- a/src/test/scala/dsptools/ShiftRegisterDelaySpec.scala +++ b/src/test/scala/dsptools/ShiftRegisterDelaySpec.scala @@ -2,7 +2,7 @@ package dsptools -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import chiseltest._ import chiseltest.iotesters._ import dsptools.misc.PeekPokeDspExtensions diff --git a/src/test/scala/dsptools/numbers/AbsSpec.scala b/src/test/scala/dsptools/numbers/AbsSpec.scala index 1910a64e..a0a2f51c 100644 --- a/src/test/scala/dsptools/numbers/AbsSpec.scala +++ b/src/test/scala/dsptools/numbers/AbsSpec.scala @@ -2,9 +2,8 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ -import chisel3.experimental.{FixedPoint => _, _} import dsptools.{DspContext, Grow, Wrap} import org.scalatest.freespec.AnyFreeSpec import chiseltest._ diff --git a/src/test/scala/dsptools/numbers/FixedPointSpec.scala b/src/test/scala/dsptools/numbers/FixedPointSpec.scala index a6049ba9..fa890c68 100644 --- a/src/test/scala/dsptools/numbers/FixedPointSpec.scala +++ b/src/test/scala/dsptools/numbers/FixedPointSpec.scala @@ -5,7 +5,7 @@ package dsptools.numbers //scalastyle:off magic.number import chisel3.testers.BasicTester -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import dsptools.numbers.implicits._ import org.scalatest.freespec.AnyFreeSpec diff --git a/src/test/scala/dsptools/numbers/FixedPrecisionChangerSpec.scala b/src/test/scala/dsptools/numbers/FixedPrecisionChangerSpec.scala index 567b3da6..f758cf94 100644 --- a/src/test/scala/dsptools/numbers/FixedPrecisionChangerSpec.scala +++ b/src/test/scala/dsptools/numbers/FixedPrecisionChangerSpec.scala @@ -2,7 +2,7 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import chiseltest._ import chiseltest.iotesters._ diff --git a/src/test/scala/dsptools/numbers/NumbersSpec.scala b/src/test/scala/dsptools/numbers/NumbersSpec.scala index 82125a60..326dd10a 100644 --- a/src/test/scala/dsptools/numbers/NumbersSpec.scala +++ b/src/test/scala/dsptools/numbers/NumbersSpec.scala @@ -2,7 +2,7 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import chiseltest._ import chiseltest.experimental.sanitizeFileName diff --git a/src/test/scala/dsptools/numbers/ParameterizedOpSpec.scala b/src/test/scala/dsptools/numbers/ParameterizedOpSpec.scala index ac50a987..86b1ad57 100644 --- a/src/test/scala/dsptools/numbers/ParameterizedOpSpec.scala +++ b/src/test/scala/dsptools/numbers/ParameterizedOpSpec.scala @@ -3,7 +3,7 @@ package dsptools.numbers import breeze.math.Complex -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import chiseltest._ import chiseltest.iotesters._ @@ -13,10 +13,16 @@ import dsptools.misc.PeekPokeDspExtensions //scalastyle:off magic.number +object Operation extends Enumeration { + type Operation = Value + val Add, Sub, Mul = Value +} +import Operation.{Add, Mul, Sub} + class ParameterizedNumberOperation[T <: Data: Ring]( inputGenerator: () => T, outputGenerator: () => T, - val op: String = "+") + val op: Operation.Value = Add) extends Module { val io = IO(new Bundle { val a1: T = Input(inputGenerator().cloneType) @@ -28,9 +34,9 @@ class ParameterizedNumberOperation[T <: Data: Ring]( register1 := { op match { - case "+" => io.a1 + io.a2 - case "-" => io.a1 - io.a2 - case "*" => DspContext.withTrimType(NoTrim) { io.a1 * io.a2 } + case Add => io.a1 + io.a2 + case Sub => io.a1 - io.a2 + case Mul => DspContext.withTrimType(NoTrim) { io.a1 * io.a2 } // case "/" => io.a1 / io.a2 case _ => throw new Exception(s"Bad operator $op passed to ParameterizedNumberOperation") } @@ -47,9 +53,9 @@ class ParameterizedOpTester[T <: Data: Ring](c: ParameterizedNumberOperation[T]) j <- BigDecimal(0.0) to 4.0 by 0.5 } { val expected = c.op match { - case "+" => i + j - case "-" => i - j - case "*" => i * j + case Add => i + j + case Sub => i - j + case Mul => i * j case _ => i + j } @@ -72,7 +78,7 @@ class ParameterizedOpSpec extends AnyFreeSpec with ChiselScalatestTester { def fixedOutGenerator(): FixedPoint = FixedPoint(48.W, 8.BP) "process Real numbers with the basic mathematical operations" - { - Seq("+", "-", "*").foreach { operation => + Seq(Add, Sub, Mul).foreach { operation => s"operation $operation should work for all inputs" in { test(new ParameterizedNumberOperation(realGenerator, realGenerator, operation)) .withAnnotations(Seq(VerilatorBackendAnnotation)) @@ -81,7 +87,7 @@ class ParameterizedOpSpec extends AnyFreeSpec with ChiselScalatestTester { } } "process Fixed point numbers with the basic mathematical operations" - { - Seq("+", "-", "*").foreach { operation => + Seq(Add, Sub, Mul).foreach { operation => s"operation $operation should work for all inputs" in { test(new ParameterizedNumberOperation(fixedInGenerator, fixedOutGenerator, operation)) .runPeekPoke(new ParameterizedOpTester(_)) @@ -102,9 +108,9 @@ class ComplexOpTester[T <: DspComplex[_]](c: ParameterizedNumberOperation[T]) val c2 = Complex(j, i) val expected = c.op match { - case "+" => c1 + c2 - case "-" => c1 - c2 - case "*" => c1 * c2 + case Add => c1 + c2 + case Sub => c1 - c2 + case Mul => c1 * c2 case _ => c1 + c2 } @@ -135,7 +141,7 @@ class ComplexOpSpec extends AnyFreeSpec with ChiselScalatestTester { } "process DspComplex[Real] numbers with the basic mathematical operations" - { - Seq("+", "-", "*").foreach { operation => + Seq(Add, Sub, Mul).foreach { operation => s"operation $operation should work for all inputs" in { test(new ParameterizedNumberOperation(complexRealGenerator, complexRealGenerator, operation)) .withAnnotations(Seq(VerilatorBackendAnnotation)) @@ -145,7 +151,7 @@ class ComplexOpSpec extends AnyFreeSpec with ChiselScalatestTester { } "process DspComplex[FixedPoint] numbers with the basic mathematical operations" - { - Seq("+", "-", "*").foreach { operation => + Seq(Add, Sub, Mul).foreach { operation => s"operation $operation should work for all inputs" in { test(new ParameterizedNumberOperation(complexFixedGenerator, complexFixedOutputGenerator, operation)) .runPeekPoke(new ComplexOpTester(_)) diff --git a/src/test/scala/dsptools/numbers/TypeclassSpec.scala b/src/test/scala/dsptools/numbers/TypeclassSpec.scala index 79d10033..4a23cc2e 100644 --- a/src/test/scala/dsptools/numbers/TypeclassSpec.scala +++ b/src/test/scala/dsptools/numbers/TypeclassSpec.scala @@ -2,7 +2,7 @@ package dsptools.numbers -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import chiseltest._ import chiseltest.iotesters._ diff --git a/src/test/scala/examples/ParameterizedAdderSpec.scala b/src/test/scala/examples/ParameterizedAdderSpec.scala index 3edc0e51..898d4783 100644 --- a/src/test/scala/examples/ParameterizedAdderSpec.scala +++ b/src/test/scala/examples/ParameterizedAdderSpec.scala @@ -2,7 +2,7 @@ package examples -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import chiseltest._ import chiseltest.iotesters.PeekPokeTester diff --git a/src/test/scala/examples/SimpleAdderSpec.scala b/src/test/scala/examples/SimpleAdderSpec.scala index e8209d36..59030641 100644 --- a/src/test/scala/examples/SimpleAdderSpec.scala +++ b/src/test/scala/examples/SimpleAdderSpec.scala @@ -2,7 +2,7 @@ package examples -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import chiseltest._ import chiseltest.iotesters.PeekPokeTester diff --git a/src/test/scala/examples/SimpleComplexMultiplierSpec.scala b/src/test/scala/examples/SimpleComplexMultiplierSpec.scala index adc03eb1..662cb095 100644 --- a/src/test/scala/examples/SimpleComplexMultiplierSpec.scala +++ b/src/test/scala/examples/SimpleComplexMultiplierSpec.scala @@ -2,7 +2,7 @@ package examples -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import fixedpoint._ import chiseltest._ import chiseltest.iotesters._ diff --git a/src/test/scala/examples/SimpleDspModuleSpec.scala b/src/test/scala/examples/SimpleDspModuleSpec.scala index 96b13de7..df5e304b 100644 --- a/src/test/scala/examples/SimpleDspModuleSpec.scala +++ b/src/test/scala/examples/SimpleDspModuleSpec.scala @@ -3,7 +3,7 @@ package examples // Allows you to use Chisel Module, Bundle, etc. -import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _} +import chisel3._ import dsptools.misc.PeekPokeDspExtensions // Allows you to use FixedPoint import fixedpoint._