1
0

Add MuxT to mux on Tuple2 and Tuple3

This commit is contained in:
Andrew Waterman 2016-09-06 23:36:58 -07:00
parent 511cc6c5c5
commit 66e9f027e0

View File

@ -34,6 +34,14 @@ object Util {
} }
} }
object MuxT {
def apply[T <: Data, U <: Data](cond: Bool, con: (T, U), alt: (T, U)): (T, U) =
(Mux(cond, con._1, alt._1), Mux(cond, con._2, alt._2))
def apply[T <: Data, U <: Data, W <: Data](cond: Bool, con: (T, U, W), alt: (T, U, W)): (T, U, W) =
(Mux(cond, con._1, alt._1), Mux(cond, con._2, alt._2), Mux(cond, con._3, alt._3))
}
import Util._ import Util._
object Str object Str