Skip to content

Commit 6a52822

Browse files
committed
Update Chisel from 6.5.0 to 7.0.0
`UnknownWidth` became a `case object` in this Chisel PR: chipsalliance/chisel#4242 The `connectFromBits` method was removed in this Chisel PR: chipsalliance/chisel#4168 The `connectFromBits` API was replaced with the `_fromUInt` API in this Chisel PR: chipsalliance/chisel#4782 Wrapping unary negation (`unary_-%`) was deprecated in this PR: chipsalliance/chisel#4829 The sbt update is necessary to maintain compatibility with the latest Scala compiler version.
1 parent e40a376 commit 6a52822

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ env:
2020
VERILATOR_REPO: https://github.com/verilator/verilator
2121
VERILATOR_DIR: verilator
2222
VERILATOR_VERSION_TAG: v4.228
23-
FIRTOOL_VERSION: v1.62.0
24-
FIRTOOL_VERSION_TAG: firtool-1.62.0
23+
FIRTOOL_VERSION_TAG: firtool-1.111.1
2524

2625
jobs:
2726
test:
@@ -37,7 +36,7 @@ jobs:
3736
java-version: ${{ env.JDK_VERSION }}
3837
distribution: ${{ env.JDK_DIST }}
3938
cache: 'sbt'
40-
- name: Install firtool ${{ env.FIRTOOL_VERSION }}
39+
- name: Install firtool ${{ env.FIRTOOL_VERSION_TAG }}
4140
run: |
4241
wget -q -O - "https://github.com/llvm/circt/releases/download/${{ env.FIRTOOL_VERSION_TAG }}/firrtl-bin-linux-x64.tar.gz" | tar -zx
4342
sudo mv "${{ env.FIRTOOL_VERSION_TAG }}/bin/firtool" /usr/local/bin

build.sbt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
scalaVersion := "2.13.14"
1+
scalaVersion := "2.13.16"
22
scalacOptions += "-language:higherKinds"
33
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.13.3" cross CrossVersion.full)
44

@@ -12,12 +12,13 @@ scalacOptions ++= Seq(
1212
"-language:reflectiveCalls",
1313
"-Ymacro-annotations"
1414
)
15-
val chiselVersion = "6.5.0"
15+
val chiselVersion = "7.0.0-M2+639-5df5515f-SNAPSHOT"
1616
addCompilerPlugin("org.chipsalliance" %% "chisel-plugin" % chiselVersion cross CrossVersion.full)
1717
libraryDependencies ++= Seq(
1818
"org.chipsalliance" %% "chisel" % chiselVersion,
1919
"org.scalatest" %% "scalatest" % "3.2.15" % "test",
2020
"org.scalatestplus" %% "scalacheck-1-14" % "3.2.2.0" % "test",
2121
)
22+
resolvers ++= Resolver.sonatypeOssRepos("snapshots")
2223

2324
Test / parallelExecution := false

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.8.2
1+
sbt.version=1.10.7

src/main/scala/fixedpoint/FixedPoint.scala

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,13 @@ import chisel3.internal.sourceinfo.{SourceInfoTransform, SourceInfoWhiteboxTrans
2121

2222
import scala.collection.immutable.SeqMap
2323
import scala.language.experimental.macros
24+
import scala.math.BigDecimal.RoundingMode.RoundingMode
2425
import chisel3.util.Cat
2526

2627
object FixedPoint extends NumObject {
2728

2829
/** Create a FixedPoint type with inferred width. */
29-
def apply(): FixedPoint = apply(UnknownWidth(), BinaryPoint())
30+
def apply(): FixedPoint = apply(UnknownWidth, BinaryPoint())
3031

3132
/** Create a FixedPoint type or port with fixed width. */
3233
def apply(width: Width, binaryPoint: BinaryPoint): FixedPoint = new FixedPoint(width, binaryPoint)
@@ -42,15 +43,15 @@ object FixedPoint extends NumObject {
4243
* Use PrivateObject to force users to specify width and binaryPoint by name
4344
*/
4445
def fromBigInt(value: BigInt, binaryPoint: BinaryPoint = 0.BP): FixedPoint = {
45-
apply(value, UnknownWidth(), binaryPoint)
46+
apply(value, UnknownWidth, binaryPoint)
4647
}
4748

4849
/** Create a FixedPoint literal with inferred width from BigInt.
4950
* Use PrivateObject to force users to specify width and binaryPoint by name
5051
*/
5152
def fromBigInt(value: BigInt, width: Int, binaryPoint: Int): FixedPoint =
5253
if (width == -1) {
53-
apply(value, UnknownWidth(), BinaryPoint(binaryPoint))
54+
apply(value, UnknownWidth, BinaryPoint(binaryPoint))
5455
} else {
5556
apply(value, KnownWidth(width), BinaryPoint(binaryPoint))
5657
}
@@ -103,7 +104,7 @@ object FixedPoint extends NumObject {
103104
}
104105

105106
private[fixedpoint] def recreateWidth[T <: Data](d: T): Width = {
106-
d.widthOption.fold[Width](UnknownWidth())(_.W)
107+
d.widthOption.fold[Width](UnknownWidth)(_.W)
107108
}
108109

109110
/** Align all FixedPoints in a (possibly heterogeneous) sequence by width and binary point
@@ -145,7 +146,7 @@ object FixedPoint extends NumObject {
145146

146147
implicit class fromDoubleToLiteral(double: Double) {
147148
def F(binaryPoint: BinaryPoint): FixedPoint = {
148-
FixedPoint.fromDouble(double, UnknownWidth(), binaryPoint)
149+
FixedPoint.fromDouble(double, UnknownWidth, binaryPoint)
149150
}
150151

151152
def F(width: Width, binaryPoint: BinaryPoint): FixedPoint = {
@@ -155,7 +156,7 @@ object FixedPoint extends NumObject {
155156

156157
implicit class fromBigDecimalToLiteral(bigDecimal: BigDecimal) {
157158
def F(binaryPoint: BinaryPoint): FixedPoint = {
158-
FixedPoint.fromBigDecimal(bigDecimal, UnknownWidth(), binaryPoint)
159+
FixedPoint.fromBigDecimal(bigDecimal, UnknownWidth, binaryPoint)
159160
}
160161

161162
def F(width: Width, binaryPoint: BinaryPoint): FixedPoint = {
@@ -223,8 +224,6 @@ sealed class FixedPoint private[fixedpoint] (width: Width, private var _inferred
223224

224225
def do_unary_-(implicit sourceInfo: SourceInfo): FixedPoint = FixedPoint.fromData(binaryPoint, -data)
225226

226-
def do_unary_-%(implicit sourceInfo: SourceInfo): FixedPoint = FixedPoint.fromData(binaryPoint, data.unary_-%)
227-
228227
override def do_*(that: FixedPoint)(implicit sourceInfo: SourceInfo): FixedPoint =
229228
FixedPoint.fromData(binaryPoint + that.binaryPoint, data * that.data)
230229

@@ -325,8 +324,10 @@ sealed class FixedPoint private[fixedpoint] (width: Width, private var _inferred
325324

326325
override def bulkConnect(that: Data)(implicit sourceInfo: SourceInfo): Unit = connectOp(that, _ <> _)
327326

328-
override def connectFromBits(that: Bits)(implicit sourceInfo: SourceInfo): Unit = {
329-
this.data := that.asTypeOf(this.data)
327+
override protected def _fromUInt(that: UInt)(implicit sourceInfo: SourceInfo): Data = {
328+
val _w = Wire(this.cloneType)
329+
_w.data := that.asTypeOf(this.data)
330+
_w
330331
}
331332

332333
def apply(x: BigInt): Bool = data.apply(x)

src/test/scala/FixedPointSpec.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ class FixedPointFromBitsTester extends BasicTester {
7676
val f6bp0 = 6.0.F(0.BP)
7777
val f6bp2 = 6.0.F(2.BP)
7878

79-
val f1bp5shiftleft2 = Wire(FixedPoint(UnknownWidth(), BinaryPoint()))
80-
val f6bp0shiftright2 = Wire(FixedPoint(UnknownWidth(), BinaryPoint()))
81-
val f6bp2shiftright2 = Wire(FixedPoint(UnknownWidth(), BinaryPoint()))
79+
val f1bp5shiftleft2 = Wire(FixedPoint(UnknownWidth, BinaryPoint()))
80+
val f6bp0shiftright2 = Wire(FixedPoint(UnknownWidth, BinaryPoint()))
81+
val f6bp2shiftright2 = Wire(FixedPoint(UnknownWidth, BinaryPoint()))
8282

8383
f1bp5shiftleft2 := f1bp5 << 2
8484
f6bp0shiftright2 := f6bp0 >> 2

0 commit comments

Comments
 (0)