diff --git a/src/main/scala/diplomacy/LazyModule.scala b/src/main/scala/diplomacy/LazyModule.scala index 5849657f5d7..75231d4e580 100644 --- a/src/main/scala/diplomacy/LazyModule.scala +++ b/src/main/scala/diplomacy/LazyModule.scala @@ -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 => @@ -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))