WIP uncore and rocket changes compile
This commit is contained in:
@ -36,6 +36,23 @@ object MuxT {
|
||||
(Mux(cond, con._1, alt._1), Mux(cond, con._2, alt._2), Mux(cond, con._3, alt._3))
|
||||
}
|
||||
|
||||
/** Creates a cascade of n MuxTs to search for a key value. */
|
||||
object MuxTLookup {
|
||||
def apply[S <: UInt, T <: Data, U <: Data](key: S, default: (T, U), mapping: Seq[(S, (T, U))]): (T, U) = {
|
||||
var res = default
|
||||
for ((k, v) <- mapping.reverse)
|
||||
res = MuxT(k === key, v, res)
|
||||
res
|
||||
}
|
||||
|
||||
def apply[S <: UInt, T <: Data, U <: Data, W <: Data](key: S, default: (T, U, W), mapping: Seq[(S, (T, U, W))]): (T, U, W) = {
|
||||
var res = default
|
||||
for ((k, v) <- mapping.reverse)
|
||||
res = MuxT(k === key, v, res)
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
object Str
|
||||
{
|
||||
def apply(s: String): UInt = {
|
||||
|
Reference in New Issue
Block a user