Skip to content

Commit

Permalink
fix: Werror match may not be exhaustive (#3268) (#3384)
Browse files Browse the repository at this point in the history
+ add `case _` to make match be exhaustive

(cherry picked from commit 05d9db7)

Co-authored-by: SingularityKChen <[email protected]>
  • Loading branch information
mergify[bot] and SingularityKChen authored Jun 15, 2023
1 parent d78198c commit e6ab023
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/main/scala/diplomacy/LazyModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,12 @@ abstract class LazyModule()(implicit val p: Parameters) {
val nodeDangles = nodes.reverse.flatMap(n => n.cloneDangles())
val allDangles = nodeDangles ++ childDangles
val pairing = SortedMap(allDangles.groupBy(_.source).toSeq: _*)
val done = Set() ++ pairing.values.filter(_.size == 2).map { case Seq(a, b) =>
require(a.flipped != b.flipped)
a.source
val done = Set() ++ pairing.values.filter(_.size == 2).map {
case Seq(a, b) =>
require(a.flipped != b.flipped)
a.source
case _ =>
None
}
val forward = allDangles.filter(d => !done(d.source))
val dangles = forward.map { d =>
Expand Down Expand Up @@ -346,15 +349,18 @@ sealed trait LazyModuleImpLike extends RawModule {
// For each [[source]] set of [[Dangle]]s of size 2, ensure that these
// can be connected as a source-sink pair (have opposite flipped value).
// Make the connection and mark them as [[done]].
val done = Set() ++ pairing.values.filter(_.size == 2).map { case Seq(a, b) =>
require(a.flipped != b.flipped)
// @todo <> in chisel3 makes directionless connection.
if (a.flipped) {
a.data <> b.data
} else {
b.data <> a.data
}
a.source
val done = Set() ++ pairing.values.filter(_.size == 2).map {
case Seq(a, b) =>
require(a.flipped != b.flipped)
// @todo <> in chisel3 makes directionless connection.
if (a.flipped) {
a.data <> b.data
} else {
b.data <> a.data
}
a.source
case _ =>
None
}
// Find all [[Dangle]]s which are still not connected. These will end up as [[AutoBundle]] [[IO]] ports on the module.
val forward = allDangles.filter(d => !done(d.source))
Expand Down

0 comments on commit e6ab023

Please sign in to comment.