Skip to content

Commit 24c7a59

Browse files
committed
Merge branch 'master' into 3.6-release
2 parents e33d2a5 + 9f416dd commit 24c7a59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+726
-279
lines changed

.github/workflows/install-circt/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ inputs:
44
version:
55
description: 'version to install'
66
required: false
7-
default: 'firtool-1.30.0'
7+
default: 'firtool-1.31.0'
88

99
runs:
1010
using: composite

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
jvm: ["8"]
2020
scala: ["2.13.10", "2.12.17"]
2121
espresso: ["2.4"]
22-
circt: ["firtool-1.30.0"]
22+
circt: ["firtool-1.31.0"]
2323
runs-on: ${{ matrix.system }}
2424

2525
steps:
@@ -131,6 +131,9 @@ jobs:
131131
gem install jekyll-redirect-from
132132
- name: Install CIRCT
133133
uses: ./.github/workflows/install-circt
134+
#TODO: make the microsite building include building ScalaDoc
135+
- name: Build the docs
136+
run: sbt doc
134137
- name: Build the microsite
135138
run: make -C website
136139
env:
@@ -200,7 +203,7 @@ jobs:
200203
- name: Setup GPG (for Publish)
201204
uses: olafurpg/setup-gpg@v3
202205
- name: Publish
203-
run: sbt ci-release
206+
run: sbt -DdisableFatalWarnings ci-release
204207
env:
205208
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
206209
PGP_SECRET: ${{ secrets.PGP_SECRET }}

build.sbt

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,29 @@ lazy val commonSettings = Seq(
3636
}
3737
)
3838

39+
lazy val fatalWarningsSettings = Seq(
40+
scalacOptions ++= {
41+
CrossVersion.partialVersion(scalaVersion.value) match {
42+
case Some((2, n)) if n >= 13 =>
43+
if (sys.props.contains("disableFatalWarnings")) {
44+
Nil
45+
} else {
46+
"-Werror" :: Nil
47+
}
48+
49+
case _ => Nil
50+
}
51+
}
52+
)
53+
3954
lazy val warningSuppression = Seq(
4055
scalacOptions += "-Wconf:" + Seq(
4156
"msg=APIs in chisel3.internal:s",
4257
"msg=Importing from firrtl:s",
4358
"msg=migration to the MLIR:s",
4459
"msg=method hasDefiniteSize in trait IterableOnceOps is deprecated:s", // replacement `knownSize` is not in 2.12
45-
"msg=object JavaConverters in package collection is deprecated:s"
60+
"msg=object JavaConverters in package collection is deprecated:s",
61+
"msg=undefined in comment for method cf in class PrintableHelper:s"
4662
).mkString(",")
4763
)
4864

@@ -96,6 +112,7 @@ lazy val chiselSettings = Seq(
96112
)
97113

98114
autoCompilerPlugins := true
115+
autoAPIMappings := true
99116

100117
// Plugin must be fully cross-versioned (published for Scala minor version)
101118
// The plugin only works in Scala 2.12+
@@ -136,7 +153,6 @@ lazy val plugin = (project in file("plugin"))
136153
.settings(publishSettings: _*)
137154
.settings(
138155
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
139-
scalacOptions += "-Xfatal-warnings",
140156
crossScalaVersions := pluginScalaVersions,
141157
// Must be published for Scala minor version
142158
crossVersion := CrossVersion.full,
@@ -145,6 +161,7 @@ lazy val plugin = (project in file("plugin"))
145161
target.value / s"scala-${scalaVersion.value}"
146162
}
147163
)
164+
.settings(fatalWarningsSettings: _*)
148165
.settings(
149166
mimaPreviousArtifacts := {
150167
Set()
@@ -182,6 +199,7 @@ lazy val core = (project in file("core"))
182199
.settings(publishSettings: _*)
183200
.settings(mimaPreviousArtifacts := Set())
184201
.settings(warningSuppression: _*)
202+
.settings(fatalWarningsSettings: _*)
185203
.settings(
186204
name := "chisel3-core",
187205
libraryDependencies ++= Seq(
@@ -213,6 +231,7 @@ lazy val chisel = (project in file("."))
213231
.dependsOn(core)
214232
.aggregate(macros, core, plugin)
215233
.settings(warningSuppression: _*)
234+
.settings(fatalWarningsSettings: _*)
216235
.settings(
217236
mimaPreviousArtifacts := Set(),
218237
Test / scalacOptions ++= Seq("-language:reflectiveCalls"),
@@ -264,6 +283,8 @@ lazy val integrationTests = (project in file("integration-tests"))
264283
.dependsOn(chisel)
265284
.dependsOn(standardLibrary)
266285
.settings(commonSettings: _*)
286+
.settings(warningSuppression: _*)
287+
.settings(fatalWarningsSettings: _*)
267288
.settings(chiselSettings: _*)
268289
.settings(usePluginSettings: _*)
269290
.settings(
@@ -287,7 +308,6 @@ lazy val docs = project // new documentation project
287308
.settings(commonSettings)
288309
.settings(
289310
scalacOptions ++= Seq(
290-
"-Xfatal-warnings",
291311
"-language:reflectiveCalls",
292312
"-language:implicitConversions",
293313
"-Wconf:msg=firrtl:s"
@@ -300,7 +320,4 @@ lazy val docs = project // new documentation project
300320
"BUILD_DIR" -> "docs-target" // build dir for mdoc programs to dump temp files
301321
)
302322
)
303-
304-
addCommandAlias("com", "all compile")
305-
addCommandAlias("lint", "; compile:scalafix --check ; test:scalafix --check")
306-
addCommandAlias("fix", "all compile:scalafix test:scalafix")
323+
.settings(fatalWarningsSettings: _*)

core/src/main/scala/chisel3/Aggregate.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ sealed class Vec[T <: Data] private[chisel3] (gen: => T, val length: Int) extend
227227

228228
/** The "bulk connect operator", assigning elements in this Vec from elements in a Seq.
229229
*
230-
* For chisel3._, uses the [[BiConnect]] algorithm; sub-elements of `that` may end up driving sub-elements of `this`
230+
* For chisel3._, uses the `chisel3.internal.BiConnect` algorithm; sub-elements of `that` may end up driving sub-elements of `this`
231231
* - Complicated semantics, will likely be deprecated in the future
232232
*
233233
* For Chisel._, emits the FIRRTL.<- operator
@@ -249,7 +249,7 @@ sealed class Vec[T <: Data] private[chisel3] (gen: => T, val length: Int) extend
249249

250250
/** The "bulk connect operator", assigning elements in this Vec from elements in a Vec.
251251
*
252-
* For chisel3._, uses the [[BiConnect]] algorithm; sub-elements of `that` may end up driving sub-elements of `this`
252+
* For chisel3._, uses the `chisel3.internal.BiConnect` algorithm; sub-elements of `that` may end up driving sub-elements of `this`
253253
* - See docs/src/explanations/connection-operators.md for details
254254
*
255255
* For Chisel._, emits the FIRRTL.<- operator
@@ -1159,11 +1159,11 @@ abstract class Record(private[chisel3] implicit val compileOptions: CompileOptio
11591159
clone
11601160
}
11611161

1162-
/** The collection of [[Data]]
1162+
/** The collection of [[chisel3.Data]]
11631163
*
11641164
* This underlying datastructure is a ListMap because the elements must
11651165
* remain ordered for serialization/deserialization. Elements added later
1166-
* are higher order when serialized (this is similar to [[Vec]]). For example:
1166+
* are higher order when serialized (this is similar to `Vec`). For example:
11671167
* {{{
11681168
* // Assume we have some type MyRecord that creates a Record from the ListMap
11691169
* val record = MyRecord(ListMap("fizz" -> UInt(16.W), "buzz" -> UInt(16.W)))

core/src/main/scala/chisel3/Annotation.scala

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@ trait ChiselMultiAnnotation {
2828
def toFirrtl: Seq[Annotation]
2929
}
3030

31-
/** Mixin for [[ChiselAnnotation]] that instantiates an associated FIRRTL Transform when this Annotation is present
32-
* during a run of
33-
* [[Driver$.execute(args:Array[String],dut:()=>chisel3\.RawModule)* Driver.execute]].
34-
* Automatic Transform instantiation is *not* supported when the Circuit and Annotations are serialized before invoking
35-
* FIRRTL.
31+
/** Mixin for [[ChiselAnnotation]] that instantiates an associated Transform when this Annotation is present
3632
*/
3733
trait RunFirrtlTransform extends ChiselAnnotation {
3834
def transformClass: Class[_ <: Transform]
@@ -78,12 +74,7 @@ object annotate {
7874
* io.out(1) := fullAdder(io.a, io.b, "mod2")
7975
* }
8076
* }}}
81-
*
82-
* @note Calling this on [[Data]] creates an annotation that Chisel emits to a separate annotations
83-
* file. This file must be passed to FIRRTL independently of the `.fir` file. The execute methods
84-
* in [[chisel3.Driver]] will pass the annotations to FIRRTL automatically.
8577
*/
86-
8778
object doNotDedup {
8879

8980
/** Marks a module to be ignored in Dedup Transform in Firrtl

core/src/main/scala/chisel3/Bits.scala

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,22 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
148148

149149
/** @group SourceInfoTransformMacro */
150150
final def do_extract(x: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
151+
this.widthOption.foreach { thisWidth =>
152+
if (thisWidth == 0) {
153+
Builder.error(s"Cannot extract from zero-width")
154+
} else {
155+
x.widthOption.foreach { xWidth =>
156+
if (xWidth >= 31 || (1 << (xWidth - 1)) >= thisWidth) {
157+
Builder.warning(s"Dynamic index with width $xWidth is too large for extractee of width $thisWidth")
158+
} else if ((1 << xWidth) < thisWidth) {
159+
Builder.warning(s"Dynamic index with width $xWidth is too small for extractee of width $thisWidth")
160+
}
161+
}
162+
}
163+
}
151164
val theBits = this >> x
152-
theBits(0)
165+
val noExtract = theBits.widthOption.exists(_ <= 1)
166+
if (noExtract) theBits.asBool else theBits(0)
153167
}
154168

155169
/** Returns the specified bit on this wire as a [[Bool]], dynamically addressed.
@@ -360,10 +374,10 @@ sealed abstract class Bits(private[chisel3] val width: Width) extends Element wi
360374
/** @group SourceInfoTransformMacro */
361375
def do_asSInt(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): SInt
362376

363-
/** Reinterpret this $coll as a [[FixedPoint]].
377+
/** Reinterpret this $coll as a `FixedPoint`.
364378
*
365379
* @note The value is not guaranteed to be preserved. For example, a [[UInt]] of width 3 and value 7 (0b111) would
366-
* become a [[FixedPoint]] with value -1. The interpretation of the number is also affected by the specified binary
380+
* become a `FixedPoint` with value -1. The interpretation of the number is also affected by the specified binary
367381
* point. '''Caution is advised!'''
368382
*/
369383
@deprecated(deprecatedMFCMessage, "Chisel 3.6")
@@ -1317,7 +1331,7 @@ package experimental {
13171331
@deprecated(deprecatedMFCMessage, "Chisel 3.6")
13181332
def binaryPoint: BinaryPoint
13191333

1320-
/** Return the [[Double]] value of this instance if it is a Literal
1334+
/** Return the `Double` value of this instance if it is a Literal
13211335
* @note this method may throw an exception if the literal value won't fit in a Double
13221336
*/
13231337
@deprecated(deprecatedMFCMessage, "Chisel 3.6")
@@ -1334,7 +1348,7 @@ package experimental {
13341348
@deprecated(deprecatedMFCMessage, "Chisel 3.6")
13351349
def litToDouble: Double = litToDoubleOption.get
13361350

1337-
/** Return the [[BigDecimal]] value of this instance if it is a Literal
1351+
/** Return the [[scala.math.BigDecimal]] value of this instance if it is a Literal
13381352
* @note this method may throw an exception if the literal value won't fit in a BigDecimal
13391353
*/
13401354
@deprecated(deprecatedMFCMessage, "Chisel 3.6")
@@ -1346,7 +1360,7 @@ package experimental {
13461360
}
13471361
}
13481362

1349-
/** Return the [[BigDecimal]] value of this instance assuming it is a literal (convenience method)
1363+
/** Return the [[scala.math.BigDecimal]] value of this instance assuming it is a literal (convenience method)
13501364
* @return
13511365
*/
13521366
@deprecated(deprecatedMFCMessage, "Chisel 3.6")
@@ -1846,7 +1860,7 @@ package experimental {
18461860
* val one = 1.I
18471861
* val six = Seq.fill(6)(one).reduce(_ + _)
18481862
* }}}
1849-
* A UInt computed in this way would require a [[Width]]
1863+
* A UInt computed in this way would require a `Width`
18501864
* binary point
18511865
* The width and binary point may be inferred.
18521866
*

core/src/main/scala/chisel3/Data.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ abstract class Data extends HasId with NamedComponent with SourceInfoDoc {
723723

724724
/** The "bulk connect operator", assigning elements in this Vec from elements in a Vec.
725725
*
726-
* For chisel3._, uses the [[BiConnect]] algorithm; sub-elements of `that` may end up driving sub-elements of `this`
726+
* For chisel3._, uses the `chisel3.internal.BiConnect` algorithm; sub-elements of that` may end up driving sub-elements of `this`
727727
* - Complicated semantics, hard to write quickly, will likely be deprecated in the future
728728
*
729729
* For Chisel._, emits the FIRRTL.<- operator

core/src/main/scala/chisel3/Module.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ package experimental {
401401

402402
/** The desired name of this module (which will be used in generated FIRRTL IR or Verilog).
403403
*
404-
* The name of a module approximates the behavior of the Java Reflection [[`getSimpleName` method
405-
* https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getSimpleName--]] with some modifications:
404+
* The name of a module approximates the behavior of the Java Reflection `getSimpleName` method
405+
* https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getSimpleName-- with some modifications:
406406
*
407407
* - Anonymous modules will get an `"_Anon"` tag
408408
* - Modules defined in functions will use their class name and not a numeric name

core/src/main/scala/chisel3/VerificationStatement.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ object assert extends VerifPrintMacrosDoc {
6464
* @param cond condition, assertion fires (simulation fails) on a rising clock edge when false and reset is not asserted
6565
* @param message optional chisel Printable type message
6666
*
67-
* @note See [[printf.apply(fmt:Printable)]] for documentation on printf using Printables
67+
* @note See [[printf.apply(pable:chisel3\.Printable)*]] for documentation on printf using Printables
6868
* @note currently cannot be used in core Chisel / libraries because macro
6969
* defs need to be compiled first and the SBT project is not set up to do
7070
* that
@@ -239,7 +239,7 @@ object assume extends VerifPrintMacrosDoc {
239239
* @param cond condition, assertion fires (simulation fails) when false
240240
* @param message optional Printable type message when the assertion fires
241241
*
242-
* @note See [[printf.apply(fmt:Printable]] for documentation on printf using Printables
242+
* @note See [[printf.apply(pable:chisel3\.Printable)*]] for documentation on printf using Printables
243243
*/
244244
def apply(
245245
cond: Bool,

core/src/main/scala/chisel3/connectable/Connectable.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ object Connectable {
125125
* $chiselTypeRestrictions
126126
*
127127
* Additional notes:
128-
* - Connecting two [[util.DecoupledIO]]'s would connect `bits`, `valid`, AND `ready` from producer to consumer (despite `ready` being flipped)
128+
* - Connecting two `util.DecoupledIO`'s would connect `bits`, `valid`, AND `ready` from producer to consumer (despite `ready` being flipped)
129129
* - Functionally equivalent to chisel3.:=, but different than Chisel.:=
130130
*
131131
* @group connection
@@ -143,7 +143,7 @@ object Connectable {
143143
* $chiselTypeRestrictions
144144
*
145145
* Additional notes:
146-
* - Connecting two [[util.DecoupledIO]]'s would connect `bits` and `valid` from producer to consumer, but leave `ready` unconnected
146+
* - Connecting two `util.DecoupledIO`'s would connect `bits` and `valid` from producer to consumer, but leave `ready` unconnected
147147
*
148148
* @group connection
149149
*
@@ -160,7 +160,7 @@ object Connectable {
160160
* $chiselTypeRestrictions
161161
*
162162
* Additional notes:
163-
* - Connecting two [[util.DecoupledIO]]'s would connect `ready` from consumer to producer, but leave `bits` and `valid` unconnected
163+
* - Connecting two `util.DecoupledIO`'s would connect `ready` from consumer to producer, but leave `bits` and `valid` unconnected
164164
*
165165
* @group connection
166166
*
@@ -182,7 +182,7 @@ object Connectable {
182182
* - An additional type restriction is that all relative orientations of `consumer` and `producer` must match exactly.
183183
*
184184
* Additional notes:
185-
* - Connecting two wires of [[util.DecoupledIO]] chisel type would connect `bits` and `valid` from producer to consumer, and `ready` from consumer to producer.
185+
* - Connecting two wires of `util.DecoupledIO` chisel type would connect `bits` and `valid` from producer to consumer, and `ready` from consumer to producer.
186186
* - If the types of consumer and producer also have identical relative flips, then we can emit FIRRTL.<= as it is a stricter version of chisel3.:<>=
187187
* - "turk-duck-en" is a dish where a turkey is stuffed with a duck, which is stuffed with a chicken; `:<>=` is a `:=` stuffed with a `<>`
188188
*

core/src/main/scala/chisel3/dontTouch.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ import firrtl.transforms.DontTouchAnnotation
1919
* dontTouch(dead) // Marking it as such will preserve it
2020
* }
2121
* }}}
22-
* @note Calling this on [[Data]] creates an annotation that Chisel emits to a separate annotations
23-
* file. This file must be passed to FIRRTL independently of the `.fir` file. The execute methods
24-
* in [[chisel3.Driver]] will pass the annotations to FIRRTL automatically.
2522
* @note Because this is an optimization barrier, constants will not be propagated through a signal marked as
2623
* dontTouch.
2724
*/

core/src/main/scala/chisel3/experimental/Trace.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ object Trace {
5959
def duplicate(n: T): Annotation = this.copy(target = n)
6060
}
6161

62-
/** Get [[CompleteTarget]] of the target `x` for `annos`.
62+
/** Get `CompleteTarget` of the target `x` for `annos`.
6363
* This API can be used to find the final reference to a signal or module which is marked by `traceName`
6464
*/
6565
def finalTarget(annos: AnnotationSeq)(x: HasId): Seq[CompleteTarget] = finalTargetMap(annos)

0 commit comments

Comments
 (0)