diff --git a/uncore/src/main/scala/coherence.scala b/uncore/src/main/scala/coherence.scala index 5fa0b7a6..1a3c4573 100644 --- a/uncore/src/main/scala/coherence.scala +++ b/uncore/src/main/scala/coherence.scala @@ -5,11 +5,7 @@ import Chisel._ object MuxBundle { def apply[T <: Data] (default: T, mapping: Seq[(Bool, T)]): T = { - var res = default; - for ((t, v) <- mapping.reverse){ - res = Mux(t, v, res); - } - res + mapping.reverse.foldLeft(default)((b, a) => Mux(a._1, a._2, b)) } }