Skip to content

Commit

Permalink
Merge pull request #251 from tymcauley/chisel-5.1.0-update
Browse files Browse the repository at this point in the history
Update Chisel version to 5.1.0
  • Loading branch information
jerryz123 authored Apr 29, 2024
2 parents 8f43366 + a310a15 commit fb3b3c6
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 43 deletions.
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion doc/Example.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion rocket/src/main/scala/jtag2mm/TestMultiplexer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package freechips.rocketchip.jtag2mm

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import chisel3.util._
import chisel3.experimental.{FixedPoint => _, _}
import fixedpoint._
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/dsptools/misc/DspTesterUtilities.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package dsptools.misc

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import dsptools.DspException
import dsptools.numbers.{DspComplex, DspReal}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/dsptools/misc/PeekPokeDspExtensions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package dsptools.numbers

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import dsptools.DspException
import breeze.math.Complex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package dsptools.numbers

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import dsptools.hasContext
import implicits._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package dsptools.numbers

import chisel3.util.ShiftRegister
import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import dsptools.{hasContext, DspContext, NoTrim}
import fixedpoint._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package dsptools.numbers

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import chisel3.util.ShiftRegister
import dsptools._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/dsptools/numbers/implicits/AllOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package dsptools.numbers

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import spire.macros.Ops

import scala.language.experimental.macros
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/dsptools/ShiftRegisterDelaySpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package dsptools

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import chiseltest._
import chiseltest.iotesters._
import dsptools.misc.PeekPokeDspExtensions
Expand Down
3 changes: 1 addition & 2 deletions src/test/scala/dsptools/numbers/AbsSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/dsptools/numbers/FixedPointSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package dsptools.numbers

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import chiseltest._
import chiseltest.iotesters._
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/dsptools/numbers/NumbersSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package dsptools.numbers

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import chiseltest._
import chiseltest.experimental.sanitizeFileName
Expand Down
36 changes: 21 additions & 15 deletions src/test/scala/dsptools/numbers/ParameterizedOpSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package dsptools.numbers

import breeze.math.Complex
import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import chiseltest._
import chiseltest.iotesters._
Expand All @@ -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)
Expand All @@ -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")
}
Expand All @@ -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
}

Expand All @@ -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))
Expand All @@ -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(_))
Expand All @@ -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
}

Expand Down Expand Up @@ -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))
Expand All @@ -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(_))
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/dsptools/numbers/TypeclassSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package dsptools.numbers

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import chiseltest._
import chiseltest.iotesters._
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/examples/ParameterizedAdderSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package examples

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import chiseltest._
import chiseltest.iotesters.PeekPokeTester
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/examples/SimpleAdderSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package examples

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import chiseltest._
import chiseltest.iotesters.PeekPokeTester
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/examples/SimpleComplexMultiplierSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package examples

import chisel3.{fromDoubleToLiteral => _, fromIntToBinaryPoint => _, _}
import chisel3._
import fixedpoint._
import chiseltest._
import chiseltest.iotesters._
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/examples/SimpleDspModuleSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down

0 comments on commit fb3b3c6

Please sign in to comment.